Skip to content

generate_run_id

Public callable

Generate a notebook-safe run identifier.

Parameters:

Name Type Description Default
prefix str

Human-friendly prefix, typically a dataset name.

"run"

Returns:

Type Description
str

Identifier in the form <normalized_prefix>_<utc_timestamp>_<short_uuid>.

Examples:

>>> generate_run_id("orders")
'orders_20260502T102030Z_1a2b3c4d'
Source code in src/fabricops_kit/runtime.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
def generate_run_id(prefix: str = "run") -> str:
    """Generate a notebook-safe run identifier.

    Parameters
    ----------
    prefix : str, default="run"
        Human-friendly prefix, typically a dataset name.

    Returns
    -------
    str
        Identifier in the form ``<normalized_prefix>_<utc_timestamp>_<short_uuid>``.

    Examples
    --------
    >>> generate_run_id("orders")  # doctest: +SKIP
    'orders_20260502T102030Z_1a2b3c4d'
    """
    normalized_prefix = normalize_name(prefix) or "run"
    timestamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
    short_uuid = uuid4().hex[:8]
    return f"{normalized_prefix}_{timestamp}_{short_uuid}"