dq-export-connector 0.1.0.dev30__tar.gz → 0.1.0.dev32__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.
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/PKG-INFO +1 -1
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/errors.py +0 -18
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/runner.py +9 -10
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/pyproject.toml +1 -1
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_runner.py +21 -25
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/uv.lock +1 -1
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/.gitignore +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/.python-version +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/README.md +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/__init__.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/_models/__init__.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/_models/application_error.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/_models/application_warning.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/_models/export_connector_credentials.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/_models/export_receipt.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/_models/export_worker_config.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/bucket/__init__.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/bucket/datasets.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/bucket/export.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/bucket/paths.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/bucket/store.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/bucket/upload.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/bucket/validate.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/log.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/models/__init__.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/models/bucket.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/outcome.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/redact.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/scripts/codegen-models.sh +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_live_buckets.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_models_are_current.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_paths.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_redact.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_store.py +0 -0
- {dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_upload.py +0 -0
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/errors.py
RENAMED
|
@@ -5,7 +5,6 @@ kind's prefix, such as `BUCKET_`."""
|
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
-
import traceback
|
|
9
8
|
from enum import Enum
|
|
10
9
|
|
|
11
10
|
from decentriq_util.error import SafeError
|
|
@@ -80,20 +79,3 @@ class RedactedExportConnectorError(SafeError):
|
|
|
80
79
|
def application_error(self) -> ApplicationError:
|
|
81
80
|
details = None if self.provider_error is None else {"providerError": self.provider_error}
|
|
82
81
|
return ApplicationError(code=self.code.value, message=self.message, details=details)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def internal_error_message(error: BaseException, activity: str) -> str:
|
|
86
|
-
"""Names the error's type and where it was raised, but not its message,
|
|
87
|
-
which could hold dataset values."""
|
|
88
|
-
error_type = type(error)
|
|
89
|
-
module = error_type.__module__
|
|
90
|
-
qualified_type = error_type.__qualname__ if module in ("builtins", "__main__") else f"{module}.{error_type.__qualname__}"
|
|
91
|
-
frames = list(traceback.walk_tb(error.__traceback__))
|
|
92
|
-
location = ""
|
|
93
|
-
if frames:
|
|
94
|
-
frame, line = frames[-1]
|
|
95
|
-
location = f" at {frame.f_globals.get('__name__', frame.f_code.co_filename)}:{line}"
|
|
96
|
-
return (
|
|
97
|
-
f"An internal error stopped the {activity}: {qualified_type}{location}"
|
|
98
|
-
" (error message removed due to data privacy)"
|
|
99
|
-
)
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/runner.py
RENAMED
|
@@ -19,7 +19,6 @@ from dq_export_connector.errors import (
|
|
|
19
19
|
ErrorCode,
|
|
20
20
|
ExportConnectorError,
|
|
21
21
|
RedactedExportConnectorError,
|
|
22
|
-
internal_error_message,
|
|
23
22
|
)
|
|
24
23
|
from dq_export_connector.log import configure_logger, logger
|
|
25
24
|
from dq_export_connector.models import (
|
|
@@ -52,7 +51,7 @@ def main(
|
|
|
52
51
|
redactor = Redactor(secret_values(raw_credentials))
|
|
53
52
|
configure_logger(redactor)
|
|
54
53
|
try:
|
|
55
|
-
|
|
54
|
+
redacted_error = run(
|
|
56
55
|
ExportWorkerConfig.model_validate_json(config_path.read_text()),
|
|
57
56
|
ExportConnectorCredentials.model_validate(raw_credentials),
|
|
58
57
|
inputs_dir,
|
|
@@ -65,12 +64,12 @@ def main(
|
|
|
65
64
|
# A panic in obstore's Rust code is a `BaseException`. The container
|
|
66
65
|
# worker's `raw_errors` result doesn't pass the redaction, so the error that
|
|
67
66
|
# fails the task chains no other.
|
|
68
|
-
except BaseException
|
|
69
|
-
logger.exception("
|
|
70
|
-
internal = ExportConnectorError(ErrorCode.INTERNAL_ERROR,
|
|
67
|
+
except BaseException:
|
|
68
|
+
logger.exception("An internal error stopped the export worker")
|
|
69
|
+
internal = ExportConnectorError(ErrorCode.INTERNAL_ERROR, "An internal error stopped the export worker")
|
|
71
70
|
raise RedactedExportConnectorError(internal, redactor) from None
|
|
72
|
-
if
|
|
73
|
-
raise
|
|
71
|
+
if redacted_error is not None:
|
|
72
|
+
raise redacted_error
|
|
74
73
|
|
|
75
74
|
|
|
76
75
|
def run(
|
|
@@ -147,12 +146,12 @@ def _record_failure(outcome: RunOutcome, activity: str) -> Iterator[None]:
|
|
|
147
146
|
except (KeyboardInterrupt, SystemExit):
|
|
148
147
|
raise
|
|
149
148
|
except ExportConnectorError as error:
|
|
150
|
-
logger.error("The %s failed with %s: %s", activity, error.code.value, error.message)
|
|
149
|
+
logger.error("The %s failed with %s: %s", activity, error.code.value, error.message, exc_info=True)
|
|
151
150
|
outcome.fail(error)
|
|
152
151
|
# A panic in obstore's Rust code is a `BaseException`.
|
|
153
|
-
except BaseException
|
|
152
|
+
except BaseException:
|
|
154
153
|
logger.exception("An internal error stopped the %s", activity)
|
|
155
|
-
outcome.fail(ExportConnectorError(ErrorCode.INTERNAL_ERROR,
|
|
154
|
+
outcome.fail(ExportConnectorError(ErrorCode.INTERNAL_ERROR, f"An internal error stopped the {activity}"))
|
|
156
155
|
|
|
157
156
|
|
|
158
157
|
def _write(path: Path, content: str) -> None:
|
|
@@ -420,18 +420,13 @@ def test_an_internal_error_is_reported_without_its_message(tmp_path, monkeypatch
|
|
|
420
420
|
def broken(*_):
|
|
421
421
|
raise KeyError("a dataset value")
|
|
422
422
|
|
|
423
|
-
line = broken.__code__.co_firstlineno + 1
|
|
424
423
|
monkeypatch.setattr(export, "upload", broken)
|
|
425
424
|
config = _config(EXPORT, [("segA", "seg_a")])
|
|
426
425
|
failed = _run(tmp_path, config, {"segA": b"x"}, MemoryStore(), monkeypatch)
|
|
427
426
|
assert (failed, _outputs(tmp_path)) == (
|
|
428
427
|
True,
|
|
429
428
|
{
|
|
430
|
-
"application_error": {
|
|
431
|
-
"code": "INTERNAL_ERROR",
|
|
432
|
-
"message": f"An internal error stopped the export: KeyError at {__name__}:{line}"
|
|
433
|
-
" (error message removed due to data privacy)",
|
|
434
|
-
},
|
|
429
|
+
"application_error": {"code": "INTERNAL_ERROR", "message": "An internal error stopped the export"},
|
|
435
430
|
"report": _receipt([("segA", "seg_a", 0, 0)]),
|
|
436
431
|
},
|
|
437
432
|
)
|
|
@@ -451,6 +446,21 @@ def test_a_traceback_goes_to_the_log_pipe_only(tmp_path, monkeypatch, capsys):
|
|
|
451
446
|
) == (False, True, True)
|
|
452
447
|
|
|
453
448
|
|
|
449
|
+
def test_an_expected_errors_traceback_goes_to_the_log_pipe_only(tmp_path, monkeypatch, capsys):
|
|
450
|
+
def denied(*_):
|
|
451
|
+
raise StorageError(obstore.exceptions.PermissionDeniedError("Access Denied"))
|
|
452
|
+
|
|
453
|
+
monkeypatch.setattr(export, "upload", denied)
|
|
454
|
+
_run(tmp_path, _config(EXPORT, [("segA", "seg_a")]), {"segA": b"x"}, MemoryStore(), monkeypatch)
|
|
455
|
+
stdout, logs = capsys.readouterr().out, _logs(tmp_path)
|
|
456
|
+
assert (
|
|
457
|
+
"Traceback" in stdout,
|
|
458
|
+
"ERROR: The export failed with ACCESS_DENIED: " in stdout,
|
|
459
|
+
"dq_export_connector.bucket.store.StorageError: Access Denied" in logs,
|
|
460
|
+
"dq_export_connector.errors.ExportConnectorError: The credentials may not write" in logs,
|
|
461
|
+
) == (False, True, True, True)
|
|
462
|
+
|
|
463
|
+
|
|
454
464
|
def test_a_panic_is_reported_as_an_internal_error(tmp_path, monkeypatch):
|
|
455
465
|
class PanicException(BaseException):
|
|
456
466
|
pass
|
|
@@ -458,18 +468,12 @@ def test_a_panic_is_reported_as_an_internal_error(tmp_path, monkeypatch):
|
|
|
458
468
|
def panicking(*_):
|
|
459
469
|
raise PanicException("a dataset value")
|
|
460
470
|
|
|
461
|
-
line = panicking.__code__.co_firstlineno + 1
|
|
462
471
|
monkeypatch.setattr(export, "upload", panicking)
|
|
463
472
|
failed = _run(tmp_path, _config(EXPORT, [("segA", "seg_a")]), {"segA": b"x"}, MemoryStore(), monkeypatch)
|
|
464
473
|
assert (failed, _outputs(tmp_path)) == (
|
|
465
474
|
True,
|
|
466
475
|
{
|
|
467
|
-
"application_error": {
|
|
468
|
-
"code": "INTERNAL_ERROR",
|
|
469
|
-
"message": "An internal error stopped the export:"
|
|
470
|
-
f" {__name__}.test_a_panic_is_reported_as_an_internal_error.<locals>.PanicException at {__name__}:{line}"
|
|
471
|
-
" (error message removed due to data privacy)",
|
|
472
|
-
},
|
|
476
|
+
"application_error": {"code": "INTERNAL_ERROR", "message": "An internal error stopped the export"},
|
|
473
477
|
"report": _receipt([("segA", "seg_a", 0, 0)]),
|
|
474
478
|
},
|
|
475
479
|
)
|
|
@@ -509,11 +513,7 @@ def test_a_connection_test_that_couldnt_run_fails_without_the_credentials(tmp_pa
|
|
|
509
513
|
)
|
|
510
514
|
logs = pipe.read_text()
|
|
511
515
|
error = (tmp_path / "internal" / runner.APPLICATION_ERROR_FILE).read_text()
|
|
512
|
-
|
|
513
|
-
message = (
|
|
514
|
-
f"An internal error stopped the connection test: RuntimeError at {__name__}:{line}"
|
|
515
|
-
" (error message removed due to data privacy)"
|
|
516
|
-
)
|
|
516
|
+
message = "An internal error stopped the connection test"
|
|
517
517
|
assert (
|
|
518
518
|
SECRET_KEY in logs + error,
|
|
519
519
|
"X-Amz-Signature" in logs,
|
|
@@ -538,15 +538,11 @@ def test_a_failure_outside_the_action_fails_the_worker_without_its_message(tmp_p
|
|
|
538
538
|
with pytest.raises(RedactedExportConnectorError) as raised:
|
|
539
539
|
runner.main(tmp_path / "config.json", tmp_path / "credentials.json", tmp_path)
|
|
540
540
|
assert (
|
|
541
|
-
|
|
542
|
-
r"INTERNAL_ERROR: An internal error stopped the export worker: pydantic_core\._pydantic_core\.ValidationError"
|
|
543
|
-
r" at pydantic\.main:\d+ \(error message removed due to data privacy\)",
|
|
544
|
-
str(raised.value),
|
|
545
|
-
)
|
|
546
|
-
is not None,
|
|
541
|
+
str(raised.value),
|
|
547
542
|
raised.value.__cause__,
|
|
548
543
|
raised.value.__suppress_context__,
|
|
549
|
-
|
|
544
|
+
"pydantic_core._pydantic_core.ValidationError: 1 validation error for ExportWorkerConfig" in pipe.read_text(),
|
|
545
|
+
) == ("INTERNAL_ERROR: An internal error stopped the export worker", None, True, True)
|
|
550
546
|
|
|
551
547
|
|
|
552
548
|
@pytest.mark.parametrize("include_container_logs_on_error", [True, False])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/__init__.py
RENAMED
|
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
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/log.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/outcome.py
RENAMED
|
File without changes
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/dq_export_connector/redact.py
RENAMED
|
File without changes
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/scripts/codegen-models.sh
RENAMED
|
File without changes
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_live_buckets.py
RENAMED
|
File without changes
|
{dq_export_connector-0.1.0.dev30 → dq_export_connector-0.1.0.dev32}/tests/test_models_are_current.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|