snapshot
snapshot
¶
Completion snapshot manager for the Marianne daemon.
Captures durable snapshots of workspace artifacts at job completion and manages TTL-based cleanup to prevent unbounded storage growth.
Snapshots are stored under ~/.marianne/snapshots/{job_id}/{timestamp}/
and include key artifacts: state JSON, logs, and validation results.
Classes¶
SnapshotManager
¶
Captures and manages completion snapshots for daemon jobs.
Snapshots are lightweight copies of key workspace artifacts, stored under a persistent directory with TTL-based cleanup.
Usage::
manager = SnapshotManager(base_dir=Path("~/.marianne/snapshots"))
path = manager.capture("my-job", Path("/workspace"))
manager.cleanup(max_age_hours=168)
Source code in src/marianne/daemon/snapshot.py
Attributes¶
Functions¶
capture
¶
Capture a snapshot of workspace artifacts at job completion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job identifier. |
required |
workspace
|
Path
|
Path to the job's workspace directory. |
required |
config_path
|
Path | None
|
Optional path to the job config file. If provided and the file exists, it is copied into the snapshot directory. |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
The snapshot directory path as a string, or None if capture |
str | None
|
failed (e.g., workspace doesn't exist or is empty). |
Source code in src/marianne/daemon/snapshot.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
cleanup
¶
Remove snapshots older than the given TTL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_age_hours
|
int
|
Maximum age in hours. Snapshots older than this are deleted. Defaults to 168 (1 week). |
168
|
Returns:
| Type | Description |
|---|---|
int
|
Number of snapshot directories removed. |
Source code in src/marianne/daemon/snapshot.py
list_snapshots
¶
List all snapshots for a given job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job identifier. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, str]]
|
List of dicts with |
list[dict[str, str]]
|
sorted newest-first. |