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.

Sequence Manager service has following APIs:

API Input args Returns
configure obsMode ConfigureResponse
provision config ProvisionResponse
getRunningObsModes GetRunningObsModesResponse
startSequencer subsystem, obsMode StartSequencerResponse
restartSequencer subsystem, obsMode RestartSequencerResponse
shutdownSequencer subsystem, obsMode ShutdownSequencersResponse
shutdownSubsystemSequencers subsystem ShutdownSequencersResponse
shutdownObsModeSequencers obsMode ShutdownSequencersResponse
shutdownAllSequencers ShutdownSequencersResponse
shutdownSequenceComponent prefix ShutdownSequenceComponentResponse
shutdownAllSequenceComponents ShutdownSequenceComponentResponse
getAgentStatus AgentStatusResponse

Creation of Sequence Manager Service

Pre-requisite

In order to create sequence manager service APIs:

  1. Subsystem’s agent machines should be up and running.
  2. Sequence Manager should be spawned. Documentation on how to spawn sequence manager could be found here.
  3. Authorization Token with correct access role. Documentation on how to fetch access token could be found here.

To create Sequence Manager client:

Typescript
const tokenFactory = () => auth.token
const sequenceManagerService: SequenceManagerService = await SequenceManagerService(
  tokenFactory
)

APIs

configure

It 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 API returns response containing Success as ConfigureResponse after successful start of all required sequencers.

The following example shows how to call configure API. Here machines will be setup for ‘IRIS_DarkNight’ observation mode.

Typescript
const obsMode = new ObsMode('IRIS_DarkNight')
const configureResponse: ConfigureResponse = await sequenceManagerService.configure(
  obsMode
)

provision

This API shutdowns 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.

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
)

getRunningObsModes

This API returns all the running observation modes.

The following example shows how to call getRunningObsModes API :

Typescript
const obsModes: GetRunningObsModesResponse = await sequenceManagerService.getRunningObsModes()

startSequencer

This API starts the sequencer for given subsystem and observation mode. It uses the subsystem’s sequence component, if not available, fallbacks to ESW sequence component.

The following example shows how to call startSequencer API :

Typescript
const startSequencerResponse: StartSequencerResponse = await sequenceManagerService.startSequencer(
  'IRIS',
  obsMode
)

restartSequencer

It restarts the existing running sequencer of given subsystem and observing mode.

The following example shows how to call restartSequencer API :

Typescript
const restartSequencerResponse: RestartSequencerResponse = await sequenceManagerService.restartSequencer(
  'IRIS',
  obsMode
)

shutdownSequencer

This API shutdowns the running sequencer of given subsystem and observation mode.

The following example shows how to call shutdownSequencer API :

Typescript
const shutdownSequencerResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownSequencer(
  'IRIS',
  obsMode
)

shutdownSubsystemSequencers

This API shutdowns all the running sequencers of given subsystem.

The following example shows how to call shutdownSubsystemSequencers API :

Typescript
const shutdownSubsystemSeqResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownSubsystemSequencers(
  'IRIS'
)

shutdownObsModeSequencers

This API shutdowns all the running sequencers of given observation mode.

The following example shows how to call shutdownObsModeSequencers API :

Typescript
const shutdownObsModeSeqResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownObsModeSequencers(
  obsMode
)

shutdownAllSequencers

This API shutdowns all the running sequencers.

The following example shows how to call shutdownAllSequencers API :

Typescript
const shutdownAllSequencersResponse: ShutdownSequencersResponse = await sequenceManagerService.shutdownAllSequencers()

shutdownSequenceComponent

This API shutdowns sequence component with provided prefix.

The following example shows how to call shutdownSequenceComponent API :

Typescript
const seqCompPrefix = new Prefix('ESW', 'ESW.ESW_1')
const shutdownSeqCompResponse: ShutdownSequenceComponentResponse = await sequenceManagerService.shutdownSequenceComponent(
  seqCompPrefix
)

shutdownAllSequenceComponents

This API shutdowns all the sequence components.

The following example shows how to call shutdownAllSequenceComponents API :

Typescript
const shutdownAllSeqCompResponse: ShutdownSequenceComponentResponse = await sequenceManagerService.shutdownAllSequenceComponents()

getAgentStatus

This API 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.

The following example shows how to call getAgentStatus API :

Typescript
const agentStatus: AgentStatusResponse = await sequenceManagerService.getAgentStatus()