Sequencer Service

This service provides a handle to send commands to a sequencer which is registered in location service.

Sequencer service has following APIs:

API Input args Returns
loadSequence sequence: SequenceCommand[] OkOrUnhandledResponse
startSequence SubmitResponse
add commands: SequenceCommand[] OkOrUnhandledResponse
prepend commands: SequenceCommand[] OkOrUnhandledResponse
replace id: string, commands: SequenceCommand[] GenericResponse
insertAfter id: string, commands: SequenceCommand[] GenericResponse
delete id: string GenericResponse
addBreakpoint id: string GenericResponse
removeBreakpoint id: string RemoveBreakpointResponse
reset OkOrUnhandledResponse
resume OkOrUnhandledResponse
pause PauseResponse
getSequence StepList or undefined
isAvailable boolean
isOnline boolean
goOnline GoOnlineResponse
goOffline GoOfflineResponse
abortSequence OkOrUnhandledResponse
stop OkOrUnhandledResponse
diagnosticMode startTime: Date, hint: string DiagnosticModeResponse
operationsMode OperationsModeResponse
query runId: string SubmitResponse
queryFinal runId: string, timeoutInSeconds: number SubmitResponse
submit sequence: SequenceCommand[] SubmitResponse
submitAndWait sequence: SequenceCommand[], timeoutInSeconds: number SubmitResponse

Creation of Sequencer Service

Pre-requisite

In order to use sequencer service client for a specific sequencer:

  1. The sequencer and gateway server should be running. GatewayException(InvalidComponent) will be thrown if the specified sequencer not found in the location service.
  2. Authorization Token with correct access role. To read more on how to fetch access token. link.

Here is an example:

Typescript
const tokenFactory = () => auth.token

const sequencerService: SequencerService = await SequencerService(
  new ComponentId(new Prefix('ESW', 'darknight'), 'Sequencer'),
  tokenFactory
)

APIs

Creating SequenceCommands

Typescript
const eswTestPrefix = Prefix.fromString('TCS.darknight')

const setupCommand1 = new Setup(eswTestPrefix, 'setup-command1')
const setupCommand2 = new Setup(eswTestPrefix, 'setup-command2')

const observeCommand1 = new Observe(eswTestPrefix, 'observe-command1')
const observeCommand2 = new Observe(eswTestPrefix, 'observe-command2')

Creating a Sequence

A sequence is a list of sequence commands:

Typescript
//sequence is a list of SequenceCommand
const sequence = [setupCommand1, observeCommand1]

loadSequence

This API takes a sequence and returns the promise of OkOrUnhandledResponse

Typescript
const okOrUnhandledResponse: OkOrUnhandledResponse = await sequencerService.loadSequence(
  sequence
)

startSequence

Typescript
const startSequenceRes: SubmitResponse = await sequencerService.startSequence()

add

Typescript
const addResponse: OkOrUnhandledResponse = await sequencerService.add([
  observeCommand2,
  setupCommand2
])

prepend

Typescript
const prependResponse: OkOrUnhandledResponse = await sequencerService.prepend([
  observeCommand2,
  setupCommand2
])

replace

Typescript
const replaceResponse: GenericResponse = await sequencerService.replace(
  'd99b6cf6-553c-49e9-9089-aaa494f116e9',
  [observeCommand2, setupCommand2]
)

insertAfter

Typescript
const insertAfterResponse: GenericResponse = await sequencerService.insertAfter(
  'd99b6cf6-553c-49e9-9089-aaa494f116e9',
  [observeCommand2, setupCommand2]
)

delete

Typescript
const deleteResponse: GenericResponse = await sequencerService.delete(
  'd99b6cf6-553c-49e9-9089-aaa494f116e9'
)

addBreakpoint

Typescript
const addBreakpointResponse: GenericResponse = await sequencerService.addBreakpoint(
  'd99b6cf6-553c-49e9-9089-aaa494f116e9'
)

removeBreakpoint

Typescript
const removeBreakpointResponse: RemoveBreakpointResponse = await sequencerService.removeBreakpoint(
  'd99b6cf6-553c-49e9-9089-aaa494f116e9'
)

reset

Typescript
const resetResponse: OkOrUnhandledResponse = await sequencerService.reset()

resume

Typescript
const resumeResponse: OkOrUnhandledResponse = await sequencerService.resume()

pause

Typescript
const pauseResponse: PauseResponse = await sequencerService.pause()

getSequence

Typescript
const getSequenceRes: Option<StepList> = await sequencerService.getSequence()

isAvailable

Typescript
const isAvailable: boolean = await sequencerService.isAvailable()

isOnline

Typescript
const isOnline: boolean = await sequencerService.isOnline()

goOnline

Typescript
const goOnlineResponse: GoOnlineResponse = await sequencerService.goOnline()

goOffline

Typescript
const goOfflineResponse: GoOfflineResponse = await sequencerService.goOffline()

abortSequence

Typescript
const abortResponse: OkOrUnhandledResponse = await sequencerService.abortSequence()

stop

Typescript
const stopResponse: OkOrUnhandledResponse = await sequencerService.stop()

diagnosticMode

Typescript
const diagnosticResponse: DiagnosticModeResponse = await sequencerService.diagnosticMode(
  new Date(),
  'engineering'
)

operationsMode

Typescript
const operationsModeResponse: OperationsModeResponse = await sequencerService.operationsMode()

submit

Typescript
const submitResponse: SubmitResponse = await sequencerService.submit(sequence)

submitAndWait

Typescript
const submitAndWaitResponse: SubmitResponse = await sequencerService.submitAndWait(
  sequence,
  10
)

query

Typescript
const queryResponse: SubmitResponse = await sequencerService.query(
  'd99b6cf6-553c-49e9-9089-aaa494f116e9'
)

queryFinal

Typescript
const queryFinalResponse: SubmitResponse = await sequencerService.queryFinal(
  'd99b6cf6-553c-49e9-9089-aaa494f116e9',
  10
)