Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add functionality for pausing/stoping/aborting per event #29

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

maffettone
Copy link
Contributor

@maffettone maffettone commented Nov 21, 2023

In response to this Mattermost issue, adds the ability for an adaptive eventwise plan to pause, stop, or abort.

Description

  • Adds RequestPause as subclass of RunEngineControlException
  • doc/refactor: removes gp assumptions from syntax
  • Adds None to queue for completion
  • Raises exceptions to RE to be processed accordingly (i.e., RequestStop, RequestAbort)
  • Uses the RequestPause error to yield from bps.pause()

Motivation and Context

This may be overkill for the issue @untzag had, but it is a broadly applicable need.

Summary of Changes for Release Notes

Add per-event adaptive functionality to handle stopping/aborting/pausing the RunEngine

Fixed

  • doc/refactor: removes gp assumptions from syntax

Added

Adds RequestPause as subclass of RunEngineControlException

Changed

  • Raises exceptions to RE to be processed accordingly (i.e., RequestStop, RequestAbort)
  • Uses the RequestPause error to yield from bps.pause()

Removed

How Has This Been Tested?

Additional unit tests. Expect CI/CD via GHA to still fail, but these tests pass locally.

- Adds tests
- Adds RecommendPause as subclass of RunEngineControlException
- doc/refactor: removes gp assumptions from syntax
@maffettone maffettone requested a review from tacaswell November 21, 2023 01:07
@@ -81,6 +82,9 @@ def callback(name, doc):
except NoRecommendation:
# no recommendation
queue.put(None)
except RunEngineControlException as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle the except Exepction case here as well so that it get re-raised correctly in L173 rather than being raised in which ever stack this callback is running in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added generic exception pass through to plan here 8b70052

@tacaswell
Copy link
Contributor

I'm going to merge over the failures as it looks like they are due to changes in other bluesky libraries.

@tacaswell
Copy link
Contributor

============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.4, pluggy-1.4.0 -- /opt/hostedtoolcache/Python/3.8.18/x64/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/bluesky-adaptive/bluesky-adaptive
plugins: docker-1.0.1, anyio-4.3.0
collecting ... collected 0 items / 1 error

==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
bluesky_adaptive/tests/conftest.py:5: in <module>
    from bluesky_kafka.tests.conftest import broker_authorization_config  # noqa
E   ImportError: cannot import name 'broker_authorization_config' from 'bluesky_kafka.tests.conftest' (/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/bluesky_kafka/tests/conftest.py)
=========================== short test summary info ============================
ERROR  - ImportError: cannot import name 'broker_authorization_config' from 'bluesky_kafka.tests.conftest' (/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/bluesky_kafka/tests/conftest.py)
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 1.24s ===============================

@tacaswell tacaswell merged commit b521544 into bluesky:main Mar 15, 2024
3 of 8 checks passed
@maffettone
Copy link
Contributor Author

GHA Tests and Docs are on my next todos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants