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_date(→ datetime.datetime)

Parse a cutoff datetime from one of several formats.

_human_readable(→ str)

Format a kilobyte count as a human-readable string (e.g. 1.2M, 3.4G).

_row_color(→ str | tuple[int, int, int])

Get the right color of output for the filesize.

_collect(→ list[dict])

Return UUID dirs from $DAGSTER_HOME/storage, filtered to mtime <= cutoff_ts.

dghome(→ None)

Manage UUID-named directories in Dagster storage.

ls(→ None)

List UUID directories, optionally filtered by modification date.

rm(→ None)

Remove UUID directories last modified on or before DATE.

main(→ None)

Entry point for the dghome CLI.

Module Contents#

pudl.scripts.dghome.UUID_PATTERN[source]#
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.dghome() None[source]#

Manage UUID-named directories in Dagster storage.

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.

pudl.scripts.dghome.rm(date: str | None) None[source]#

Remove UUID directories last modified on or before DATE.

Without DATE, reports what would be removed but does nothing.

Confirms before deletion.

pudl.scripts.dghome.main() None[source]#

Entry point for the dghome CLI.