Skip to content

Commit d9719e1

Browse files
authored
Merge pull request #165 from ISISComputingGroup/remove_clear_checkpoint
Remove clear_checkpoint from call_sync
2 parents c0ea766 + a93db8e commit d9719e1

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

doc/plan_stubs/external_code.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,10 @@ def good_plan():
5757
# Note use of g.some_function, rather than g.some_function() - i.e. a function reference
5858
# We can also access the returned value from the call.
5959
return_value = yield from call_sync(g.some_function, 123, keyword_argument=456)
60-
yield from bps.checkpoint()
6160
yield from bps.close_run()
6261
```
6362

6463
It is strongly recommended that any functions run in this way are "fast" (i.e. less than a few seconds).
6564
In particular, avoid doing arbitrarily-long waits - for example, waiting for detector data
6665
or sample environment. For these long-running tasks, seek to implement at least the long-running parts using
6766
native bluesky mechanisms.
68-
69-
```{note}
70-
`bps.checkpoint()` above instructs bluesky that this is a safe point from which to resume a plan.
71-
`call_sync` always clears an active checkpoint first, as the code it runs may have arbitrary external
72-
side effects.
73-
74-
If a plan is interrupted with no checkpoint active, it cannot be resumed later (it effectively forces
75-
the plan to abort rather than pause). You will see `bluesky.utils.FailedPause` as part of the traceback
76-
on ctrl-c, if this is the case.
77-
```

src/ibex_bluesky_core/plan_stubs/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,13 @@ def call_sync(func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> Genera
3737
3838
- Blocking the whole event loop
3939
- Breaking keyboard interrupt handling
40-
- Not clearing the active checkpoint
4140
4241
It does not necessarily guard against all possible cases, and as such it is *recommended* to
4342
use native bluesky functionality wherever possible in preference to this plan stub. This should
4443
be seen as an escape-hatch.
4544
4645
The wrapped function will be run in a new thread.
4746
48-
This plan stub will clear any active checkpoints before running the external code, because
49-
in general the external code is not safe to re-run later once it has started (e.g. it may have
50-
done relative sets, or may have started some external process). This means that if a plan is
51-
interrupted at any point between a call_sync and the next checkpoint, the plan cannot be
52-
resumed - in this case bluesky.utils.FailedPause will appear in the ctrl-c stack trace.
53-
5447
Args:
5548
func: A callable to run.
5649
*args: Arbitrary arguments to be passed to the wrapped function
@@ -60,7 +53,6 @@ def call_sync(func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> Genera
6053
The return value of the wrapped function
6154
6255
"""
63-
yield from bps.clear_checkpoint()
6456
return cast(T, (yield Msg(CALL_SYNC_MSG_KEY, func, *args, **kwargs)))
6557

6658

0 commit comments

Comments
 (0)