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

Investigate hanging collect_while_completing planstub #329

Open
abbiemery opened this issue May 22, 2024 · 2 comments · May be fixed by #536
Open

Investigate hanging collect_while_completing planstub #329

abbiemery opened this issue May 22, 2024 · 2 comments · May be fixed by #536
Assignees
Milestone

Comments

@abbiemery
Copy link
Collaborator

In the time_resolved_fly_and_collect_with_static_seq_table plan stub I have had to change the collect_while_completing stub call back to the code used for the i22 experiment as the new code just hung.

An issue that was raised back then has not been addressed but i'm not entirely convinced this is the full problem. The issue and following discussion is here bluesky/bluesky#1630.

This needs investigating.

@abbiemery abbiemery added this to the 0.6 milestone Jun 11, 2024
@coretl coretl removed this from the 0.6 milestone Jul 3, 2024
@coretl
Copy link
Collaborator

coretl commented Jul 11, 2024

Reproduced this on P45

@ZohebShaikh
Copy link
Contributor

It seems to be working with the latest version of ophyd async main d7f0748 with the following change

The plan used to test this was

from pathlib import Path
from pprint import pprint

from bluesky.run_engine import RunEngine
from bluesky.plan_stubs import close_run, open_run, prepare, stage_all, unstage_all

import bluesky.preprocessors as bpp
from ophyd_async.core import (
    DeviceCollector,
    StandardFlyer,
    StaticPathProvider,
)
from ophyd_async.core._detector import DetectorTrigger, TriggerInfo
from ophyd_async.core._providers import StaticFilenameProvider
from ophyd_async.epics.adaravis import AravisDetector
from ophyd_async.fastcs.panda import (
    DatasetTable,
    HDFPanda,
    StaticSeqTableTriggerLogic,
)
from ophyd_async.plan_stubs import fly_and_collect
from ophyd_async.plan_stubs._fly import prepare_static_seq_table_flyer_and_detectors_with_same_trigger

RE = RunEngine()
fp = StaticFilenameProvider("ophyd_async_tests")
path_provider = StaticPathProvider(fp, Path("/dls/p45/data/2024/cm37283-2"))

with DeviceCollector():
    panda_1 = HDFPanda(
        "BL45P-MO-PANDA-01:",
        path_provider=path_provider,
    )
    panda_2 = HDFPanda(
        "BL45P-MO-PANDA-02:",
        path_provider=path_provider,
    )
    diff = AravisDetector(
        "BL45P-EA-DIFF-01:",
        path_provider=path_provider,
        drv_suffix="DET:",
        hdf_suffix="HDF5:",
    )

chosen_panda = panda_1
trigger_logic = StaticSeqTableTriggerLogic(chosen_panda.seq[1])
flyer = StandardFlyer(
    trigger_logic,
    configuration_signals=[],
    name="flyer",
)


def plan():
    @bpp.stage_decorator(devices=[diff, chosen_panda, flyer])
    @bpp.run_decorator()
    def inner():
        yield from prepare_static_seq_table_flyer_and_detectors_with_same_trigger(flyer,[diff],number_of_frames=15,exposure=0.1,shutter_time=0.05)
        yield from fly_and_collect(
            stream_name="primary",
            flyer=flyer,
            detectors=[diff],
        )
    yield from inner()


RE(plan(), lambda name, doc: pprint({"name": name, "doc": doc}))

(.venv) [ckk43848@p45-ws001 ophyd-async]$ ipython -i seq_test.py 
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.26.0 -- An enhanced Interactive Python. Type '?' for help.
{'doc': {'plan_name': 'plan',
         'plan_type': 'generator',
         'scan_id': 1,
         'time': 1724338720.5984726,
         'uid': '2fe63d78-3119-47c7-bd03-aab150c745d4',
         'versions': {'bluesky': '1.13.0a4', 'ophyd': '1.9.0'}},
 'name': 'start'}
{'doc': {'configuration': {'diff': {'data': {'diff-drv-acquire_time': 0.100003},
                                    'data_keys': {'diff-drv-acquire_time': {'dtype': 'number',
                                                                            'dtype_numpy': '<f8',
                                                                            'limits': {'alarm': {'high': None,
                                                                                                 'low': None},
                                                                                       'control': {'high': 0.0,
                                                                                                   'low': 0.0},
                                                                                       'display': {'high': 0.0,
                                                                                                   'low': 0.0},
                                                                                       'warning': {'high': None,
                                                                                                   'low': None}},
                                                                            'precision': 3,
                                                                            'shape': [],
                                                                            'source': 'ca://BL45P-EA-DIFF-01:DET:AcquireTime_RBV',
                                                                            'units': ''}},
                                    'timestamps': {'diff-drv-acquire_time': 1724338720.626139}}},
         'data_keys': {'diff': {'dtype': 'array',
                                'dtype_numpy': '|u1',
                                'external': 'STREAM:',
                                'object_name': 'diff',
                                'shape': (1216, 1936),
                                'source': 'ca://BL45P-EA-DIFF-01:HDF5:FullFileName_RBV'}},
         'hints': {'diff': {'fields': ['diff']}},
         'name': 'primary',
         'object_keys': {'diff': ['diff']},
         'run_start': '2fe63d78-3119-47c7-bd03-aab150c745d4',
         'time': 1724338720.8852792,
         'uid': 'e9918279-1c9d-4b81-989a-43a8ddb0f739'},
 'name': 'descriptor'}
{'doc': {'data_key': 'diff',
         'mimetype': 'application/x-hdf5',
         'parameters': {'dataset': '/entry/data/data',
                        'multiplier': 1,
                        'swmr': False},
         'run_start': '2fe63d78-3119-47c7-bd03-aab150c745d4',
         'uid': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca',
         'uri': 'file://localhost/dls/p45/data/2024/cm37283-2/ophyd_async_tests.h5'},
 'name': 'stream_resource'}
{'doc': {'descriptor': 'e9918279-1c9d-4b81-989a-43a8ddb0f739',
         'indices': {'start': 0, 'stop': 4},
         'seq_nums': {'start': 1, 'stop': 5},
         'stream_resource': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca',
         'uid': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca/0'},
 'name': 'stream_datum'}
{'doc': {'descriptor': 'e9918279-1c9d-4b81-989a-43a8ddb0f739',
         'indices': {'start': 4, 'stop': 9},
         'seq_nums': {'start': 5, 'stop': 10},
         'stream_resource': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca',
         'uid': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca/1'},
 'name': 'stream_datum'}
{'doc': {'descriptor': 'e9918279-1c9d-4b81-989a-43a8ddb0f739',
         'indices': {'start': 9, 'stop': 14},
         'seq_nums': {'start': 10, 'stop': 15},
         'stream_resource': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca',
         'uid': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca/2'},
 'name': 'stream_datum'}
{'doc': {'descriptor': 'e9918279-1c9d-4b81-989a-43a8ddb0f739',
         'indices': {'start': 14, 'stop': 15},
         'seq_nums': {'start': 15, 'stop': 16},
         'stream_resource': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca',
         'uid': 'b0f85ff3-2d25-4d68-b4d8-e3b3da1cdbca/3'},
 'name': 'stream_datum'}
{'doc': {'exit_status': 'success',
         'num_events': {'primary': 15},
         'reason': '',
         'run_start': '2fe63d78-3119-47c7-bd03-aab150c745d4',
         'time': 1724338722.5455422,
         'uid': '31366982-b266-4953-81e4-fbb7bf14a7f1'},
 'name': 'stop'}

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 a pull request may close this issue.

3 participants