Sequence Manager Service
The Sequence Manager Service manages all the operation related to the observations. It manages all sequence components and sequencers required for the observations.
Creation of Sequence Manager Service
Pre-requisite
In order to use Sequence Manager Service APIs
- Subsystem’s agent machines should be up and running.
- Sequence Manager should be spawned. Documentation on how to spawn Sequence Manager could be found here.
- Authorization Token with correct access role. Documentation on how to fetch authorization token could be found here.
To create Sequence Manager client
- Typescript
-
const tokenFactory = () => auth.token const sequenceManagerService: SequenceManagerService = await SequenceManagerService( tokenFactory )
Usages of Sequence Manager Service
Configuring Resources
To configure resources, SequenceManagerService provides configure method. This method starts sequencers needed for an observation mode. Before starting sequencer, it checks for resource conflict between requested observation mode and running observation mode. The required sequencers and resources are listed in obsModeConfig file provided at boot up time of Sequence Manager. It returns ConflictingResourcesWithRunningObsMode if required resources are not available. This method returns response containing Success as ConfigureResponse after successful start of all required sequencers.
The following example shows how to call configure method. Here machines will be setup for 'IRIS_DarkNight' observation mode.
Type definitions of configure method can be found here
- Typescript
-
const obsMode = new ObsMode('IRIS_DarkNight') const configureResponse: ConfigureResponse = await sequenceManagerService.configure( obsMode )
Provisioning
To provision resources, SequenceManagerService provides provision method. This method shuts down all the running sequence components and provisions the new sequence components in accordance with the provided configuration. The configuration specifies number of sequence components needed to be spawned on a particular agent. It returns Success as ProvisionResponse after successful spawning of components.
In following example, three sequence components will be spawned on 'ESW.agent-machine' agent machine and two sequence component will be spawned on 'IRIS.agent-machine' agent machine.
Type definitions of provision method can be found here
- Typescript
-
const eswAgentPrefix = new Prefix('ESW', 'agent-machine') const irisAgentPrefix = new Prefix('IRIS', 'agent-machine') const eswAgentProvisionConfig = new AgentProvisionConfig(eswAgentPrefix, 3) const irisAgentProvisionConfig = new AgentProvisionConfig(irisAgentPrefix, 2) const provisionConfig = new ProvisionConfig([ eswAgentProvisionConfig, irisAgentProvisionConfig ]) const provision: ProvisionResponse = await sequenceManagerService.provision( provisionConfig )
Getting Running ObsModes
To get all the running ObsModes, SequenceManagerService provides getRunningObsModes method. This method returns all the running observation modes.
Type definitions of getRunningObsModes method can be found here
The following example shows how to call getRunningObsModes method:
- Typescript
-
const obsModes: GetRunningObsModesResponse = await sequenceManagerService.getRunningObsModes()
Starting a Sequencer
To start a Sequencer, SequenceManagerService provides startSequencer method. This method starts the sequencer for given subsystem and observation mode. It uses the subsystem’s sequence component, if not available, fallbacks to ESW sequence component.
Type definitions of startSequencer method can be found here
The following example shows how to call startSequencer method:
- Typescript
-
const startSequencerResponse: StartSequencerResponse = await sequenceManagerService.startSequencer( 'IRIS', obsMode )
Restarting a Sequencer
To restart a Sequencer, SequenceManagerService provides restartSequencer method. This method restarts the existing running sequencer of given subsystem and observing mode.
Type definitions of restartSequencer method can be found here
The following example shows how to call restartSequencer method:
- Typescript
-
const restartSequencerResponse: RestartSequencerResponse = await sequenceManagerService.restartSequencer( 'IRIS', obsMode )
Shutting down Sequencers
To shut down one or more Sequencer, SequenceManagerService provides following methods:
- shutdownSequencer - This method shuts down the running sequencer of given subsystem and observation mode.
- Typescript
-
const shutdownSequencerResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownSequencer( 'IRIS', obsMode )
- shutdownSubsystemSequencers - This method shuts down all the running sequencers of given subsystem.
- Typescript
-
const shutdownSubsystemSeqResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownSubsystemSequencers( 'IRIS' )
- shutdownObsModeSequencers - This method shuts down all the running sequencers of given observation mode.
- Typescript
-
const shutdownObsModeSeqResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownObsModeSequencers( obsMode )
- shutdownAllSequencers - This method shuts down all the running sequencers.
- Typescript
-
const shutdownAllSequencersResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownAllSequencers()
Type definitions of these methods are below:
Shutting down Sequence Components
To shut down one or more Sequence Components, SequenceManagerService provides following methods:
- shutdownSequenceComponent - This method shuts down sequence component with provided prefix.
- Typescript
-
const seqCompPrefix = new Prefix('ESW', 'ESW.ESW_1') const shutdownSeqCompResponse: ShutdownSequenceComponentResponse = await sequenceManagerService.shutdownSequenceComponent( seqCompPrefix )
- shutdownAllSequenceComponents - This method shuts down all the sequence components.
- Typescript
-
const shutdownAllSeqCompResponse: ShutdownSequenceComponentResponse = await sequenceManagerService.shutdownAllSequenceComponents()
Type definitions of these methods are below:
Getting Agent Status
To get Agent Status for a running Agent, SequenceManagerService provides getAgentStatus method. This method allows showing status of TMT ecosystem components (agents, sequence components and sequencers). It returns all agents that are up and running, sequence components running on those agents and sequencer script loaded on sequence component.
Type definitions of getAgentStatus method can be found here
The following example shows how to call getAgentStatus method: