Repository navigation
refactor: Include Bluesky plan stubs by default #1694
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
base: main
Are you sure you want to change the base?
Changes from all commits
4866f5a
d112abe
45c0490
e3caf4c
d96a6fb
57d4248
2c307e4
c8b214c
3c5b194
b020927
e6ab3b5
6560523
07a920a
4dc37cc
00250ff
c86e8fc
767bbba
2805249
48293eb
e2bba11
d32d122
0dc41cf
723093c
cf41bd2
189f006
7ffbbf1
46ecf0a
573f491
176db63
1a70e11
ffd5d26
96a0182
623cfbb
5c4d152
f16a563
9d9b833
6685d59
a4fe7fe
66ba601
f0d832c
44d1786
ffed138
d845868
c601529
85e531e
654e863
2d21a41
2b21e37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,15 +5,9 @@ | |
| from importlib import import_module, metadata | ||
| from inspect import Parameter, isclass, signature | ||
| from types import ModuleType, NoneType, UnionType | ||
| from typing import ( | ||
| Any, | ||
| TypeVar, | ||
| Union, | ||
| get_args, | ||
| get_origin, | ||
| get_type_hints, | ||
| ) | ||
| from typing import Any, TypeVar, Union, get_args, get_origin, get_type_hints | ||
|
|
||
| import bluesky.plan_stubs as bps | ||
| from bluesky.protocols import HasName | ||
| from bluesky.run_engine import RunEngine | ||
| from ophyd_async.core import NotConnectedError, PathProvider | ||
|
|
@@ -58,6 +52,19 @@ | |
|
|
||
| LOGGER = logging.getLogger(__name__) | ||
|
|
||
| DEFAULT_PLAN_STUBS = [ | ||
| bps.abs_set, | ||
| bps.rel_set, | ||
| bps.mv, | ||
|
tpoliaw marked this conversation as resolved.
Resolved
|
||
| bps.mvr, | ||
| bps.rd, | ||
| bps.read, | ||
| bps.stop, | ||
| bps.sleep, | ||
| bps.wait, | ||
| bps.locate, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accept
Add an Suggested fix
Add a unit test in which a device declares a concrete generic bound, such as
|
||
| bps.loc, | ||
| ] | ||
|
|
||
| if "ophyd" in sys.modules: | ||
| # This is an awful hack/workaround to avoid blueapi hanging on shutdown when | ||
|
|
@@ -139,6 +146,9 @@ def __post_init__(self, configuration: ApplicationConfig | None): | |
| if not configuration: | ||
| return | ||
|
|
||
| for plan_stub in DEFAULT_PLAN_STUBS: | ||
| self.register_plan(plan_stub) | ||
|
|
||
| if configuration.numtracker is not None: | ||
| # The numtracker client itself is wired up by the service, see | ||
| # blueapi.service.interface.context | ||
|
|
@@ -193,7 +203,7 @@ def find_device(self, addr: str | list[str]) -> Device | None: | |
|
|
||
| def with_config(self, config: EnvironmentConfig) -> None: | ||
| if config.metadata is not None: | ||
| self.run_engine.md |= config.metadata.model_dump() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change not related to this change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the original |= I'm getting an error: |
||
| self.run_engine.md.update(config.metadata.model_dump()) | ||
|
|
||
| package_map = metadata.packages_distributions() | ||
| packages = {src.module.split(".")[0] for src in config.sources} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.