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

hoist DM_WorkflowConnector from BDP #868

Merged
merged 17 commits into from
Jul 8, 2023
Merged

hoist DM_WorkflowConnector from BDP #868

merged 17 commits into from
Jul 8, 2023

Conversation

prjemian
Copy link
Contributor

@prjemian prjemian commented Jul 7, 2023

@prjemian prjemian added this to the 1.6.17 milestone Jul 7, 2023
@prjemian prjemian self-assigned this Jul 7, 2023
@prjemian prjemian changed the title hoise DM_WorkflowConnector from BDP hoist DM_WorkflowConnector from BDP Jul 7, 2023
@prjemian
Copy link
Contributor Author

prjemian commented Jul 7, 2023

This CI failure is not related:

_________________________ test_NXWriter_with_RunEngine _________________________
camera = MyDetector(prefix='ad:', name='camera', read_attrs=['cam', 'hdf1'], configuration_attrs=['cam', 'cam.acquire_period', ... 'cam.image_mode', 'cam.manufacturer', 'cam.model', 'cam.num_exposures', 'cam.num_images', 'cam.trigger_mode', 'hdf1'])
motor = EpicsMotor(prefix='gp:m1', name='motor', settle_time=0.0, timeout=None, read_attrs=['user_readback', 'user_setpoint'], configuration_attrs=['user_offset', 'user_offset_dir', 'velocity', 'acceleration', 'motor_egu'])
    def test_NXWriter_with_RunEngine(camera, motor):
        test_file = pathlib.Path(tempfile.mkdtemp()) / "nxwriter.h5"
        catalog = databroker.temp().v2
    
        nxwriter = NXWriter()
        nxwriter.file_name = str(test_file)
        assert isinstance(nxwriter.file_name, pathlib.Path)
        nxwriter.warn_on_missing_content = False
    
        RE = RunEngine()
        RE.subscribe(catalog.v1.insert)
        RE.subscribe(nxwriter.receiver)
    
        npoints = 3
>       uids = RE(bp.scan([camera], motor, -0.1, 0, npoints))
/home/runner/work/apstools/apstools/apstools/callbacks/tests/test_nxwriter.py:131: 
...
    File "/home/runner/work/apstools/apstools/apstools/callbacks/nexus_writer.py", line 427, in write_instrument
      self.write_streams(bluesky_group)
    File "/home/runner/work/apstools/apstools/apstools/callbacks/nexus_writer.py", line 740, in write_streams
      t_start = t[0]
  IndexError: index 0 is out of bounds for axis 0 with size 0
  
    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED apstools/callbacks/tests/test_nxwriter.py::test_NXWriter_with_RunEngine - RuntimeError: modifying after lock
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
================== 1 failed, 33 passed, 8 warnings in 47.22s ===================

@prjemian
Copy link
Contributor Author

prjemian commented Jul 7, 2023

But this CI failure is related:

=========================== short test summary info ============================
ERROR  - ModuleNotFoundError: No module named 'dm'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
========================= 7 warnings, 1 error in 1.24s =========================

@prjemian
Copy link
Contributor Author

prjemian commented Jul 8, 2023

Resolved the import error here but the NXwriter is still failing the same way:

self = HDF5PluginWithFileStore(prefix='ad:HDF1:', name='camera_hdf1', parent='camera', read_attrs=[], configuration_attrs=[])
key = 'camera_image', timestamp = 1688775892.9098[134](https://github.com/BCDA-APS/apstools/actions/runs/5491611280/jobs/10008372017#step:15:135)
datum_kwargs = {'point_number': 0}
    def generate_datum(self, key, timestamp, datum_kwargs):
        "Generate a uid and cache it with its key for later insertion."
    
        datum_kwargs = datum_kwargs or {}
        if self._locked_key_list:
            if key not in self._datum_uids:
>               raise RuntimeError("modifying after lock")
E               RuntimeError: modifying after lock
/home/runner/micromamba-root/envs/anaconda-test-env-py-3.10/lib/python3.10/site-packages/ophyd/areadetector/filestore_mixins.py:342: RuntimeError

@prjemian
Copy link
Contributor Author

prjemian commented Jul 8, 2023

Might be due to bluesky 1.11.0. Add requirement and test again.

As @tacaswell said in Slack:

We should consider yanking bluesky 1.11 . "pre-declare" is having way more side effects that we (I) expected

@prjemian
Copy link
Contributor Author

prjemian commented Jul 8, 2023

Need to add some unit tests, at least to get code coverage to be higher. Testing will be a challenge and incomplete in CI since the APS DM system is not available.

@prjemian
Copy link
Contributor Author

prjemian commented Jul 8, 2023

Also note this advice in the CI:

Install & cache databroker catalogs (3.11)
This action is deprecated and no longer maintained. Please use mamba-org/setup-micromamba instead. See https://github.com/mamba-org/provision-with-micromamba#migration-to-setup-micromamba for a migration guide.

@prjemian
Copy link
Contributor Author

prjemian commented Jul 8, 2023

Code coverage drops with this work since some DM features cannot be tested outside the APS subnet.

@prjemian prjemian merged commit 6af19c8 into main Jul 8, 2023
8 checks passed
@prjemian prjemian deleted the 851-DM_Workflow-device branch July 8, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hoist DM_Workflow() device
1 participant