datashare-python 0.10.4__tar.gz → 0.10.6__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.10.4 → datashare_python-0.10.6}/PKG-INFO +1 -1
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/interceptors.py +28 -13
- datashare_python-0.10.6/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/pyproject.toml +1 -1
- datashare_python-0.10.4/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/.gitignore +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/README.md +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/.gitignore +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/__init__.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/__main__.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/cli/__init__.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/cli/project.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/cli/task.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/cli/utils.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/cli/worker.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/config.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/conftest.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/constants.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/dependencies.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/discovery.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/exceptions.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/logging_.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/mimetypes_.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/objects.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/task_client.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/template.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/types_.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/utils.py +0 -0
- {datashare_python-0.10.4 → datashare_python-0.10.6}/datashare_python/worker.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: datashare-python
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.6
|
|
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/
|
|
@@ -8,7 +8,7 @@ from contextlib import contextmanager
|
|
|
8
8
|
from contextvars import ContextVar
|
|
9
9
|
from copy import deepcopy
|
|
10
10
|
from functools import wraps
|
|
11
|
-
from inspect import signature
|
|
11
|
+
from inspect import iscoroutinefunction, signature
|
|
12
12
|
from types import UnionType
|
|
13
13
|
from typing import (
|
|
14
14
|
Annotated,
|
|
@@ -28,6 +28,7 @@ from temporalio.activity import _Definition
|
|
|
28
28
|
from temporalio.api.common.v1 import Payload
|
|
29
29
|
from temporalio.client import WorkflowHandle
|
|
30
30
|
from temporalio.converter import DataConverter
|
|
31
|
+
from temporalio.service import RPCError
|
|
31
32
|
from temporalio.worker import (
|
|
32
33
|
ActivityInboundInterceptor,
|
|
33
34
|
ActivityOutboundInterceptor,
|
|
@@ -332,7 +333,8 @@ def _get_progress_handler(
|
|
|
332
333
|
weight=weight,
|
|
333
334
|
min_progress_interval_s=min_progress_interval_s,
|
|
334
335
|
)
|
|
335
|
-
|
|
336
|
+
handler = _fail_safe(handler.progress, "emit progress", excs=(RPCError,))
|
|
337
|
+
return handler
|
|
336
338
|
|
|
337
339
|
|
|
338
340
|
def _is_progress(t: type) -> bool:
|
|
@@ -438,7 +440,7 @@ class _HeartbeatInboundInterceptor(ActivityInboundInterceptor):
|
|
|
438
440
|
period = heartbeat_timeout.total_seconds() / self._n_missed_before_timeout
|
|
439
441
|
# We don't want a failing hearbeat to fail the worker task so we just
|
|
440
442
|
# ignore any exception
|
|
441
|
-
heartbeat_fn = _fail_safe(self._outbound.heartbeat)
|
|
443
|
+
heartbeat_fn = _fail_safe(self._outbound.heartbeat, "heartbeat")
|
|
442
444
|
heartbeat_task = asyncio.create_task(_heartbeat_every(heartbeat_fn, period))
|
|
443
445
|
try:
|
|
444
446
|
activity.heartbeat()
|
|
@@ -449,19 +451,32 @@ class _HeartbeatInboundInterceptor(ActivityInboundInterceptor):
|
|
|
449
451
|
await asyncio.wait([heartbeat_task])
|
|
450
452
|
|
|
451
453
|
|
|
452
|
-
def _fail_safe(
|
|
453
|
-
fn: Callable[
|
|
454
|
-
|
|
454
|
+
def _fail_safe[**P, T](
|
|
455
|
+
fn: Callable[P, T],
|
|
456
|
+
action: str,
|
|
457
|
+
excs: tuple[type[Exception]] | None = None,
|
|
458
|
+
) -> Callable[P, T]:
|
|
455
459
|
if excs is None:
|
|
456
460
|
excs = (Exception,)
|
|
461
|
+
if iscoroutinefunction(fn):
|
|
457
462
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
@wraps(fn)
|
|
464
|
+
async def wrapper(*args: P.args, **kwargs: P.kwargs) -> None:
|
|
465
|
+
try:
|
|
466
|
+
return await fn(*args, **kwargs)
|
|
467
|
+
except excs as exc:
|
|
468
|
+
msg = f"failed to {action} due to {exc}"
|
|
469
|
+
logger.exception(msg)
|
|
470
|
+
|
|
471
|
+
else:
|
|
472
|
+
|
|
473
|
+
@wraps(fn)
|
|
474
|
+
def wrapper(*args: P.args, **kwargs: P.kwargs) -> None:
|
|
475
|
+
try:
|
|
476
|
+
return fn(*args, **kwargs)
|
|
477
|
+
except excs as exc:
|
|
478
|
+
msg = f"failed to {action} due to {exc}"
|
|
479
|
+
logger.exception(msg)
|
|
465
480
|
|
|
466
481
|
return wrapper
|
|
467
482
|
|
|
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
|
|
File without changes
|
|
File without changes
|