Use Case
Currently the queueserver can be set to loop mode:
|
if loop_mode: |
|
item_to_add = self.set_new_item_uuid(item) |
|
await self._add_item_to_queue(item_to_add) |
This is useful, but there are other situations where my scientists want to run, for example,
- 10 plans with differing arguments, repeating 3 times
- A single plan to change some condition
- Another single plan to change some condition
- 7 plans with differing arguments, repeating 10 times
... and so on and so fourth with 12 hours worth of plans.
Proposal
Option 1
I propose adding two new instructions:
loop_start
{"name": "loop_start", "options": {"num": N}, "item_type": "instruction"}
Initiates a loop, the plans between this and an exit instruction will be repeated N times.
loop_exit
{"name": "loop_exit", "item_type": "instruction"}
Marks the end of the loop.
Option 2
A more general goto instruction, with some way to handle conditionals:
{"name": "goto", "options": {"absolute_index": N, "repeat_limit": M}, "item_type": "instruction"}
A running queueserver would have state for how many times each goto has been ran and skip them once repeat_limit is reached.
The following would repeat an entire queue forever:
{"name": "goto", "options": {"absolute_index": 0}, "item_type": "instruction"}
We could also allow goto to specify relative index, repeat the last two plans N times:
{"name": "goto", "options": {"relative_index": -2, "repeat_limit": N}, "item_type": "instruction"}
Use Case
Currently the queueserver can be set to loop mode:
bluesky-queueserver/bluesky_queueserver/manager/plan_queue_ops.py
Lines 1634 to 1636 in 062265d
This is useful, but there are other situations where my scientists want to run, for example,
... and so on and so fourth with 12 hours worth of plans.
Proposal
Option 1
I propose adding two new instructions:
loop_start{"name": "loop_start", "options": {"num": N}, "item_type": "instruction"}Initiates a loop, the plans between this and an exit instruction will be repeated
Ntimes.loop_exit{"name": "loop_exit", "item_type": "instruction"}Marks the end of the loop.
Option 2
A more general
gotoinstruction, with some way to handle conditionals:{"name": "goto", "options": {"absolute_index": N, "repeat_limit": M}, "item_type": "instruction"}A running queueserver would have state for how many times each
gotohas been ran and skip them oncerepeat_limitis reached.The following would repeat an entire queue forever:
{"name": "goto", "options": {"absolute_index": 0}, "item_type": "instruction"}We could also allow
gototo specify relative index, repeat the last two plansNtimes:{"name": "goto", "options": {"relative_index": -2, "repeat_limit": N}, "item_type": "instruction"}