Skip to content
14 changes: 7 additions & 7 deletions docs/explanations/converters.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ class MyConverter(Converter):
def pre_process(
self,
queue: list[Task],
history: list[TaskWithPosition],
call_history: list[BlueapiCall],
history: list[QueueTask],
call_history: list[QueueBlueapiCall],
) -> list[Task]: ...

def construct_blueapi_calls(
self,
queue: list[TaskWithPosition],
history: list[TaskWithPosition],
call_history: list[BlueapiCall],
) -> list[BlueapiCall]: ...
queue: list[QueueTask],
history: list[QueueTask],
call_history: list[QueueBlueapiCall],
) -> list[QueueBlueapiCall]: ...
```

### `validate()`
Expand All @@ -44,7 +44,7 @@ This is called whenever anything changes in the queue (e.g a task is added, or a

### `construct_blueapi_calls()`

The queue contains ulims experiments and/or TaskRequests. While TaskRequests are already in the right format for blueapi to receive them, experiments need to be converted to blueapi calls for anything to run. This method is used for this conversion, constructing a list of BlueapiCall objects (which wrap TaskRequest objects) from the current queue contents. This is run whenever the queue changes, but after `pre_process`. The default converter assumes that the queue contains exclusively TaskRequests, and will raise a `NotImplementedError` if an `Experiment` is added. If you want to add ulims experiments to the queue, make sure you are using a custom converter that overrides this method!
The queue contains ulims experiments and/or TaskRequests. While TaskRequests are already in the right format for blueapi to receive them, experiments need to be converted to blueapi calls for anything to run. This method is used for this conversion, constructing a list of QueueBlueapiCall objects (which wrap TaskRequest objects) from the current queue contents. This is run whenever the queue changes, but after `pre_process`. The default converter assumes that the queue contains exclusively TaskRequests, and will raise a `NotImplementedError` if an `Experiment` is added. If you want to add ulims experiments to the queue, make sure you are using a custom converter that overrides this method!

Pre-processing and conversion is run any time the queue changes and right before a call is made to blueapi, so the blueapi call list stays in sync. This means these methods can make use of current information on a beamline such as PV values to inform their logic. However, because they're run so frequently, it is important these methods do not take a large amount of time.

Expand Down
Loading
Loading