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

Add support DM DAQ #912

Closed
prjemian opened this issue Jan 20, 2024 · 11 comments · Fixed by #938
Closed

Add support DM DAQ #912

prjemian opened this issue Jan 20, 2024 · 11 comments · Fixed by #938
Assignees
Milestone

Comments

@prjemian
Copy link
Contributor

The APS Data Management has DAQ process that watch a file directory (and its subdirectories) for new files or modifications to existing ones. A DAQ will copy such changes from the watched directory to a destination directory. In addition to watching, a DAQ can launch a DM workflow.

Add support for DM's DAQs.

@prjemian prjemian added this to the 1.6.19 milestone Jan 20, 2024
@prjemian prjemian self-assigned this Jan 20, 2024
@prjemian
Copy link
Contributor Author

Hannah Parraga suggests these steps:

  1. check for existing daq
  2. if daq, stop daq
  3. start daq with workflow args from user
  4. collect data
  5. poll proc service until workflow has started for given file
  6. poll proc service until workflow has finished
  7. repeat from step 3 or continue steps 3-5 in parallel

@prjemian
Copy link
Contributor Author

A DM DAQ should be configured for each data directory (which includes all of its subdirectories) that will store data files from the experiment. It may be necessary to create a new DAQ api object for each separate workstation+filesystem combination. For example, the HEDM group has a 4-panel detector called Hydra at station 1-ID-E. Each of the panels is a separate detector, each with its own workstation and filesystem. Four DAQs would be created, with an api object for each that includes the workstation and data directory.

Once the DAQ is created, must keep track of its id and api object. Thinking that a Python dict with detector name (str) as key and a new DaqManager class here to remember important information such as id, api, workstation, and dataDirectory. This is common setup for any use. Make a devices structure here.

@prjemian
Copy link
Contributor Author

Code for today's demo created an api object with the details for the workstation on which bluesky runs. That info comes from the file that activates the dm conda environment.

@prjemian
Copy link
Contributor Author

The library code in apstools should not know about any local instrument iconfig dictionary. It should have keyword arguments that default to the values supplied by the activation script (mentioned above).

@prjemian
Copy link
Contributor Author

Need to learn how to get the api object needed for each of the Hydra's detector workstations. This was used for today's demo:

dm_source_environ()
api = DaqApiFactory.getExperimentDaqApi()

where dm_source_environ() sets the DM environment variables in this Python session.

@prjemian
Copy link
Contributor Author

prjemian commented Mar 12, 2024

Q: How to get workstation into this request for an api object? DaqApiFactory.getExperimentDaqApi()

docs: https://git.aps.anl.gov/DM/dm-docs/-/wikis/DM/Beamline-Services/API-Reference/DAQ-Service

@prjemian
Copy link
Contributor Author

Meanwhile, I'm asking the code for its docstrings. Starting from api? and working my way along. There's DM_DAQ_WEB_SERVICE_URL for example. Checking that its url parameter can be passed to DaqApiFactory.getExperimentDaqApi() somehow.

@prjemian
Copy link
Contributor Author

One way is to bypass the classmethod and create it from a known URL, such as:

        from dm.daq_web_service.api.experimentDaqApi import ExperimentDaqApi
        # (username, password, url) = cls.getConfiguration()
        (username, password, url) = bluesky_gets_the_right_tuple_here()
        api = ExperimentDaqApi(username, password, url)
        return api

@prjemian
Copy link
Contributor Author

Or

from dm.common.utility.configurationManager import ConfigurationManager
cm = ConfigurationManager.getInstance()
cm.getUser()
cm.getPassword()

@prjemian
Copy link
Contributor Author

Comments starting from #912 (comment) represent an upgrade to the support demonstrated by the BDP demo this week. Hoist the support from the demo first, then upgrade in a new issue (for the next milestone).

@prjemian
Copy link
Contributor Author

The content to be hoisted from the BDP demo this week is suitable as a usage example, for documentation.

prjemian added a commit that referenced this issue Mar 14, 2024
MDecarabas pushed a commit that referenced this issue Apr 12, 2024
MDecarabas added a commit that referenced this issue Apr 12, 2024
* Added edge_align plan for beam edge alignment

* Need to find a better way to check signal quality.

* Formatted using ruff

* small formatting changes

* removed unused stats import

* removed another unused import

* Added a check function that yields correct results

* intermediate commit saving progress

* finished try/except when bad signal is detected

* Fixed formatting

* Added scipy to environment.yaml & requirements.txt

* CI #909 switch to 'ruff'

* DOC #909 update release notes

* MNT #909 revise per 'ruff check'

* CI #909 update

* Bump davidslusser/actions_python_ruff from 1.0.0 to 1.0.1

Bumps [davidslusser/actions_python_ruff](https://github.com/davidslusser/actions_python_ruff) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/davidslusser/actions_python_ruff/releases)
- [Commits](davidslusser/actions_python_ruff@v1.0.0...v1.0.1)

---
updated-dependencies:
- dependency-name: davidslusser/actions_python_ruff
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* MNT #872 hoist from MPE devices

* TST #872 adjust for new hoist

* MNT #872

* MNT #872 refactor

* MNT #872 hoist utils

* DOC #912

* ENV #938 bump the minimum requirement

* DOC #932 update relase notes

* DOC #938 contribution from @sveseli

* MNT #914 setup.py --> pyproject.toml

* DOC #921 copyright year

* MNT #914

* Added edge_align function for beam edge alignment

* added scipy to pyproject.toml

* CI #909 switch to 'ruff'

* DOC badge

* DOC badge

* DOC #940 example scans with sscan record

* DOC #940 it's only a word ...

* DOC #940

* DOC #940 it's a demo, actually

* DOC #940

* DOC #940 convert the blocking call to st.wait()

* DOC #940 per review

* DOC #940 per review

* DOC #940 proofreading

* DOC #940 per review, remove the section with the polling loop

* DOC #940 new title

* DOC #940 more proofing

* DOC #940 clarify the default sscan record array size of 1,000

* DOC #940 refactor to polling loop. Show the recommended style in a details section.

* DOC #940

* Added put_complete=True to sensitivity value and unit for the SRS-570 Pre-amp.

* Added a test for the sensitivity_unit put_complete, and removed the put_complete from sensitivity_value.

* CI #955 move requirements file

* MNT #955 sphinx config

* DOC #955 re-arrange

* DOC #955 apply to lower-level pages

* DOC #955 add docs upload

* CI #955

* CI #955

* CI #955 wip

* CI #955

* CI #955

* DOC #917 release note

* DOC #957 merge overview into home page

* DOC #955

* DOC #955

* DOC #955

* DOC #955

* Added edge_align function for beam edge alignment

* Added edge_align function for beam edge alignment

* Added edge_align function for beam edge alignment

* DOC #909 update release notes

* DOC #932 update relase notes

* Added edge_align function for beam edge alignment

* CI #909 switch to 'ruff'

* DOC #955

* Fixed merge issue

* fixed unused import

* change for tests to pass

* Formatting changes

* Fixed repeated section

* Small formatting changes

* Small syntax change

* Added toolz & scipy to conf.py

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Codrea <ecodrea@nefarian.xray.aps.anl.gov>
Co-authored-by: Pete R Jemian <prjemian@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pete R Jemian <prjemian@users.noreply.github.com>
Co-authored-by: Mark Wolfman <canismarko@gmail.com>
@prjemian prjemian reopened this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant