datashare-python 0.8.0__tar.gz → 0.8.3__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.8.0 → datashare_python-0.8.3}/PKG-INFO +1 -1
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/dependencies.py +1 -1
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/logging_.py +13 -6
- datashare_python-0.8.3/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/pyproject.toml +1 -1
- datashare_python-0.8.0/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/.gitignore +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/README.md +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/.gitignore +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/__init__.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/__main__.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/cli/__init__.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/cli/project.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/cli/task.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/cli/utils.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/cli/worker.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/config.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/conftest.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/constants.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/discovery.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/exceptions.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/interceptors.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/objects.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/task_client.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/template.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/types_.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/utils.py +0 -0
- {datashare_python-0.8.0 → datashare_python-0.8.3}/datashare_python/worker.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datashare-python
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.3
|
|
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/
|
|
@@ -40,7 +40,7 @@ def set_loggers(
|
|
|
40
40
|
worker_config: WorkerConfig, worker_id: str, loggers: dict[str, LogLevel]
|
|
41
41
|
) -> None:
|
|
42
42
|
setup_worker_loggers(
|
|
43
|
-
loggers=loggers, worker_id=worker_id,
|
|
43
|
+
loggers=loggers, worker_id=worker_id, log_format=worker_config.logging.format
|
|
44
44
|
)
|
|
45
45
|
logger.info("worker loggers ready to log 💬")
|
|
46
46
|
|
|
@@ -47,7 +47,7 @@ _STREAM_HANDLER_FMT_WITH_WORKER_ID = (
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def setup_worker_loggers(
|
|
50
|
-
loggers: dict[str, LogLevel], *, worker_id: str | None,
|
|
50
|
+
loggers: dict[str, LogLevel], *, worker_id: str | None, log_format: LogFormat
|
|
51
51
|
) -> None:
|
|
52
52
|
worker_filter = WorkerFilter(worker_id)
|
|
53
53
|
for logger_name, level_str in loggers.items():
|
|
@@ -55,7 +55,9 @@ def setup_worker_loggers(
|
|
|
55
55
|
logger = logging.getLogger(logger_name)
|
|
56
56
|
logger.setLevel(level)
|
|
57
57
|
logger.handlers = []
|
|
58
|
-
for handler in _get_worker_handlers(
|
|
58
|
+
for handler in _get_worker_handlers(
|
|
59
|
+
level, worker_filter, log_format=log_format
|
|
60
|
+
):
|
|
59
61
|
logger.addHandler(handler)
|
|
60
62
|
|
|
61
63
|
|
|
@@ -69,8 +71,13 @@ class WorkerFilter(logging.Filter):
|
|
|
69
71
|
record.worker_id = self.worker_id
|
|
70
72
|
if workflow.in_workflow():
|
|
71
73
|
wf_info = workflow.info()
|
|
74
|
+
wf_info = {
|
|
75
|
+
"workflow_run_id": wf_info.run_id,
|
|
76
|
+
"workflow_id": wf_info.workflow_id,
|
|
77
|
+
"workflow_type": wf_info.workflow_type,
|
|
78
|
+
}
|
|
72
79
|
for attr in _WF_LOGGED_ATTRS:
|
|
73
|
-
setattr(record, attr,
|
|
80
|
+
setattr(record, attr, wf_info[attr])
|
|
74
81
|
if activity.in_activity():
|
|
75
82
|
act_info = activity.info()
|
|
76
83
|
for attr in _ACT_LOGGER_ATTRS:
|
|
@@ -83,10 +90,10 @@ class WorkerFilter(logging.Filter):
|
|
|
83
90
|
|
|
84
91
|
|
|
85
92
|
def _get_worker_handlers(
|
|
86
|
-
level: int, worker_filter: WorkerFilter, *,
|
|
93
|
+
level: int, worker_filter: WorkerFilter, *, log_format: LogFormat
|
|
87
94
|
) -> list[logging.Handler]:
|
|
88
95
|
stream_handler = logging.StreamHandler(sys.stderr)
|
|
89
|
-
match
|
|
96
|
+
match log_format:
|
|
90
97
|
case LogFormat.JSON:
|
|
91
98
|
fmt = _json_formatter(datefmt=DATE_FMT)
|
|
92
99
|
case LogFormat.LOGFMT:
|
|
@@ -98,7 +105,7 @@ def _get_worker_handlers(
|
|
|
98
105
|
fmt = STREAM_HANDLER_FMT
|
|
99
106
|
fmt = logging.Formatter(fmt, DATE_FMT)
|
|
100
107
|
case _:
|
|
101
|
-
raise NotImplementedError(f"invalid log format: {
|
|
108
|
+
raise NotImplementedError(f"invalid log format: {log_format}")
|
|
102
109
|
stream_handler.setFormatter(fmt)
|
|
103
110
|
stream_handler.setLevel(level)
|
|
104
111
|
stream_handler.addFilter(worker_filter)
|
|
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
|