datashare-python 0.4.0__tar.gz → 0.5.0__tar.gz
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.
- {datashare_python-0.4.0 → datashare_python-0.5.0}/PKG-INFO +1 -1
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/worker.py +1 -8
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/discovery.py +11 -31
- datashare_python-0.5.0/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/pyproject.toml +1 -1
- datashare_python-0.4.0/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/.gitignore +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/README.md +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/.gitignore +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/__init__.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/__main__.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/__init__.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/local.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/project.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/task.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/cli/utils.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/config.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/conftest.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/constants.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/dependencies.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/exceptions.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/local_client.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/objects.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/task_client.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/template.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/types_.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/utils.py +0 -0
- {datashare_python-0.4.0 → datashare_python-0.5.0}/datashare_python/worker.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datashare-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Manage Pythoœn tasks and local resources in Datashare
|
|
5
5
|
Project-URL: Homepage, https://icij.github.io/datashare-python/
|
|
6
6
|
Project-URL: Documentation, https://icij.github.io/datashare-python/
|
|
@@ -24,7 +24,6 @@ _LIST_ACTIVITY_NAMES_HELP = "activity names filters (supports regexes)"
|
|
|
24
24
|
_START_WORKER_WORKFLOWS_HELP = "workflow names run by the worker (supports regexes)"
|
|
25
25
|
_START_WORKER_ACTIVITIES_HELP = "activity names run by the worker (supports regexes)"
|
|
26
26
|
_START_WORKER_DEPS_HELP = "worker lifetime dependencies name in the registry"
|
|
27
|
-
_START_WORKER_CONFIG_HELP = "worker config class key the worker configs registry"
|
|
28
27
|
_START_WORKER_WORKER_ID_PREFIX_HELP = "worker ID prefix"
|
|
29
28
|
_START_WORKER_CONFIG_PATH_HELP = (
|
|
30
29
|
"path to a worker config YAML file,"
|
|
@@ -86,9 +85,6 @@ async def start(
|
|
|
86
85
|
dependencies: Annotated[
|
|
87
86
|
str | None, typer.Option(help=_START_WORKER_DEPS_HELP)
|
|
88
87
|
] = None,
|
|
89
|
-
worker_config_name: Annotated[
|
|
90
|
-
str | None, typer.Option(help=_START_WORKER_CONFIG_HELP)
|
|
91
|
-
] = None,
|
|
92
88
|
config_path: Annotated[
|
|
93
89
|
Path | None,
|
|
94
90
|
typer.Option(
|
|
@@ -107,10 +103,7 @@ async def start(
|
|
|
107
103
|
] = None,
|
|
108
104
|
) -> None:
|
|
109
105
|
registered_wfs, registered_acts, registered_deps, worker_config_cls = discover(
|
|
110
|
-
workflows,
|
|
111
|
-
act_names=activities,
|
|
112
|
-
deps_name=dependencies,
|
|
113
|
-
worker_config_name=worker_config_name,
|
|
106
|
+
workflows, act_names=activities, deps_name=dependencies
|
|
114
107
|
)
|
|
115
108
|
if config_path is not None:
|
|
116
109
|
with config_path.open() as f:
|
|
@@ -13,11 +13,11 @@ logger = logging.getLogger(__name__)
|
|
|
13
13
|
Activity = ActivityWithProgress | Callable | type
|
|
14
14
|
|
|
15
15
|
_DEPENDENCIES = "dependencies"
|
|
16
|
-
|
|
16
|
+
_WORKER_CONFIG_CLS = "worker_config_cls"
|
|
17
17
|
_WORKFLOW_GROUP = "datashare.workflows"
|
|
18
18
|
_ACTIVITIES_GROUP = "datashare.activities"
|
|
19
19
|
_DEPENDENCIES_GROUP = "datashare.dependencies"
|
|
20
|
-
|
|
20
|
+
_WORKER_CONFIG_CLS_GROUP = "datashare.worker_config_cls"
|
|
21
21
|
|
|
22
22
|
_RegisteredWorkflow = tuple[str, type]
|
|
23
23
|
_RegisteredActivity = tuple[str, Activity]
|
|
@@ -31,11 +31,7 @@ _Discovery = tuple[
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
def discover(
|
|
34
|
-
wf_names: list[str] | None,
|
|
35
|
-
*,
|
|
36
|
-
act_names: list[str] | None,
|
|
37
|
-
deps_name: str | None,
|
|
38
|
-
worker_config_name: str | None,
|
|
34
|
+
wf_names: list[str] | None, *, act_names: list[str] | None, deps_name: str | None
|
|
39
35
|
) -> _Discovery:
|
|
40
36
|
discovered = ""
|
|
41
37
|
wfs = None
|
|
@@ -82,11 +78,8 @@ def discover(
|
|
|
82
78
|
f"- {n_deps} dependenc{'ies' if n_deps > 1 else 'y'}:"
|
|
83
79
|
f" {', '.join(deps_names)}"
|
|
84
80
|
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
discovered += f"- worker config class: {worker_config_cls}"
|
|
88
|
-
else:
|
|
89
|
-
worker_config_cls = WorkerConfig
|
|
81
|
+
worker_config_cls = discover_worker_config_cls()
|
|
82
|
+
discovered += f"- worker config class: {worker_config_cls}"
|
|
90
83
|
logger.info("discovered:\n%s", discovered)
|
|
91
84
|
return wfs, acts, deps, worker_config_cls
|
|
92
85
|
|
|
@@ -147,28 +140,15 @@ def discover_dependencies(name: str) -> _Dependencies:
|
|
|
147
140
|
raise LookupError(msg) from e
|
|
148
141
|
|
|
149
142
|
|
|
150
|
-
def
|
|
151
|
-
impls = entry_points(name=
|
|
143
|
+
def discover_worker_config_cls() -> type[WorkerConfig]:
|
|
144
|
+
impls = entry_points(name=_WORKER_CONFIG_CLS, group=_WORKER_CONFIG_CLS_GROUP)
|
|
152
145
|
if not impls:
|
|
153
|
-
|
|
154
|
-
msg = (
|
|
155
|
-
f'failed to find worker config: "{name}", '
|
|
156
|
-
f"available dependencies: {available_impls}"
|
|
157
|
-
)
|
|
158
|
-
raise LookupError(msg)
|
|
146
|
+
return WorkerConfig
|
|
159
147
|
if len(impls) > 1:
|
|
160
|
-
msg = f'found multiple worker configs
|
|
148
|
+
msg = f'found multiple registered worker configs classes": {impls}'
|
|
161
149
|
raise ValueError(msg)
|
|
162
|
-
deps_registry = impls[
|
|
163
|
-
|
|
164
|
-
return deps_registry[name]
|
|
165
|
-
except KeyError as e:
|
|
166
|
-
available = list(deps_registry)
|
|
167
|
-
msg = (
|
|
168
|
-
f'failed to find worker config for name "{name}", available worker '
|
|
169
|
-
f"configs: {available}"
|
|
170
|
-
)
|
|
171
|
-
raise LookupError(msg) from e
|
|
150
|
+
deps_registry = impls[_WORKER_CONFIG_CLS].load()
|
|
151
|
+
return deps_registry
|
|
172
152
|
|
|
173
153
|
|
|
174
154
|
def _parse_wf_name(wf_type: type) -> str:
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|