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

ENH: Cleaner LEEM triggering definition #1

Merged
merged 2 commits into from Jan 12, 2021

Conversation

johnsinsheimer
Copy link
Contributor

@johnsinsheimer johnsinsheimer commented Sep 5, 2019

This is a revisit of this pull request below, as a cleaner way of using the callback
NSLS-II-ESM-1/profile_collection#6

I ran into this problem again this past week, and Tom suggested using subscribe with run=False, to get around the problem calling the function and finishing before the acquire put is even made.

Previously, there was also some code

def __init__(self, *args, **kwargs):
        def check_if_done(value, old_value, **kwargs):
            st = self.st
            if st is not None:
                if value == 0 and old_value == 1:
                    st._finished()
                    self.st = None

        super().__init__(*args, **kwargs)
        # On a background thread, listen for the server's response.
        self.start_acq.subscribe(check_if_done)
        self.st = None

But I wasn't sure of the purpose of this. Is this to deal with the possibility of the run engine starting when the acquisition in progress? Or why would we need this code in the init?

Copy link
Collaborator

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the update, @johnsinsheimer!

I tend to use the approach applied some time ago at QAS using SubscriptionStatus: https://github.com/NSLS-II-QAS/profile_collection/blob/325105dbe5b5429e84f0a24b5f7efc5cbfd521c6/startup/20-motors.py#L77-L119.

@jklynch jklynch merged commit 2563b99 into NSLS-II-ESM-2:master Jan 12, 2021
mrakitin pushed a commit that referenced this pull request Jan 12, 2021
ENH:  Cleaner LEEM triggering definition
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.

None yet

3 participants