flyteplugins-dask 2.0.0b25__py3-none-any.whl → 2.0.0b28__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flyteplugins/dask/task.py +21 -4
- {flyteplugins_dask-2.0.0b25.dist-info → flyteplugins_dask-2.0.0b28.dist-info}/METADATA +1 -1
- flyteplugins_dask-2.0.0b28.dist-info/RECORD +6 -0
- flyteplugins_dask-2.0.0b25.dist-info/RECORD +0 -6
- {flyteplugins_dask-2.0.0b25.dist-info → flyteplugins_dask-2.0.0b28.dist-info}/WHEEL +0 -0
- {flyteplugins_dask-2.0.0b25.dist-info → flyteplugins_dask-2.0.0b28.dist-info}/top_level.txt +0 -0
flyteplugins/dask/task.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import sys
|
|
1
3
|
from dataclasses import dataclass, field
|
|
2
4
|
from typing import Any, Dict, Optional
|
|
3
5
|
|
|
4
6
|
import flyte
|
|
5
|
-
from distributed import Client, WorkerPlugin
|
|
7
|
+
from distributed import Client, SchedulerPlugin, WorkerPlugin
|
|
6
8
|
from flyte import Resources
|
|
7
9
|
from flyte.extend import AsyncFunctionTaskTemplate, TaskPluginRegistry, download_code_bundle, get_proto_resources
|
|
8
10
|
from flyte.models import CodeBundle, SerializationContext
|
|
@@ -55,7 +57,20 @@ class Dask:
|
|
|
55
57
|
workers: WorkerGroup = field(default_factory=lambda: WorkerGroup())
|
|
56
58
|
|
|
57
59
|
|
|
58
|
-
class
|
|
60
|
+
class DownloadCodeBundleSchedulerPlugin(SchedulerPlugin):
|
|
61
|
+
"""
|
|
62
|
+
A Dask plugin to download and set up the code bundle on the scheduler.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
def __init__(self, code_bundle: CodeBundle):
|
|
66
|
+
self.code_bundle = code_bundle
|
|
67
|
+
|
|
68
|
+
async def start(self, scheduler):
|
|
69
|
+
sys.path.insert(0, ".")
|
|
70
|
+
await download_code_bundle(self.code_bundle)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class DownloadCodeBundleWorkerPlugin(WorkerPlugin):
|
|
59
74
|
"""
|
|
60
75
|
A Dask plugin to download and set up the code bundle on each worker.
|
|
61
76
|
"""
|
|
@@ -67,7 +82,8 @@ class DownloadCodeBundlePlugin(WorkerPlugin):
|
|
|
67
82
|
"""
|
|
68
83
|
Runs on each worker as it is initialized.
|
|
69
84
|
"""
|
|
70
|
-
|
|
85
|
+
sys.path.insert(0, ".")
|
|
86
|
+
asyncio.run(download_code_bundle(self.code_bundle))
|
|
71
87
|
|
|
72
88
|
|
|
73
89
|
@dataclass(kw_only=True)
|
|
@@ -85,7 +101,8 @@ class DaskTask(AsyncFunctionTaskTemplate):
|
|
|
85
101
|
code_bundle = ctx.code_bundle
|
|
86
102
|
if ctx.is_in_cluster() and code_bundle:
|
|
87
103
|
client = Client()
|
|
88
|
-
client.register_plugin(
|
|
104
|
+
client.register_plugin(DownloadCodeBundleWorkerPlugin(code_bundle))
|
|
105
|
+
client.register_plugin(DownloadCodeBundleSchedulerPlugin(code_bundle))
|
|
89
106
|
|
|
90
107
|
return {}
|
|
91
108
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
flyteplugins/dask/__init__.py,sha256=UwmJjPRVqDyCTobQlT5a2g2oZJvK0vlDiv6rwugNs-g,112
|
|
2
|
+
flyteplugins/dask/task.py,sha256=2jmKzyhmsTXv8Ap8xNse3YATtnvYVXATzEEq1WP5L_8,4210
|
|
3
|
+
flyteplugins_dask-2.0.0b28.dist-info/METADATA,sha256=HijZQu4OF3_hGZuHOaYQCTLIkfKYhFo-ePsAYT-71E4,948
|
|
4
|
+
flyteplugins_dask-2.0.0b28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
flyteplugins_dask-2.0.0b28.dist-info/top_level.txt,sha256=cgd779rPu9EsvdtuYgUxNHHgElaQvPn74KhB5XSeMBE,13
|
|
6
|
+
flyteplugins_dask-2.0.0b28.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
flyteplugins/dask/__init__.py,sha256=UwmJjPRVqDyCTobQlT5a2g2oZJvK0vlDiv6rwugNs-g,112
|
|
2
|
-
flyteplugins/dask/task.py,sha256=8E8AhPYccIKrq1vADkLmvrufDmiGvFDRG3T96zsqOG0,3663
|
|
3
|
-
flyteplugins_dask-2.0.0b25.dist-info/METADATA,sha256=5OidCmNiIFitaDLrf4eayrp5hIda_Ng8IqIlMdGDYN4,948
|
|
4
|
-
flyteplugins_dask-2.0.0b25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
flyteplugins_dask-2.0.0b25.dist-info/top_level.txt,sha256=cgd779rPu9EsvdtuYgUxNHHgElaQvPn74KhB5XSeMBE,13
|
|
6
|
-
flyteplugins_dask-2.0.0b25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|