Skip to content

Commit 7700a78

Browse files
committed
allows to setup plugins
1 parent 1ac32ac commit 7700a78

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

services/dask-sidecar/src/simcore_service_dask_sidecar/task_life_cycle_scheduler_plugin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
from typing import Any
33

4+
import click
45
from dask.typing import Key
56
from dask_task_models_library.models import TASK_LIFE_CYCLE_EVENT, TaskLifeCycleState
67
from distributed import Scheduler, SchedulerPlugin
@@ -49,3 +50,9 @@ def transition(
4950
key, kwargs.get("worker"), finish
5051
).model_dump(mode="json"),
5152
)
53+
54+
55+
@click.command()
56+
def dask_setup(scheduler):
57+
plugin = TaskLifecycleSchedulerPlugin()
58+
scheduler.add_plugin(plugin)

services/dask-sidecar/src/simcore_service_dask_sidecar/task_life_cycle_worker_plugin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from collections.abc import Awaitable
33
from typing import Any
44

5+
import click
56
from dask.typing import Key
67
from dask_task_models_library.models import TASK_LIFE_CYCLE_EVENT, TaskLifeCycleState
78
from distributed import WorkerPlugin
@@ -51,3 +52,9 @@ def transition(
5152
key, kwargs.get("worker"), finish
5253
).model_dump(mode="json"),
5354
)
55+
56+
57+
@click.command()
58+
async def dask_setup(worker: Worker) -> None:
59+
plugin = TaskLifecycleWorkerPlugin()
60+
await worker.plugin_add(plugin)

0 commit comments

Comments
 (0)