pudl.scripts.dghome#
Manage UUID-named directories in a Dagster storage directory.
This CLI helps manage the Dagster storage directory to reclaim disk space by listing and removing run artifacts (represented as UUID-named directories) based on modification date.
Examples
- List all UUID-named directories:
dghome ls
- List directories modified on or before 2026-01-15:
dghome ls 2026-01-15
- List directories modified 10 days or more ago:
dghome ls 10d
- Remove directories modified 1 month or more ago:
dghome rm 1m
Attributes#
Functions#
|
Parse a cutoff datetime from one of several formats. |
|
Format a kilobyte count as a human-readable string (e.g. 1.2M, 3.4G). |
|
Get the right color of output for the filesize. |
|
Return UUID dirs from $DAGSTER_HOME/storage, filtered to mtime <= cutoff_ts. |
|
Manage UUID-named directories in Dagster storage. |
|
List UUID directories, optionally filtered by modification date. |
|
Remove UUID directories last modified on or before DATE. |
|
Entry point for the dghome CLI. |
Module Contents#
- pudl.scripts.dghome._parse_date(date_str: str, now: datetime.datetime | None = None) datetime.datetime[source]#
Parse a cutoff datetime from one of several formats.
Accepts any absolute time string that dateutil can handle, plus relative time strings like “<N>d/w/m” (for days/weeks/months).
- pudl.scripts.dghome._human_readable(kb: int) str[source]#
Format a kilobyte count as a human-readable string (e.g. 1.2M, 3.4G).
- pudl.scripts.dghome._row_color(size_kb: int) str | tuple[int, int, int][source]#
Get the right color of output for the filesize.
< 100 MB: green < 1 GB: yellow < 5 GB: orange else: red
- pudl.scripts.dghome._collect(cutoff_ts: float | None) list[dict][source]#
Return UUID dirs from $DAGSTER_HOME/storage, filtered to mtime <= cutoff_ts.
Raises click.ClickException if DAGSTER_HOME is unset or the storage dir is missing. Results are sorted by modification time (oldest first).
- pudl.scripts.dghome._DATE_FORMATS_EPILOG = Multiline-String[source]#
Show Value
""" Accepts any absolute time string that dateutil can handle, plus relative time strings like '<N>d/w/m' (for days/weeks/months)."""
- pudl.scripts.dghome.ls(date: str | None) None[source]#
List UUID directories, optionally filtered by modification date.
Without DATE, lists all directories. With DATE, lists only those last modified on or before DATE.