Last active
November 21, 2019 19:11
-
-
Save yuvipanda/335ccbfa48077fc13e5c79ff86f1a48c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import boto3 | |
| import yaml | |
| jupyter_image = os.environ['JUPYTER_IMAGE'] | |
| session = boto3.Session() | |
| credentials = session.get_credentials() | |
| aws_creds = {'key': credentials.access_key, 'secret': credentials.secret_key} | |
| dask_worker_spec = f'''kind: Pod | |
| spec: | |
| restartPolicy: Never | |
| affinity: | |
| nodeAffinity: | |
| requiredDuringSchedulingIgnoredDuringExecution: | |
| nodeSelectorTerms: | |
| - matchExpressions: | |
| - key: hub.jupyter.org/node-purpose | |
| operator: In | |
| values: | |
| - cpu-worker | |
| tolerations: | |
| - effect: NoSchedule | |
| key: hub.jupyter.org_dedicated | |
| operator: Equal | |
| value: cpu-worker | |
| containers: | |
| - image: {jupyter_image} | |
| imagePullPolicy: IfNotPresent | |
| args: [conda, run, -n, geostack, dask-worker, --nprocs, '8', --nthreads, '1', --dashboard, --memory-limit, '63.75GB', --death-timeout, '60'] | |
| name: dask-high-cpu-memory | |
| resources: | |
| limits: | |
| cpu: "8" | |
| memory: "63G" | |
| requests: | |
| cpu: "7.75" | |
| memory: "63G"''' | |
| from dask_kubernetes import KubeCluster | |
| from dask.distributed import Client | |
| cluster = KubeCluster.from_dict(yaml.safe_load(dask_worker_spec), silence_logs='error', env=creds) | |
| client = Client(cluster) | |
| cluster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment