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

update to bps.collect_while_completeing #536

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ZohebShaikh
Copy link
Contributor

No description provided.

@ZohebShaikh ZohebShaikh linked an issue Aug 20, 2024 that may be closed by this pull request
@ZohebShaikh ZohebShaikh force-pushed the 329-investigate-hanging-collect_while_completing-planstub branch 4 times, most recently from 565b629 to cbe0434 Compare August 23, 2024 09:47
@ZohebShaikh ZohebShaikh changed the title initial commit update to bps.collect_while_completeing Aug 23, 2024
@@ -16,7 +16,7 @@ dependencies = [
"numpy<2.0.0",
"packaging",
"pint",
"bluesky>=1.13.0a3",
"bluesky>=1.13.0a4",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have change this to make sure that we are at version the hardware test was conducted

@ZohebShaikh ZohebShaikh force-pushed the 329-investigate-hanging-collect_while_completing-planstub branch from 9703a49 to 5ddf953 Compare August 28, 2024 11:57
@ZohebShaikh ZohebShaikh marked this pull request as ready for review August 28, 2024 11:57
@ZohebShaikh ZohebShaikh force-pushed the 329-investigate-hanging-collect_while_completing-planstub branch from 5ddf953 to 923490c Compare August 28, 2024 11:57
@@ -129,17 +127,12 @@ def fly_and_collect(
done = False
while not done:
try:
yield from bps.wait(group=group, timeout=0.5)
yield from bps.wait(group=group, timeout=0.5, move_on=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a new global constant for readability:

# Collect every 0.5 seconds even if the flyscan is still completing
_SECONDS_TO_FORCE_COLLECT_AFTER = 0.5
Suggested change
yield from bps.wait(group=group, timeout=0.5, move_on=True)
yield from bps.wait(
group=group,
timeout=_SECONDS_TO_FORCE_COLLECT_AFTER,
move_on=True
)

@@ -129,17 +127,12 @@ def fly_and_collect(
done = False
while not done:
try:
yield from bps.wait(group=group, timeout=0.5)
yield from bps.wait(group=group, timeout=0.5, move_on=True)
except TimeoutError:
Copy link
Contributor

@evalott100 evalott100 Aug 29, 2024

Choose a reason for hiding this comment

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

I actually don't think we need to do this now. It seems timeout is only raised if move_on=False I think we can change this whole thing to:

done = False
while not done:
    done = (
        yield from bps.wait(
            group=group,
            timeout=_SECONDS_TO_FORCE_COLLECT_AFTER,
            move_on=True
         )
    )
    yield from bps.collect(*detectors, name=stream_name)

Since done is returned here:
https://github.com/bluesky/bluesky/blob/978995b69c00cc0b9bef5103bdb31b665a6fbed9/src/bluesky/run_engine.py#L2379

@ZohebShaikh ZohebShaikh force-pushed the 329-investigate-hanging-collect_while_completing-planstub branch from 923490c to db41573 Compare August 30, 2024 08:42
@ZohebShaikh ZohebShaikh force-pushed the 329-investigate-hanging-collect_while_completing-planstub branch from db41573 to be29b8e Compare August 30, 2024 08:44
return_payload=False,
name=stream_name,
done = yield from bps.wait(
group=group, timeout=_SECONDS_TO_FORCE_COLLECT_AFTER, move_on=True
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add flush_period: float = 0.5 to the function parameters, then use that rather than a global

Suggested change
group=group, timeout=_SECONDS_TO_FORCE_COLLECT_AFTER, move_on=True
group=group, timeout=flush_period, move_on=True

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.

Investigate hanging collect_while_completing planstub
3 participants