datashare-python 0.2.24__tar.gz → 0.2.26__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.2.24 → datashare_python-0.2.26}/PKG-INFO +1 -2
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/cli/worker.py +10 -4
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/discovery.py +17 -23
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/template.py +1 -0
- datashare_python-0.2.26/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/pyproject.toml +2 -2
- datashare_python-0.2.24/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/.gitignore +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/README.md +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/.gitignore +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/__init__.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/__main__.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/cli/__init__.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/cli/local.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/cli/project.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/cli/task.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/cli/utils.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/config.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/conftest.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/constants.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/dependencies.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/exceptions.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/local_client.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/objects.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/task_client.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/types_.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/utils.py +0 -0
- {datashare_python-0.2.24 → datashare_python-0.2.26}/datashare_python/worker.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datashare-python
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.26
|
|
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/
|
|
@@ -10,7 +10,6 @@ Author-email: Clément Doumouro <cdoumouro@icij.org>, Clément Doumouro <clement
|
|
|
10
10
|
Requires-Python: <4,>=3.11
|
|
11
11
|
Requires-Dist: aiohttp~=3.11.9
|
|
12
12
|
Requires-Dist: alive-progress~=3.2.0
|
|
13
|
-
Requires-Dist: datashare-worker-template[ml]~=0.1
|
|
14
13
|
Requires-Dist: hatchling~=1.27.0
|
|
15
14
|
Requires-Dist: icij-common[elasticsearch]~=0.8.2
|
|
16
15
|
Requires-Dist: nest-asyncio~=1.6.0
|
|
@@ -5,10 +5,9 @@ from typing import Annotated
|
|
|
5
5
|
|
|
6
6
|
import typer
|
|
7
7
|
import yaml
|
|
8
|
-
from config import TemporalClientConfig
|
|
9
8
|
from icij_common.pydantic_utils import safe_copy
|
|
10
9
|
|
|
11
|
-
from datashare_python.config import WorkerConfig
|
|
10
|
+
from datashare_python.config import TemporalClientConfig, WorkerConfig
|
|
12
11
|
from datashare_python.discovery import discover, discover_activities, discover_workflows
|
|
13
12
|
from datashare_python.worker import bootstrap_worker, create_worker_id
|
|
14
13
|
|
|
@@ -76,9 +75,13 @@ to the documentation to learn how to do so."""
|
|
|
76
75
|
|
|
77
76
|
@worker_app.async_command(help=_START_WORKER_HELP)
|
|
78
77
|
async def start(
|
|
79
|
-
workflows: Annotated[list[str], typer.Option(help=_START_WORKER_WORKFLOWS_HELP)],
|
|
80
|
-
activities: Annotated[list[str], typer.Option(help=_START_WORKER_ACTIVITIES_HELP)],
|
|
81
78
|
queue: Annotated[str, typer.Option("--queue", "-q", help=_WORKER_QUEUE_HELP)],
|
|
79
|
+
workflows: Annotated[
|
|
80
|
+
list[str] | None, typer.Option(help=_START_WORKER_WORKFLOWS_HELP)
|
|
81
|
+
] = None,
|
|
82
|
+
activities: Annotated[
|
|
83
|
+
list[str] | None, typer.Option(help=_START_WORKER_ACTIVITIES_HELP)
|
|
84
|
+
] = None,
|
|
82
85
|
dependencies: Annotated[
|
|
83
86
|
str | None, typer.Option(help=_START_WORKER_DEPS_HELP)
|
|
84
87
|
] = None,
|
|
@@ -106,6 +109,9 @@ async def start(
|
|
|
106
109
|
)
|
|
107
110
|
else:
|
|
108
111
|
bootstrap_config = WorkerConfig()
|
|
112
|
+
logger.info(
|
|
113
|
+
"starting worker with config: %s", bootstrap_config.model_dump_json(indent=2)
|
|
114
|
+
)
|
|
109
115
|
temporal_override = dict()
|
|
110
116
|
if temporal_address is not None:
|
|
111
117
|
temporal_override["host"] = temporal_address
|
|
@@ -54,8 +54,15 @@ def discover(
|
|
|
54
54
|
f" {', '.join(act_names)}"
|
|
55
55
|
)
|
|
56
56
|
if not acts and not wfs:
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
msg = "Couldn't find any registered activity nor workflow matching "
|
|
58
|
+
if wf_names:
|
|
59
|
+
msg += "workflow patterns " + ", ".join(wf_names) + " "
|
|
60
|
+
if act_names:
|
|
61
|
+
msg = "activity patterns " + ", ".join(act_names)
|
|
62
|
+
raise ValueError(msg)
|
|
63
|
+
deps = None
|
|
64
|
+
if deps_name is not None:
|
|
65
|
+
deps = discover_dependencies(deps_name)
|
|
59
66
|
if deps:
|
|
60
67
|
n_deps = len(deps)
|
|
61
68
|
discovered += "\n"
|
|
@@ -100,11 +107,9 @@ def discover_activities(names: list[str]) -> list[_RegisteredActivity]:
|
|
|
100
107
|
return registered
|
|
101
108
|
|
|
102
109
|
|
|
103
|
-
def discover_dependencies(name: str
|
|
110
|
+
def discover_dependencies(name: str) -> _Dependencies:
|
|
104
111
|
impls = entry_points(name=_DEPENDENCIES, group=_DEPENDENCIES_GROUPS)
|
|
105
112
|
if not impls:
|
|
106
|
-
if name is None:
|
|
107
|
-
return None
|
|
108
113
|
available_impls = entry_points(group=_DEPENDENCIES_GROUPS)
|
|
109
114
|
msg = (
|
|
110
115
|
f'failed to find dependency: "{name}", '
|
|
@@ -115,26 +120,15 @@ def discover_dependencies(name: str | None) -> _Dependencies | None:
|
|
|
115
120
|
msg = f'found multiple dependencies for name "{name}": {impls}'
|
|
116
121
|
raise ValueError(msg)
|
|
117
122
|
deps_registry = impls[_DEPENDENCIES].load()
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
available = list(deps_registry)
|
|
123
|
-
msg = (
|
|
124
|
-
f'failed to find dependency for name "{name}", available dependencies: '
|
|
125
|
-
f"{available}"
|
|
126
|
-
)
|
|
127
|
-
raise LookupError(msg) from e
|
|
128
|
-
if not deps_registry:
|
|
129
|
-
raise ValueError("empty dependency registry !")
|
|
130
|
-
if len(deps_registry) > 1:
|
|
131
|
-
available = ", ".join('"' + d + '"' for d in deps_registry)
|
|
123
|
+
try:
|
|
124
|
+
return deps_registry[name]
|
|
125
|
+
except KeyError as e:
|
|
126
|
+
available = list(deps_registry)
|
|
132
127
|
msg = (
|
|
133
|
-
f
|
|
134
|
-
f"
|
|
128
|
+
f'failed to find dependency for name "{name}", available dependencies: '
|
|
129
|
+
f"{available}"
|
|
135
130
|
)
|
|
136
|
-
raise
|
|
137
|
-
return next(iter(deps_registry.values()))
|
|
131
|
+
raise LookupError(msg) from e
|
|
138
132
|
|
|
139
133
|
|
|
140
134
|
def _parse_wf_name(wf_type: type) -> str:
|
|
@@ -61,6 +61,7 @@ def init_project(name: str, path: Path) -> None:
|
|
|
61
61
|
pyproject_toml = tomlkit.loads(pyproject_toml_path.read_text())
|
|
62
62
|
pyproject_toml = _update_pyproject_toml(pyproject_toml, package_name=package_name)
|
|
63
63
|
pyproject_toml_path.write_text(tomlkit.dumps(pyproject_toml))
|
|
64
|
+
raise NotImplementedError("implement entry point and dockerfile init")
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
_BASE_DEPS = {"datashare-python", "icij-common", "temporalio"}
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "datashare-python"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.26"
|
|
4
4
|
description = "Manage Pythoœn tasks and local resources in Datashare"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Clément Doumouro", email = "cdoumouro@icij.org" },
|
|
@@ -17,7 +17,6 @@ dependencies = [
|
|
|
17
17
|
"nest-asyncio~=1.6.0",
|
|
18
18
|
"temporalio~=1.23.0",
|
|
19
19
|
"typer~=0.15.4",
|
|
20
|
-
"datashare-worker-template[ml]~=0.1",
|
|
21
20
|
"tomlkit~=0.14.0",
|
|
22
21
|
"hatchling~=1.27.0",
|
|
23
22
|
"pyyaml~=6.0",
|
|
@@ -58,6 +57,7 @@ datashare-worker-template = { path = "../worker-template", editable = true }
|
|
|
58
57
|
|
|
59
58
|
[dependency-groups]
|
|
60
59
|
dev = [
|
|
60
|
+
"datashare-worker-template[ml]~=0.1.5",
|
|
61
61
|
"hatch-build~=0.5.0",
|
|
62
62
|
"nest-asyncio~=1.6.0",
|
|
63
63
|
"pre-commit~=4.5.1",
|
|
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
|