QTZPOC-20: Refactor model import workflow, introduce atomic model ID generation, and clarify MinIO expiry. Fuses bundle download, decryption, MLflow experiment creation, and artifact upload into a single activity to prevent cross-worker issues. Implements an atomic counter for MongoDB model IDs, replacing the max(id) + 1 scan to avoid collisions during concurrent imports. Adds comprehensive documentation for MinIO object expiry mechanisms and refines lifecycle rule application. Improves error handling with clearer responsibility classification and centralizes MLflow repository injection.
20 lines
506 B
Python
20 lines
506 B
Python
from datetime import UTC, datetime
|
|
|
|
from laborious.utils.time import to_naive
|
|
|
|
|
|
def test_to_naive_returns_naive_input_unchanged() -> None:
|
|
moment = datetime(2024, 1, 1, 12, 30, 45)
|
|
|
|
assert to_naive(moment) == moment
|
|
assert to_naive(moment).tzinfo is None
|
|
|
|
|
|
def test_to_naive_strips_tzinfo_from_aware_input() -> None:
|
|
moment = datetime(2024, 1, 1, 12, 30, 45, tzinfo=UTC)
|
|
|
|
result = to_naive(moment)
|
|
|
|
assert result.tzinfo is None
|
|
assert result == datetime(2024, 1, 1, 12, 30, 45)
|