"""
The ska_oso.activity.domain module contains code that belongs to the activity
domain layer. Classes and definitions contained in this domain layer define
the high-level concepts used to describe and launch scheduling block
activities.
"""
import enum
from pydantic import BaseModel
[docs]
class ActivityState(str, enum.Enum):
"""
Represents the execution state of an Activity.
Activity states track the high-level execution progress of scheduling block
activities, abstracting the underlying procedure execution details while
providing meaningful status information to users and monitoring systems.
"""
# Initial states
PREPARING = "PREPARING" # Procedure being created and initialised
# Ready states
READY = "READY" # Procedure ready, activity can be started
# Execution states
RUNNING = "RUNNING" # Activity currently executing
# Final states
COMPLETE = "COMPLETE" # Activity completed successfully
FAILED = "FAILED" # Activity failed during execution
TERMINATED = "TERMINATED" # Activity was intentionally stopped/curtailed
[docs]
class Activity(BaseModel):
"""
Activity represents an action taken on a scheduling block.
An activity maps to a script that accomplishes the activity's goal. In a
telescope control context, activities and goals could be 'allocate
resources for this SB', 'observe this SB', etc. That is, users talk about
doing something with the SB; their focus is not on which script needs to
run and what script parameters are required to accomplish that task.
"""
activity_id: int
procedure_id: int | None
sbd_id: str
activity_name: str
prepare_only: bool
sbi_id: str