Skip to content

Commit

Permalink
fix: update simpleworkergroup to point to correct service, add schedu…
Browse files Browse the repository at this point in the history
…ler name call to operator daskworkergroup_update
  • Loading branch information
Sam Dyson committed May 7, 2022
1 parent 6135bc6 commit 42c1be3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions dask_kubernetes/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,22 @@ async def daskworkergroup_create(spec, name, namespace, logger, **kwargs):
async def daskworkergroup_update(spec, name, namespace, logger, **kwargs):
async with kubernetes.client.api_client.ApiClient() as api_client:
api = kubernetes.client.CoreV1Api(api_client)
cluster = await api.get_namespaced_custom_object(
group="kubernetes.dask.org",
version="v1",
plural="daskclusters",
namespace=namespace,
name=spec["cluster"],
)
workers = await api.list_namespaced_pod(
namespace=namespace,
label_selector=f"dask.org/workergroup-name={name}",
)
current_workers = len(workers.items)
desired_workers = spec["replicas"]
workers_needed = desired_workers - current_workers
scheduler_name = cluster["items"][0]["metadata"]["name"]

if workers_needed > 0:
for _ in range(workers_needed):
data = build_worker_pod_spec(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
imagePullPolicy: "IfNotPresent"
args:
- dask-worker
- tcp://simple-cluster.default.svc.cluster.local:8786
- tcp://simple-cluster-service.default.svc.cluster.local:8786
env:
- name: WORKER_ENV
value: hello-world # We dont test the value, just the name

0 comments on commit 42c1be3

Please sign in to comment.