flyteplugins-dask 2.0.0b24__py3-none-any.whl → 2.0.0b26__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 CHANGED
@@ -1,12 +1,14 @@
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
9
- from flyteidl.plugins.dask_pb2 import DaskJob, DaskScheduler, DaskWorkerGroup
11
+ from flyteidl2.plugins.dask_pb2 import DaskJob, DaskScheduler, DaskWorkerGroup
10
12
  from google.protobuf.json_format import MessageToDict
11
13
 
12
14
 
@@ -55,7 +57,20 @@ class Dask:
55
57
  workers: WorkerGroup = field(default_factory=lambda: WorkerGroup())
56
58
 
57
59
 
58
- class DownloadCodeBundlePlugin(WorkerPlugin):
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
- download_code_bundle(self.code_bundle)
85
+ sys.path.insert(0, ".")
86
+ asyncio.run(download_code_bundle(self.code_bundle))
71
87
 
72
88
 
73
89
  @dataclass(kw_only=True)
@@ -78,13 +94,15 @@ class DaskTask(AsyncFunctionTaskTemplate):
78
94
 
79
95
  plugin_config: Dask
80
96
  task_type: str = "dask"
97
+ debuggable: bool = True
81
98
 
82
99
  async def pre(self, *args, **kwargs) -> Dict[str, Any]:
83
100
  ctx = flyte.ctx()
84
101
  code_bundle = ctx.code_bundle
85
102
  if ctx.is_in_cluster() and code_bundle:
86
103
  client = Client()
87
- client.register_plugin(DownloadCodeBundlePlugin(code_bundle))
104
+ client.register_plugin(DownloadCodeBundleWorkerPlugin(code_bundle))
105
+ client.register_plugin(DownloadCodeBundleSchedulerPlugin(code_bundle))
88
106
 
89
107
  return {}
90
108
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyteplugins-dask
3
- Version: 2.0.0b24
3
+ Version: 2.0.0b26
4
4
  Summary: Dask plugin for flyte
5
5
  Author-email: Kevin Su <pingsutw@users.noreply.github.com>
6
6
  Requires-Python: >=3.10
@@ -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.0b26.dist-info/METADATA,sha256=1gRWI9D_6tklLf8wFBrcvhRtSnQv_9AW1qj54ufs9Kk,948
4
+ flyteplugins_dask-2.0.0b26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ flyteplugins_dask-2.0.0b26.dist-info/top_level.txt,sha256=cgd779rPu9EsvdtuYgUxNHHgElaQvPn74KhB5XSeMBE,13
6
+ flyteplugins_dask-2.0.0b26.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- flyteplugins/dask/__init__.py,sha256=UwmJjPRVqDyCTobQlT5a2g2oZJvK0vlDiv6rwugNs-g,112
2
- flyteplugins/dask/task.py,sha256=giAaSDZb0cIedzJ2ij8LRq7u8WvtB75l2lgLyeKwKQI,3634
3
- flyteplugins_dask-2.0.0b24.dist-info/METADATA,sha256=IDPjmHMoQ8iCirFQE3-eFb_n18ISB9J-J4ti7DYU8Cg,948
4
- flyteplugins_dask-2.0.0b24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- flyteplugins_dask-2.0.0b24.dist-info/top_level.txt,sha256=cgd779rPu9EsvdtuYgUxNHHgElaQvPn74KhB5XSeMBE,13
6
- flyteplugins_dask-2.0.0b24.dist-info/RECORD,,