############################### Long Running Commands Overview ############################### The CSP.LMC **Long Running Commands (LRC)** framework provides a common architecture to execute, monitor, and report the outcome of asynchronous commands issued to the CSP Controller or CSP Subarray. A single client command typically triggers multiple operations on different CSP sub-systems (CBF, CSP, PST, PSS). The LRC framework coordinates this process by decomposing the command, executing it according to a defined strategy, and exposing a coherent execution status to the client. Concepts and terminology ======================== To avoid ambiguity, the following terminology is used consistently throughout the CSP.LMC codebase: * **MainTask** The command issued by a TANGO client to the CSP Controller or Subarray. It represents the logical unit of work from the client perspective. * **Task** An execution unit encapsulating command logic (command name, execution type, callbacks, etc.). A Task may be composed of other Tasks, forming a hierarchical structure. * **LeafTask** The smallest execution unit in a task tree. A LeafTask typically corresponds to a command issued to a CSP sub-system or to an internal CSP.LMC operation. High-level execution flow ========================= At a conceptual level, the execution of a Long Running Command follows these steps: 1. Validate the initial device state to determine whether the command can be executed. 2. Decompose the client command (MainTask) into a task-tree structure. 3. Execute Tasks and LeafTasks according to their execution strategy (e.g. sequential or parallel). 4. Monitor execution progress and detect completion or failure. 5. Report the final command outcome to the client. Not all accepted client commands necessarily reach the execution phase. During task-tree composition, the framework may reject a command if the required execution targets cannot be resolved from the current Component Manager context. In such cases, no MainTask is passed to the execution stage. Tracking and reporting ====================== Execution progress and final results are exposed through the LRC attributes of the CSP Controller or Subarray. Each MainTask aggregates the execution state of its underlying Tasks, providing the client with a single, coherent view of command execution. Detailed descriptions of task composition, execution, tracking, and result aggregation are provided in the corresponding subsections of this documentation.