datashare-python 0.2.25__py3-none-any.whl → 0.2.27__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.
- datashare_python/cli/worker.py +13 -3
- datashare_python/discovery.py +17 -23
- datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.2.25.dist-info → datashare_python-0.2.27.dist-info}/METADATA +1 -2
- {datashare_python-0.2.25.dist-info → datashare_python-0.2.27.dist-info}/RECORD +7 -7
- {datashare_python-0.2.25.dist-info → datashare_python-0.2.27.dist-info}/WHEEL +0 -0
- {datashare_python-0.2.25.dist-info → datashare_python-0.2.27.dist-info}/entry_points.txt +0 -0
datashare_python/cli/worker.py
CHANGED
|
@@ -75,9 +75,13 @@ to the documentation to learn how to do so."""
|
|
|
75
75
|
|
|
76
76
|
@worker_app.async_command(help=_START_WORKER_HELP)
|
|
77
77
|
async def start(
|
|
78
|
-
workflows: Annotated[list[str], typer.Option(help=_START_WORKER_WORKFLOWS_HELP)],
|
|
79
|
-
activities: Annotated[list[str], typer.Option(help=_START_WORKER_ACTIVITIES_HELP)],
|
|
80
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,
|
|
81
85
|
dependencies: Annotated[
|
|
82
86
|
str | None, typer.Option(help=_START_WORKER_DEPS_HELP)
|
|
83
87
|
] = None,
|
|
@@ -105,6 +109,13 @@ async def start(
|
|
|
105
109
|
)
|
|
106
110
|
else:
|
|
107
111
|
bootstrap_config = WorkerConfig()
|
|
112
|
+
worker_id = create_worker_id(worker_id_prefix or "worker")
|
|
113
|
+
logger.info(
|
|
114
|
+
"starting worker %s on queue %s, with config: %s",
|
|
115
|
+
worker_id,
|
|
116
|
+
queue,
|
|
117
|
+
bootstrap_config.model_dump_json(indent=2),
|
|
118
|
+
)
|
|
108
119
|
temporal_override = dict()
|
|
109
120
|
if temporal_address is not None:
|
|
110
121
|
temporal_override["host"] = temporal_address
|
|
@@ -117,7 +128,6 @@ async def start(
|
|
|
117
128
|
registered_wfs, registered_acts, registered_deps = discover(
|
|
118
129
|
workflows, act_names=activities, deps_name=dependencies
|
|
119
130
|
)
|
|
120
|
-
worker_id = create_worker_id(worker_id_prefix or "worker")
|
|
121
131
|
client = await bootstrap_config.to_temporal_client()
|
|
122
132
|
event_loop = asyncio.get_event_loop()
|
|
123
133
|
async with bootstrap_worker(
|
datashare_python/discovery.py
CHANGED
|
@@ -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:
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datashare-python
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
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,7 +5,7 @@ datashare_python/config.py,sha256=u6iyOeSXzIO30Yja8Vj9LjM-cq8ESRBy3Kse6UadAMg,37
|
|
|
5
5
|
datashare_python/conftest.py,sha256=BdRLjy9eJtxAKLDCcon1Nyhzn54CIw2z4s3ZOupNYGo,8256
|
|
6
6
|
datashare_python/constants.py,sha256=e6Px11OUee9GSHwTgsgFMszGCMwpW-OznHSMgINvepc,338
|
|
7
7
|
datashare_python/dependencies.py,sha256=Diu7alKGaFWyC_ajp0fKU-xp8u5f_8x1axAHVBlppD0,3707
|
|
8
|
-
datashare_python/discovery.py,sha256=
|
|
8
|
+
datashare_python/discovery.py,sha256=khWTm11NlMVkRyxPV1lJimcTTicuVdxWHOC4H6PfFwE,6128
|
|
9
9
|
datashare_python/exceptions.py,sha256=bVHEAXxDPKfxeeMC0hJXEsrJkgsKO2ESAhxWU96GA4M,496
|
|
10
10
|
datashare_python/local_client.py,sha256=GP9MTcHVQ1mcb2eO6TiQ7mzQdx199lZRhK8DRuJqJVQ,2359
|
|
11
11
|
datashare_python/objects.py,sha256=GMi2hlKuWFbWWoC2r8ITQGQcMsobHHChGvm4ZfIjMl0,4537
|
|
@@ -13,15 +13,15 @@ datashare_python/task_client.py,sha256=oTmP8bvZW0UyhLNMi1AV3XIAx7hrdbxNRss2Mw2az
|
|
|
13
13
|
datashare_python/template.py,sha256=RxKTYLXoS_EQ8Jc41JkBXppPdbCFqDWfP3BmC0gvB5o,4024
|
|
14
14
|
datashare_python/types_.py,sha256=9Hk1XqpdXbM1TnEzwvJ5G9ABbaCZW9KgBTtiPBVn_7k,649
|
|
15
15
|
datashare_python/utils.py,sha256=DQt-rBwC3Ok72u8VyerG3rqwUTx3ftLfPdMQ5cnRrgs,16801
|
|
16
|
-
datashare_python/worker-template.tar.gz,sha256=
|
|
16
|
+
datashare_python/worker-template.tar.gz,sha256=JtdB_KpP_MB5eQpABnXydbgrtcofXISWkeHwiDLHgA0,142385
|
|
17
17
|
datashare_python/worker.py,sha256=A4SnmDB4y0ck6Wp_UZWdsSOyTvW54Z2Bq76gxtp-_PE,6070
|
|
18
18
|
datashare_python/cli/__init__.py,sha256=5MGSE_0SwlOiwbyPwsP8RIXlTBB2_GGP0zDg4l6UAIY,1479
|
|
19
19
|
datashare_python/cli/local.py,sha256=S-7qMpSqzi0oMvu01TCFEb8tayEvpw4pXMdCszKEYtU,986
|
|
20
20
|
datashare_python/cli/project.py,sha256=w32Gy9AOL5B00uDT4in7YUCt2g68FnNbvwg2M3a8G6o,946
|
|
21
21
|
datashare_python/cli/task.py,sha256=9If5OC7loG4C4gWWl4iOeqPJ4GOLlCWXQfuNLUHORrQ,5860
|
|
22
22
|
datashare_python/cli/utils.py,sha256=p69CQb0zfixuyBkiZprhdMCc_NuYwXyAn6vC9H1UzAw,911
|
|
23
|
-
datashare_python/cli/worker.py,sha256=
|
|
24
|
-
datashare_python-0.2.
|
|
25
|
-
datashare_python-0.2.
|
|
26
|
-
datashare_python-0.2.
|
|
27
|
-
datashare_python-0.2.
|
|
23
|
+
datashare_python/cli/worker.py,sha256=_LZFtv6O57Ez7XdRKmmwQ0b_5_8uFajPySv_jbzXbjI,5384
|
|
24
|
+
datashare_python-0.2.27.dist-info/METADATA,sha256=yhzBQbwmSDmgutMuHiypZRAO8btctOO9LtzayCEs594,908
|
|
25
|
+
datashare_python-0.2.27.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
26
|
+
datashare_python-0.2.27.dist-info/entry_points.txt,sha256=ILE7auxabHWiu3GC-AunWnzjhOI_SbZp7D4GqZHlLw4,68
|
|
27
|
+
datashare_python-0.2.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|