The ska_oso_oet.activity.application module contains code related to OET ‘activities’ that belong in the application layer. This application layer holds the application interface, delegating to objects in the domain layer for business rules and actions.

class ska_oso_oet.activity.application.ActivityService[source]

ActivityService provides the high-level interface and facade for the activity domain.

The interface is used to run activities referenced by Scheduling Blocks. Each activity will run a script (or procedure) but ActivityService will create the necessary commands for Procedure domain to create and execute the scripts.

complete_run_activity(prepared_summary: ProcedureSummary, request_id: int) ActivitySummary | None[source]

Complete the request to run the Activity, using the ProcedureSummary that is now available. This includes updating the Activity with the procedure_id, sending the request to start the procedure if prepare_only is not set to True, and returning the ActivitySummary.

  • prepared_summary – the ProcedureSummary for the Procedure related to the requested Activity

  • request_id – The original request_id from the REST layer


an ActivitySummary describing the state of the Activity that the Procedure is linked to, or None if the Procedure was not created from an Activity

prepare_run_activity(cmd: ActivityCommand, request_id: int) None[source]

Prepare to run the activity of a Scheduling Block. This includes retrieving the script from the scheduling block and sending the request messages to the ScriptExecutionService to prepare the script.

The request_id is required to be propagated through the messages sent to the Procedure layer, so the REST layer can wait for the correct response event.

  • cmd – dataclass argument capturing the activity name and SB ID

  • request_id – The original request_id from the REST layer

summarise(activity_ids: List[int] | None = None) List[ActivitySummary][source]

Return ActivitySummary objects for Activities with the requested IDs.

This method accepts an optional list of integers, representing the Activity IDs to summarise. If the IDs are left undefined, ActivitySummary objects for all current Activities will be returned.


activity_ids – optional list of Activity IDs to summarise.


list of ActivitySummary objects

write_sbd_to_file(sbd) str[source]

Writes the SBD json to a temporary file location and returns the path.

class ska_oso_oet.activity.application.ActivitySummary(id: int, pid: int, sbd_id: str, activity_name: str, prepare_only: bool, script_args: Dict[str, ska_oso_oet.procedure.domain.ProcedureInput], activity_states: List[Tuple[ska_oso_oet.activity.domain.ActivityState, float]])[source]
__init__(id: int, pid: int, sbd_id: str, activity_name: str, prepare_only: bool, script_args: Dict[str, ProcedureInput], activity_states: List[Tuple[ActivityState, float]]) None


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.

class ska_oso_oet.activity.domain.Activity(activity_id: int, procedure_id: int | None, sbd_id: str, activity_name: str, prepare_only: bool)[source]

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.

__init__(activity_id: int, procedure_id: int | None, sbd_id: str, activity_name: str, prepare_only: bool) None
class ska_oso_oet.activity.domain.ActivityState(value)[source]

ActivityState represent the state of an Activity.

ActivityState is currently a placeholder, to be elaborated with the full activity lifecycle (CREATED, RUNNING, SUCCEEDED, FAILED, etc.) in a later PI.


The ska_oso_oet.activity.ui module contains code that belongs to the activity UI/presentation layer. This layer is the means by which external users or systems would interact with activities.

ska_oso_oet.activity.ui.make_public_activity_summary(activity: ActivitySummary)[source]

Convert an ActivitySummary into JSON ready for client consumption.

The main use of this function is to replace the internal Activity ID with the resource URI, e.g., 1 -> http://localhost:5000/api/v1.0/procedures/1


activity – ActivitySummary to convert


safe JSON representation