Skip to content

Conversation

@SimonHeybrock
Copy link
Member

@SimonHeybrock SimonHeybrock commented Mar 24, 2025

This adds a mechanism for (re)defining the stream processors (wrapping workflows) used to reduce detector data at runtime. In this first iteration this only supports predefined workflows with no parameters, but in principle the mechanism can be extended for this.

Note: Will move to a (hopefully) better command/config mechanism in a follow-up. Details of ConfigHandler and the action-registration mechanism will thus change.

)
self._logger.info("%s using accumulator %s", key.source_name, accumulator)

if (processor := self._processors.get(key.source_name)) is not None:
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of here and below moved to workflow_manager.py with little or no change.

Base automatically changed from config-handler to main March 26, 2025 10:57
@SimonHeybrock SimonHeybrock moved this from In progress to Selected in Development Board Mar 26, 2025
@github-project-automation github-project-automation bot moved this to In progress in Development Board Mar 26, 2025
@SimonHeybrock SimonHeybrock requested a review from a team March 31, 2025 08:28
[
_to_da00_variable(name, var)
for name, var in da.coords.items()
if var.shape == var.values.shape # vector3 etc. not supported currently
Copy link
Member

Choose a reason for hiding this comment

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

Should we somehow log if some coordinates are dropped...? Or do we not care?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't care for now, but we have to agree with ECDC on more details on the da00 results, i.e., what should be included.

def register_action(
self,
key: str,
callback: callable,
Copy link
Member

Choose a reason for hiding this comment

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

callback sounds like something to be done after the actual action though.
How about just action...?

And I think callable is a function, not a type. (at least my linter complains)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, and I should specify the signature. Ok if I address this in the follow-up #354, where the signature changes?

Comment on lines +80 to +92
updated[key] = value
except Exception: # noqa: PERF203
self._logger.exception('Error processing config message:')
# Delay action calls until all messages are processed to reduce triggering
# multiple calls for the same key in case of multiple messages with same key.
for key, value in updated.items():
for action in self._actions.get(key, []):
try:
action(value)
except KeyError: # noqa: PERF203
self._logger.exception(
'Error processing config action for %s:', key
)
Copy link
Member

Choose a reason for hiding this comment

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

Not so important, but do we want to call actions only when it changes...? We could quickly check if the values are actually changed and then add it to updated dictionary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure. Currently it is actually useful, e.g., to recreate workflow (of the same name).

Copy link
Member

Choose a reason for hiding this comment

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

It's fine if it's expected to be handled even if it has same value.

@SimonHeybrock SimonHeybrock merged commit 340f346 into main Mar 31, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from Selected to Done in Development Board Mar 31, 2025
@SimonHeybrock SimonHeybrock deleted the reduction-config branch March 31, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants