Skip to content

enums

Package for providing enumerations for interfaces

ReturnCode

Bases: IntEnum

Enum for Merlin return codes.

This class defines various return codes used in the Merlin system to indicate the status of operations. Each return code corresponds to a specific outcome of a process.

Attributes:

Name Type Description
OK int

Indicates a successful operation. Numeric value: 0.

ERROR int

Indicates a general error occurred. Numeric value: 1.

RESTART int

Indicates that the process should be restarted. Numeric value: 100.

SOFT_FAIL int

Indicates a non-critical failure that allows for recovery. Numeric value: 101.

HARD_FAIL int

Indicates a critical failure that cannot be recovered from. Numeric value: 102.

DRY_OK int

Indicates a successful operation in a dry run (no changes made). Numeric value: 103.

RETRY int

Indicates that the operation should be retried. Numeric value: 104.

STOP_WORKERS int

Indicates that worker processes should be stopped. Numeric value: 105.

RAISE_ERROR int

Indicates that an error should be raised. Numeric value: 106.

Source code in merlin/common/enums.py
class ReturnCode(IntEnum):
    """
    Enum for Merlin return codes.

    This class defines various return codes used in the Merlin system to indicate
    the status of operations. Each return code corresponds to a specific outcome
    of a process.

    Attributes:
        OK (int): Indicates a successful operation. Numeric value: 0.
        ERROR (int): Indicates a general error occurred. Numeric value: 1.
        RESTART (int): Indicates that the process should be restarted. Numeric value: 100.
        SOFT_FAIL (int): Indicates a non-critical failure that allows for recovery. Numeric value: 101.
        HARD_FAIL (int): Indicates a critical failure that cannot be recovered from. Numeric value: 102.
        DRY_OK (int): Indicates a successful operation in a dry run (no changes made). Numeric value: 103.
        RETRY (int): Indicates that the operation should be retried. Numeric value: 104.
        STOP_WORKERS (int): Indicates that worker processes should be stopped. Numeric value: 105.
        RAISE_ERROR (int): Indicates that an error should be raised. Numeric value: 106.
    """

    OK = 0
    ERROR = 1
    RESTART = 100
    SOFT_FAIL = 101
    HARD_FAIL = 102
    DRY_OK = 103
    RETRY = 104
    STOP_WORKERS = 105
    RAISE_ERROR = 106

RunStatus

Bases: Enum

Enumeration of possible run statuses.

Attributes:

Name Type Description
INITIALIZED

Run has been created in the database but not queued.

QUEUED

Run is queued and waiting to start.

RUNNING

Run is currently executing.

COMPLETED

Run has finished successfully.

CANCELLED

Run was cancelled by the user.

FAILED

Run failed due to an error.

Source code in merlin/common/enums.py
class RunStatus(Enum):
    """
    Enumeration of possible run statuses.

    Attributes:
        INITIALIZED: Run has been created in the database but not queued.
        QUEUED: Run is queued and waiting to start.
        RUNNING: Run is currently executing.
        COMPLETED: Run has finished successfully.
        CANCELLED: Run was cancelled by the user.
        FAILED: Run failed due to an error.
    """

    INITIALIZED = "INITIALIZED"
    QUEUED = "QUEUED"
    RUNNING = "RUNNING"
    COMPLETED = "COMPLETED"
    CANCELLED = "CANCELLED"
    FAILED = "FAILED"

WorkerStatus

Bases: Enum

Status of Merlin workers.

Attributes:

Name Type Description
RUNNING str

Indicates the worker is running. String value: "running".

STALLED str

Indicates the worker is running but hasn't been processing work. String value: "stalled".

STOPPED str

Indicates the worker is not running. String value: "stopped".

REBOOTING str

Indicates the worker is actively restarting itself. String value: "rebooting".

Source code in merlin/common/enums.py
class WorkerStatus(Enum):
    """
    Status of Merlin workers.

    Attributes:
        RUNNING (str): Indicates the worker is running. String value: "running".
        STALLED (str): Indicates the worker is running but hasn't been processing work. String value: "stalled".
        STOPPED (str): Indicates the worker is not running. String value: "stopped".
        REBOOTING (str): Indicates the worker is actively restarting itself. String value: "rebooting".
    """

    RUNNING = "RUNNING"
    STALLED = "STALLED"
    STOPPED = "STOPPED"
    REBOOTING = "REBOOTING"