datashare-python 0.12.0__py3-none-any.whl → 0.12.2__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/config.py +16 -3
- datashare_python/mimetypes_.py +1 -0
- datashare_python/utils.py +6 -5
- datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.12.0.dist-info → datashare_python-0.12.2.dist-info}/METADATA +1 -1
- {datashare_python-0.12.0.dist-info → datashare_python-0.12.2.dist-info}/RECORD +8 -8
- {datashare_python-0.12.0.dist-info → datashare_python-0.12.2.dist-info}/WHEEL +0 -0
- {datashare_python-0.12.0.dist-info → datashare_python-0.12.2.dist-info}/entry_points.txt +0 -0
datashare_python/config.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
from datetime import timedelta
|
|
1
2
|
from enum import StrEnum
|
|
2
|
-
from typing import Literal
|
|
3
|
+
from typing import TYPE_CHECKING, Literal
|
|
3
4
|
|
|
4
5
|
from icij_common.es import ESClient
|
|
5
6
|
from icij_common.pydantic_utils import ICIJSettings
|
|
@@ -12,7 +13,9 @@ import datashare_python
|
|
|
12
13
|
from .objects import BaseModel, WorkerPaths
|
|
13
14
|
from .task_client import DatashareTaskClient
|
|
14
15
|
from .types_ import TemporalClient
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from .utils import SharedResources
|
|
16
19
|
|
|
17
20
|
_ALL_LOGGERS = [datashare_python.__name__]
|
|
18
21
|
|
|
@@ -63,6 +66,8 @@ class TemporalClientConfig(BaseModel):
|
|
|
63
66
|
_client: TemporalClient | None = PrivateAttr(default=None)
|
|
64
67
|
|
|
65
68
|
async def to_client(self) -> TemporalClient:
|
|
69
|
+
from .utils import PYDANTIC_DATA_CONVERTER # noqa: PLC0415
|
|
70
|
+
|
|
66
71
|
if self._client is None:
|
|
67
72
|
runtime = None
|
|
68
73
|
if self.prometheus_host is not None:
|
|
@@ -70,6 +75,7 @@ class TemporalClientConfig(BaseModel):
|
|
|
70
75
|
metrics=PrometheusConfig(bind_address="0.0.0.0:9000")
|
|
71
76
|
)
|
|
72
77
|
runtime = Runtime(telemetry=telemetry_config)
|
|
78
|
+
|
|
73
79
|
self._client = await TemporalClient.connect(
|
|
74
80
|
target_host=self.host,
|
|
75
81
|
namespace=self.namespace,
|
|
@@ -97,7 +103,9 @@ class ResourceCacheConfig(BaseModel):
|
|
|
97
103
|
size: int = 1
|
|
98
104
|
exit_context_managers: bool = True
|
|
99
105
|
|
|
100
|
-
def to_resource_cache(self) -> SharedResources:
|
|
106
|
+
def to_resource_cache(self) -> "SharedResources":
|
|
107
|
+
from .utils import SharedResources, close_cm_callback # noqa: PLC0415
|
|
108
|
+
|
|
101
109
|
eviction_callback = None
|
|
102
110
|
if self.exit_context_managers:
|
|
103
111
|
eviction_callback = close_cm_callback
|
|
@@ -134,3 +142,8 @@ class WorkerConfig(ICIJSettings, BaseModel):
|
|
|
134
142
|
|
|
135
143
|
async def to_temporal_client(self) -> TemporalClient:
|
|
136
144
|
return await self.temporal.to_client()
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class ActivityTimeouts(BaseModel):
|
|
148
|
+
start_to_close: timedelta | None = None
|
|
149
|
+
heartbeat: timedelta = timedelta(minutes=1)
|
datashare_python/mimetypes_.py
CHANGED
|
@@ -418,6 +418,7 @@ def types_map() -> dict[str, set[str]]:
|
|
|
418
418
|
".karbon": {"application/vnd.kde.karbon"},
|
|
419
419
|
".kfo": {"application/vnd.kde.kformula"},
|
|
420
420
|
".kia": {"application/vnd.kidspiration"},
|
|
421
|
+
".key": {"application/x-iwork-keynote-sffkey"},
|
|
421
422
|
".kml": {"application/vnd.google-earth.kml+xml"},
|
|
422
423
|
".kmz": {"application/vnd.google-earth.kmz"},
|
|
423
424
|
".kne": {"application/vnd.kinar"},
|
datashare_python/utils.py
CHANGED
|
@@ -21,7 +21,6 @@ from collections.abc import (
|
|
|
21
21
|
)
|
|
22
22
|
from copy import deepcopy
|
|
23
23
|
from dataclasses import dataclass
|
|
24
|
-
from datetime import timedelta
|
|
25
24
|
from functools import cache, wraps
|
|
26
25
|
from hashlib import sha256
|
|
27
26
|
from io import BytesIO
|
|
@@ -47,6 +46,7 @@ from temporalio.converter import (
|
|
|
47
46
|
)
|
|
48
47
|
from temporalio.exceptions import ApplicationError
|
|
49
48
|
|
|
49
|
+
from datashare_python.config import ActivityTimeouts
|
|
50
50
|
from datashare_python.types_ import (
|
|
51
51
|
AsyncProgressRateHandler,
|
|
52
52
|
RawSyncProgressHandler,
|
|
@@ -166,10 +166,11 @@ async def execute_activity(
|
|
|
166
166
|
arg: Any = temporalio.common._arg_unset,
|
|
167
167
|
*,
|
|
168
168
|
args: list | None = None,
|
|
169
|
-
|
|
170
|
-
heartbeat_timeout: timedelta = timedelta(minutes=1),
|
|
169
|
+
timeouts: ActivityTimeouts | None = None,
|
|
171
170
|
retry_policy: temporalio.common.RetryPolicy | None = None,
|
|
172
171
|
) -> Any:
|
|
172
|
+
if timeouts is None:
|
|
173
|
+
timeouts = ActivityTimeouts()
|
|
173
174
|
if args is None:
|
|
174
175
|
args = []
|
|
175
176
|
retry_policy = _retry_policy_with_default(retry_policy)
|
|
@@ -177,10 +178,10 @@ async def execute_activity(
|
|
|
177
178
|
activity,
|
|
178
179
|
arg=arg,
|
|
179
180
|
args=args,
|
|
180
|
-
start_to_close_timeout=start_to_close_timeout,
|
|
181
181
|
task_queue=task_queue,
|
|
182
182
|
retry_policy=retry_policy,
|
|
183
|
-
|
|
183
|
+
start_to_close_timeout=timeouts.start_to_close,
|
|
184
|
+
heartbeat_timeout=timeouts.heartbeat,
|
|
184
185
|
)
|
|
185
186
|
|
|
186
187
|
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: datashare-python
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.2
|
|
4
4
|
Summary: Manage Python 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/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
datashare_python/.gitignore,sha256=e-SRgnvGGdsjRrqgKsTzALz6Obx8IYiOjr0yaAxT6v8,22
|
|
2
2
|
datashare_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
datashare_python/__main__.py,sha256=g-fvS46zl9umKmGrSpl-OG-8PSuZgjqvTCqjpsZtSps,101
|
|
4
|
-
datashare_python/config.py,sha256=
|
|
4
|
+
datashare_python/config.py,sha256=ODJrwrOTZK9D90cUbNYqSUnu5vsyMWw_IVgXpSdDYJs,4464
|
|
5
5
|
datashare_python/conftest.py,sha256=hgBfg5Df9Kf0tMPvrqsrgjR6LZx1jG8WsZiVLQLHhuI,13824
|
|
6
6
|
datashare_python/constants.py,sha256=-Irwd2bbnFGIkLVJi_SiQ7PM2eNW3Ia_co4SE6z4j-A,352
|
|
7
7
|
datashare_python/dependencies.py,sha256=Q-BIhCwWu-GGp9omYNhENZ88cF0QJ8spfaMZX40mmNU,4386
|
|
@@ -9,20 +9,20 @@ datashare_python/discovery.py,sha256=3mUck2GUSKu2DSP9-MM1OdVM4FqFKqfBeSQDQZxgh2g
|
|
|
9
9
|
datashare_python/exceptions.py,sha256=bVHEAXxDPKfxeeMC0hJXEsrJkgsKO2ESAhxWU96GA4M,496
|
|
10
10
|
datashare_python/interceptors.py,sha256=-XC-y_MvGyHlZQ6jItfMRPAmKwQkQzzncpAGxceKlwM,16485
|
|
11
11
|
datashare_python/logging_.py,sha256=96KNXhP-JR5ybu9dld4VLtF7v7PfiphOCR1Nio-mmUs,4483
|
|
12
|
-
datashare_python/mimetypes_.py,sha256=
|
|
12
|
+
datashare_python/mimetypes_.py,sha256=omd2g8JyN-tfZL-lmxbWsjgc987iUe5w87ZpEtbyUK0,49930
|
|
13
13
|
datashare_python/objects.py,sha256=Fy9LVFMTSWsgjJBhZyJrwnWFP0PKcsw3arJ8JwpumGc,26878
|
|
14
14
|
datashare_python/task_client.py,sha256=oTmP8bvZW0UyhLNMi1AV3XIAx7hrdbxNRss2Mw2azEc,8435
|
|
15
15
|
datashare_python/template.py,sha256=N1uM8TRXh5tQPV7BC1oJj-Pdm2Gs_SkjaXv50RnNYso,4682
|
|
16
16
|
datashare_python/types_.py,sha256=cPcCkIk6ecILrKetPnAsrb0njHYuWJU3eZicUXy2lF8,1278
|
|
17
|
-
datashare_python/utils.py,sha256=
|
|
18
|
-
datashare_python/worker-template.tar.gz,sha256=
|
|
17
|
+
datashare_python/utils.py,sha256=Y0rNipGGW4yhOK6GrhXP9cdmHWMis2oFUxRsNK9eBMU,33254
|
|
18
|
+
datashare_python/worker-template.tar.gz,sha256=_bJXK_gbawy0VCpTcFrV0wKp2x0qqoMc0YgFkRuOXpo,281051
|
|
19
19
|
datashare_python/worker.py,sha256=ad36_yJOgwtj8KBheWndGkqaP_2aXTPSrYaHrbCXTvg,8389
|
|
20
20
|
datashare_python/cli/__init__.py,sha256=9BPWtssDgsVfWMsZ1TtZCla0EC_kai4RHttr8oNLYOE,1401
|
|
21
21
|
datashare_python/cli/project.py,sha256=w32Gy9AOL5B00uDT4in7YUCt2g68FnNbvwg2M3a8G6o,946
|
|
22
22
|
datashare_python/cli/task.py,sha256=GsyR5o0fN4Pd8tJKAUgivAvCBKT3L4Ay5j_BCW1XBHk,5828
|
|
23
23
|
datashare_python/cli/utils.py,sha256=p69CQb0zfixuyBkiZprhdMCc_NuYwXyAn6vC9H1UzAw,911
|
|
24
24
|
datashare_python/cli/worker.py,sha256=x0p3a1_NsZPbmV7-WSVMRyW3_iadYcgyZKbDvWgymQc,5790
|
|
25
|
-
datashare_python-0.12.
|
|
26
|
-
datashare_python-0.12.
|
|
27
|
-
datashare_python-0.12.
|
|
28
|
-
datashare_python-0.12.
|
|
25
|
+
datashare_python-0.12.2.dist-info/METADATA,sha256=EXfeGH0IZ915StdeUAYdd8b5D8E8J7xlR8iRHINN5g4,1012
|
|
26
|
+
datashare_python-0.12.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
27
|
+
datashare_python-0.12.2.dist-info/entry_points.txt,sha256=ILE7auxabHWiu3GC-AunWnzjhOI_SbZp7D4GqZHlLw4,68
|
|
28
|
+
datashare_python-0.12.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|