Skip to content

Commit

Permalink
Wait for async staging in stage_wrapper
Browse files Browse the repository at this point in the history
Use stage_all and unstage_all to wait for staging
to complete when stage returns a Status rather than
blocking
  • Loading branch information
coretl committed Oct 10, 2023
1 parent 6e3c472 commit 9a33dde
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions bluesky/preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
short_uid as _short_uid, make_decorator,
RunEngineControlException, merge_axis)
from functools import wraps
from .plan_stubs import (open_run, close_run, mv, pause, trigger_and_read, declare_stream)
from .plan_stubs import (open_run, close_run, mv, pause, trigger_and_read,
declare_stream, stage_all, unstage_all)


def plan_mutator(plan, msg_proc):
Expand Down Expand Up @@ -950,12 +951,10 @@ def stage_wrapper(plan, devices):
devices = separate_devices(root_ancestor(device) for device in devices)

def stage_devices():
for d in devices:
yield Msg('stage', d)
yield from stage_all(*devices)

def unstage_devices():
for d in reversed(devices):
yield Msg('unstage', d)
yield from unstage_all(*reversed(devices))

def inner():
yield from stage_devices()
Expand Down

0 comments on commit 9a33dde

Please sign in to comment.