GithubHelp home page GithubHelp logo

dask_on_k8s's Introduction

Prerequisties

  1. k8s cluster using minikube
  2. conda env with python 3.9 and,
  3. dask and dask_kubernetes installed

k8s

Fetch minikube from https://minikube.sigs.k8s.io/docs/start/. Spin a k8s cluster using

minikube config set vm-driver docker
minikube start --memory 16000 --cpus=8

as soon as it is up, start the dashboard with

minikube dashboard

You may watch the pods in the cluster with:

watch -n1 "minikube kubectl -- get pods -A -o wide

Python packages

Preferably create a new conda env with python 3.9 and install the following packages:

  • dask: conda install dask
  • dask-kubernetes with: conda install dask-kubernetes -c conda-forge

Example

The following example is taken from https://kubernetes.dask.org/en/latest/kubecluster.html:

from dask_kubernetes import KubeCluster, make_pod_spec

pod_spec = make_pod_spec(
    image="ghcr.io/dask/dask:latest",
    memory_limit="1G",
    memory_request="1G",
    cpu_limit=1,
    cpu_request=1,
)

cluster = KubeCluster(pod_spec)

cluster.scale(10)  # specify number of workers explicitly
cluster.adapt(minimum=1, maximum=100)  # or dynamically scale based on current workload


# Example usage
from dask.distributed import Client
import dask.array as da

# Connect Dask to the cluster
client = Client(cluster)

# Create a large array and calculate the mean
array = da.ones((1000, 1000, 1000))
print(array.mean().compute())  # Should print 1.0

dask_on_k8s's People

Contributors

makism avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.