Data Structures | |
| class | StorageError |
| User-facing storage workflow failure. More... | |
Functions | |
| str | _utc_now () |
| Return a stable UTC timestamp for storage metadata. | |
| str | _human_bytes (int value) |
| Format a byte count for concise command output. | |
| str | _sha256_file (str path) |
| Calculate SHA-256 without loading a potentially large file into memory. | |
| None | _atomic_write_json (str path, dict payload) |
| Atomically replace a JSON state or manifest file. | |
| _read_json (str path) | |
| Read a JSON mapping when present, otherwise return None. | |
| read_artifact_manifest (str root_path) | |
| Read a local artifact's own identity manifest, run or study. | |
| dict | read_artifact_identity (str root_path) |
| Resolve what a local artifact directory is, and what it calls itself. | |
| _find_upwards (str start, str filename) | |
| Find the nearest named file at or above a filesystem anchor. | |
| str | storage_workspace_root (str start=None) |
| Locate the initialized workspace a storage command is standing in. | |
| str | storage_config_origin (str config_path, str workspace_root=None) |
| Classify where an active storage configuration came from. | |
| str | resolve_storage_config_path (str explicit_path=None, bool require=True) |
| Resolve an explicit or nearest workspace storage configuration. | |
| dict | load_storage_profile (str profile_name=None, str config_path=None) |
| Load and validate one non-secret rclone storage profile. | |
| str | _state_path (str root_path) |
| Return the local storage state marker path for an artifact root. | |
| read_storage_state (str root_path) | |
| Read the nearest applicable storage marker for a run, study, or study member. | |
| bool | is_artifact_cold (str root_path) |
| Return whether a local artifact marker says payload data was pruned. | |
| dict | storage_state_summary (str root_path) |
| Return a compact storage status for summarize and status commands. | |
| dict | _parse_tags (raw_tags) |
| Parse repeatable KEY=VALUE tags into deterministic metadata. | |
Variables | |
| str | STORAGE_CONFIG_FILENAME = ".picurv-storage.yml" |
| str | STORAGE_STATE_FILENAME = ".picurv-storage.json" |
| str | STORAGE_LOCK_FILENAME = ".picurv-storage.lock.json" |
| int | STORAGE_SCHEMA_VERSION = 2 |
| str | REMOTE_OBJECTS_DIRECTORY = "objects" |
| str | REMOTE_BLOBS_DIRECTORY = "blobs" |
| str | REMOTE_MANIFEST_FILENAME = "manifest.json" |
| tuple | STORAGE_ARTIFACT_TYPES = ("run", "study", "study-case") |
| str | RUN_MANIFEST_FILENAME = "manifest.json" |
| str | STUDY_MANIFEST_FILENAME = "study_manifest.json" |
| str | REMOTE_COMPLETE_FILENAME = "COMPLETE" |
| str | DEFAULT_PROFILE_NAME = "archive" |
| float | DEFAULT_CHUNK_SIZE_GIB = 8.0 |
| DEFAULT_STORAGE_WORKERS = max(1, min(8, os.cpu_count() or 1)) | |
| int | AUTO_NO_COMPRESSION_BYTES = 256 * 1024 * 1024 |
| int | AUTO_MAXIMUM_COMPRESSION_BYTES = 20 * 1024 * 1024 * 1024 |
| CHECKPOINT_DIRECTORY_PATTERN = re.compile(r"^step_(\d{12})$") | |
| INCOMPLETE_CHECKPOINT_PATTERN = re.compile(r"^\.step_\d{12}\.incomplete\.") | |
| ARCHIVE_ID_PATTERN = re.compile(r"^[0-9a-f]{32}$") | |
| int | KNOWN_CHECKPOINT_VERSION = 1 |
| str | UNCLASSIFIED_COMPONENT = "unclassified" |
| str | WORKSPACE_CONFIG_FILENAME = ".picurv-workspace.yml" |
| tuple | WORKSPACE_EXCLUDED_ROOTS = ("runs", "studies") |
| ALWAYS_RETAINED_COMPONENTS | |
| tuple | STORAGE_RESTORE_COMPONENTS |
| ALWAYS_RESTORED_COMPONENTS = frozenset({"metadata", "workspace-config"}) | |
| dict | _PARALLEL_GZIP_VALUES = {"fast", "balanced"} |
| tuple | CLI_OUTPUT_FORMATS = ("text", "json") |
| tuple | STORAGE_COMPRESSION_POLICIES = ("auto", "none", "fast", "balanced", "maximum") |
| tuple | STORAGE_OFFLOAD_POLICIES = ("metadata-only", "restart-ready", "analysis-ready") |
| tuple | STORAGE_RETENTION_COMPONENTS |
| dict | STORAGE_COMPRESSION_EXTENSIONS |
|
protected |
Return a stable UTC timestamp for storage metadata.
Definition at line 143 of file models.py.
|
protected |
Format a byte count for concise command output.
| [in] | value | Value supplied through the value argument. |
Definition at line 151 of file models.py.
|
protected |
Calculate SHA-256 without loading a potentially large file into memory.
| [in] | path | Value supplied through the path argument. |
Definition at line 165 of file models.py.
|
protected |
Atomically replace a JSON state or manifest file.
| [in] | path | Value supplied through the path argument. |
| [in] | payload | Value supplied through the payload argument. |
Definition at line 181 of file models.py.
|
protected |
Read a JSON mapping when present, otherwise return None.
| [in] | path | Value supplied through the path argument. |
Definition at line 198 of file models.py.
| picurv_cli.storage.models.read_artifact_manifest | ( | str | root_path | ) |
Read a local artifact's own identity manifest, run or study.
| [in] | root_path | Run, study, or study-member directory. |
Definition at line 212 of file models.py.
| dict picurv_cli.storage.models.read_artifact_identity | ( | str | root_path | ) |
Resolve what a local artifact directory is, and what it calls itself.
The manifest is authoritative. The directory basename is a last resort, reported as such through identity_source, so a caller can tell a real identity from a guess instead of both looking the same.
| [in] | root_path | Run, study, or study-member directory. |
artifact_type, run_id, study_id, case_id, and identity_source ("manifest" or "directory-name"). Definition at line 226 of file models.py.
|
protected |
Find the nearest named file at or above a filesystem anchor.
| [in] | start | Value supplied through the start argument. |
| [in] | filename | Value supplied through the filename argument. |
Definition at line 261 of file models.py.
| str picurv_cli.storage.models.storage_workspace_root | ( | str | start = None | ) |
Locate the initialized workspace a storage command is standing in.
| [in] | start | Directory to search from; defaults to the current directory. |
Definition at line 281 of file models.py.
| str picurv_cli.storage.models.storage_config_origin | ( | str | config_path, |
| str | workspace_root = None |
||
| ) |
Classify where an active storage configuration came from.
Discovery walks upward without stopping at the workspace boundary, which is deliberate: one configuration is meant to be shareable across a directory of campaigns. What makes that dangerous is silence, not sharing. An offload uploads to the remote this file names and then prunes local payload, so which file answered has to be visible at the point of use.
| [in] | config_path | Resolved storage configuration path. |
| [in] | workspace_root | Owning workspace, or None to discover it from the cwd. |
Definition at line 291 of file models.py.
| str picurv_cli.storage.models.resolve_storage_config_path | ( | str | explicit_path = None, |
| bool | require = True |
||
| ) |
Resolve an explicit or nearest workspace storage configuration.
| [in] | explicit_path | Optional user-selected YAML path. |
| [in] | require | Whether a missing configuration is an error. |
Definition at line 315 of file models.py.
| dict picurv_cli.storage.models.load_storage_profile | ( | str | profile_name = None, |
| str | config_path = None |
||
| ) |
Load and validate one non-secret rclone storage profile.
| [in] | profile_name | Value supplied through the profile_name argument. |
| [in] | config_path | Value supplied through the config_path argument. |
Definition at line 336 of file models.py.
|
protected |
Return the local storage state marker path for an artifact root.
| [in] | root_path | Value supplied through the root_path argument. |
Definition at line 385 of file models.py.
| picurv_cli.storage.models.read_storage_state | ( | str | root_path | ) |
Read the nearest applicable storage marker for a run, study, or study member.
| [in] | root_path | Value supplied through the root_path argument. |
Definition at line 394 of file models.py.
| bool picurv_cli.storage.models.is_artifact_cold | ( | str | root_path | ) |
Return whether a local artifact marker says payload data was pruned.
| [in] | root_path | Value supplied through the root_path argument. |
Definition at line 412 of file models.py.
| dict picurv_cli.storage.models.storage_state_summary | ( | str | root_path | ) |
Return a compact storage status for summarize and status commands.
| [in] | root_path | Value supplied through the root_path argument. |
Definition at line 422 of file models.py.
|
protected |
Parse repeatable KEY=VALUE tags into deterministic metadata.
| [in] | raw_tags | Value supplied through the raw_tags argument. |
Definition at line 482 of file models.py.
| str picurv_cli.storage.models.STORAGE_CONFIG_FILENAME = ".picurv-storage.yml" |
| str picurv_cli.storage.models.STORAGE_STATE_FILENAME = ".picurv-storage.json" |
| str picurv_cli.storage.models.STORAGE_LOCK_FILENAME = ".picurv-storage.lock.json" |
| str picurv_cli.storage.models.REMOTE_OBJECTS_DIRECTORY = "objects" |
| str picurv_cli.storage.models.REMOTE_BLOBS_DIRECTORY = "blobs" |
| str picurv_cli.storage.models.REMOTE_MANIFEST_FILENAME = "manifest.json" |
| tuple picurv_cli.storage.models.STORAGE_ARTIFACT_TYPES = ("run", "study", "study-case") |
| str picurv_cli.storage.models.RUN_MANIFEST_FILENAME = "manifest.json" |
| str picurv_cli.storage.models.STUDY_MANIFEST_FILENAME = "study_manifest.json" |
| str picurv_cli.storage.models.REMOTE_COMPLETE_FILENAME = "COMPLETE" |
| str picurv_cli.storage.models.DEFAULT_PROFILE_NAME = "archive" |
| float picurv_cli.storage.models.DEFAULT_CHUNK_SIZE_GIB = 8.0 |
| picurv_cli.storage.models.DEFAULT_STORAGE_WORKERS = max(1, min(8, os.cpu_count() or 1)) |
| int picurv_cli.storage.models.AUTO_NO_COMPRESSION_BYTES = 256 * 1024 * 1024 |
| int picurv_cli.storage.models.AUTO_MAXIMUM_COMPRESSION_BYTES = 20 * 1024 * 1024 * 1024 |
| picurv_cli.storage.models.CHECKPOINT_DIRECTORY_PATTERN = re.compile(r"^step_(\d{12})$") |
| picurv_cli.storage.models.INCOMPLETE_CHECKPOINT_PATTERN = re.compile(r"^\.step_\d{12}\.incomplete\.") |
| picurv_cli.storage.models.ARCHIVE_ID_PATTERN = re.compile(r"^[0-9a-f]{32}$") |
| str picurv_cli.storage.models.UNCLASSIFIED_COMPONENT = "unclassified" |
| str picurv_cli.storage.models.WORKSPACE_CONFIG_FILENAME = ".picurv-workspace.yml" |
| tuple picurv_cli.storage.models.WORKSPACE_EXCLUDED_ROOTS = ("runs", "studies") |
| picurv_cli.storage.models.ALWAYS_RETAINED_COMPONENTS |
| tuple picurv_cli.storage.models.STORAGE_RESTORE_COMPONENTS |
| picurv_cli.storage.models.ALWAYS_RESTORED_COMPONENTS = frozenset({"metadata", "workspace-config"}) |
|
protected |
| tuple picurv_cli.storage.models.CLI_OUTPUT_FORMATS = ("text", "json") |
| tuple picurv_cli.storage.models.STORAGE_COMPRESSION_POLICIES = ("auto", "none", "fast", "balanced", "maximum") |
| tuple picurv_cli.storage.models.STORAGE_OFFLOAD_POLICIES = ("metadata-only", "restart-ready", "analysis-ready") |
| tuple picurv_cli.storage.models.STORAGE_RETENTION_COMPONENTS |