-
Notifications
You must be signed in to change notification settings - Fork 4
Hyperion supervisor implementation #1530
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
Conversation
7f6606a to
285ca33
Compare
285ca33 to
17ede8b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1530 +/- ##
==========================================
+ Coverage 92.29% 92.45% +0.15%
==========================================
Files 144 146 +2
Lines 8167 8272 +105
==========================================
+ Hits 7538 7648 +110
+ Misses 629 624 -5
🚀 New features to boost your workflow:
|
17ede8b to
fb6e53f
Compare
0769d9d to
0671ffd
Compare
d360a62 to
9ca88ac
Compare
jacob720
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, a couple of comments but happy to merge if you disagree
|
|
||
| def parse_callback_dev_mode_arg() -> bool: | ||
| def parse_callback_args() -> CallbackArgs: | ||
| """Returns the bool representing the 'dev_mode' argument.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could : Update this docstring to include the watchdog_port
| instrument_session=instrument_session, | ||
| ) | ||
| self._run_task_remotely(task_request) | ||
| case _: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It strikes me that currently if we add a plan that agamemnon can request, we'd have to make changes in 3 places:
SupvervisorRunner.decode_and_executeInProcessRunner.decode_and_executecreate_parameters_from_agamemnon
Could we push some of this logic into new classes that extend or contain the parameter models?
Something like
class ExecutablePlan:
@abstractmethod
def execute_plan(self, context: BlueskyContext) -> MsgGenerator: ...
@abstractmethod
def get_task_request(self, instrument_session) -> TaskRequest: ...
class TaskRequestAndExecuteFromLoadCentreCollect(ExecutablePlan):
def __init__(self, parameters: LoadCentreCollect):
self.parameters = parameters
def get_task_request(self, instrument_session):
return TaskRequest(
name="load_centre_collect",
params={"parameters": self.parameters},
instrument_session=instrument_session,
)
def execute_plan(self, context: BlueskyContext):
devices: Any = create_devices(context)
yield from self.execute_plan(
partial(load_centre_collect_full, devices, self.parameters)
)
return self.parameters.visit
class TaskRequestFromUDCDefaultState(ExecutablePlan):
def get_task_request(self, instrument_session):
return TaskRequest(
name="load_centre_collect",
params={},
instrument_session=instrument_session,
)
def execute_plan(self, context: BlueskyContext):
udc_default_devices: UDCDefaultDevices = device_composite_from_context(
context, UDCDefaultDevices
)
yield from move_to_udc_default_state(udc_default_devices)etc.
Then we could get rid of the switch statements in SupvervisorRunner.decode_and_execute and InProcessRunner.decode_and_execute and instead have
def decode_and_execute(
self, current_visit: str | None, parameter_list: Sequence[ExecutablePlan]
) -> MsgGenerator:
for parameters in parameter_list:
current_visit = self._run_task_remotely(parameters.get_task_request(instrument_session)) or current_visit
return current_visitor
def decode_and_execute(
self, current_visit: str | None, parameter_list: Sequence[ExecutablePlan]
) -> MsgGenerator:
for parameters in parameter_list:
current_visit = parameters.execute_plan(self.context) or current_visit
return current_visitI might have misunderstood something and there may be good reasons to not do this but I thought it could be worth discussing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InProcessRunner will ultimately go away, once we are running happily in blueapi, we can delete it. The abstraction has been created so that we can temporarily switch between both setups. It is annoying that we have to have code that is very similar in both runner implementations, unfortunately there isn't a nice way around it with one method being a generator function and the other not.
It's probably unlikely we will add more plans for agamemnon to run. What is more likely is commissioning plans but these wouldn't be called by hyperion-supervisor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, thanks for explaining
0671ffd to
da524f4
Compare
… more discriminately Tidy up blueapi configurations Add --watchdog-port option to external callbacks Add --client-config, --supervisor-config options to main hyperion cli Run the supervisor on a different port to blueapi
…ing in supervisor
60a3bdd to
e80df89
Compare
Make type-checking happy
Fixes:
Requires:
Instructions to reviewer on how to test:
Checks for reviewer