Other DSL
par
This utility is provided to support running multiple tasks in parallel. A call to par
returns when all the submitted tasks complete.
The following example demonstrates sending commands in parallel to multiple HCD’s.
- Kotlin
-
val prefix = "OCS.IRIS_darkMode" val hcd1 = Hcd(IRIS, "filter.wheel1", 10.minutes) val hcd2 = Hcd(IRIS, "filter.wheel2", 10.minutes) val hcd3 = Hcd(IRIS, "filter.wheel3", 10.minutes) onSetup("setup-iris-hcds") { // send 3 setup commands to 3 HCD's in parallel val responses: List<SubmitResponse> = par( { hcd1.submitAndWait(Setup(prefix, "move-10")) }, { hcd2.submitAndWait(Setup(prefix, "move-10")) }, { hcd3.submitAndWait(Setup(prefix, "move-10")) } ) }
isOnline
A flag called isOnline
is provided, which is true
when sequencer is Online and false
when sequencer is Offline. This dsl is accessible in all the scopes.
- Kotlin
-
onDiagnosticMode { _, _ -> loopAsync(100.milliseconds) { if (isOnline) publishEvent(SystemEvent("TCS.filter.wheel", "online-diag-data")) else publishEvent(SystemEvent("TCS.filter.wheel", "offline-diag-data")) } }
prefix
Prefix of the current sequencer is made available in all scopes by this dsl.
Source code for examples
0.1.0*