Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Tag log messages with the UID of the current outer run #1210

Merged
merged 6 commits into from
Mar 7, 2024

Conversation

d-perl
Copy link
Contributor

@d-perl d-perl commented Mar 1, 2024

Fixes #1132

Adds a callback to set a tag on log messages for the current run based on a metadata field, using the bluesky UID for the outer run of each experiment

To test:

  1. Run tests

@d-perl d-perl requested a review from olliesilvester March 5, 2024 12:05
Copy link
Contributor

@noemifrisina noemifrisina left a comment

Choose a reason for hiding this comment

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

Looks okay, tests pass.

@d-perl d-perl merged commit 98cfa2d into main Mar 7, 2024
6 checks passed
@d-perl d-perl deleted the 1132_run_uid_filter branch March 7, 2024 13:45
Copy link
Collaborator

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Do we really need SET_LOG_UID_TAG? Can't we in the callback log with the outermost id?

class LogUidTaggingCallback(CallbackBase):
    def __init__(self) -> None:
        self.run_uid = None

    def start(self, doc: RunStart):
        if self.run_uid is None:
            self.run_uid = doc.get("uid")
            run_uid_filter.run_uid = self.run_uid

    def stop(self, doc: RunStop):
        if doc.get("run_start") == self.run_uid:
            self.run_uid = None
            run_uid_filter.run_uid = None

I don't like that the plans now have to have knowledge of what the callbacks are doing re logging

@d-perl
Copy link
Contributor Author

d-perl commented Mar 7, 2024

@DominicOram Doh, of course. Supplementary PR here: #1233

@DominicOram
Copy link
Collaborator

Thank you!

olliesilvester pushed a commit to olliesilvester/mx-bluesky that referenced this pull request Aug 23, 2024
…Source/1132_run_uid_filter

Tag log messages with the UID of the current outer run
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External callbacks break DCGID log filter
3 participants