apsbits 1.0.3__tar.gz → 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. {apsbits-1.0.3 → apsbits-1.0.4}/HISTORY.rst +35 -2
  2. {apsbits-1.0.3/apsbits.egg-info → apsbits-1.0.4}/PKG-INFO +1 -1
  3. {apsbits-1.0.3 → apsbits-1.0.4/apsbits.egg-info}/PKG-INFO +1 -1
  4. {apsbits-1.0.3 → apsbits-1.0.4}/apsbits.egg-info/SOURCES.txt +5 -1
  5. apsbits-1.0.4/docs/source/guides/dm.rst +88 -0
  6. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/index.rst +1 -0
  7. apsbits-1.0.4/docs/source/guides/logging.rst +283 -0
  8. apsbits-1.0.4/docs/source/guides/startup.rst +167 -0
  9. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/_version.py +2 -2
  10. apsbits-1.0.4/src/apsbits/demo_instrument/configs/extra_logging.yml +40 -0
  11. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/startup.py +31 -13
  12. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/aps_functions.py +10 -2
  13. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/config_loaders.py +0 -1
  14. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/controls_setup.py +0 -2
  15. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/helper_functions.py +0 -1
  16. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/logging_setup.py +74 -22
  17. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/metadata.py +0 -1
  18. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/sim_creator.py +0 -1
  19. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/stored_dict.py +0 -1
  20. {apsbits-1.0.3 → apsbits-1.0.4}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  21. {apsbits-1.0.3 → apsbits-1.0.4}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  22. {apsbits-1.0.3 → apsbits-1.0.4}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  23. {apsbits-1.0.3 → apsbits-1.0.4}/.github/ISSUE_TEMPLATE/other.md +0 -0
  24. {apsbits-1.0.3 → apsbits-1.0.4}/.github/ISSUE_TEMPLATE/question-issue-template.md +0 -0
  25. {apsbits-1.0.3 → apsbits-1.0.4}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  26. {apsbits-1.0.3 → apsbits-1.0.4}/.github/dependabot.yml +0 -0
  27. {apsbits-1.0.3 → apsbits-1.0.4}/.github/workflows/code.yml +0 -0
  28. {apsbits-1.0.3 → apsbits-1.0.4}/.github/workflows/docs.yml +0 -0
  29. {apsbits-1.0.3 → apsbits-1.0.4}/.github/workflows/pypi.yml +0 -0
  30. {apsbits-1.0.3 → apsbits-1.0.4}/.gitignore +0 -0
  31. {apsbits-1.0.3 → apsbits-1.0.4}/.pre-commit-config.yaml +0 -0
  32. {apsbits-1.0.3 → apsbits-1.0.4}/LICENSE +0 -0
  33. {apsbits-1.0.3 → apsbits-1.0.4}/README.md +0 -0
  34. {apsbits-1.0.3 → apsbits-1.0.4}/apsbits.egg-info/dependency_links.txt +0 -0
  35. {apsbits-1.0.3 → apsbits-1.0.4}/apsbits.egg-info/entry_points.txt +0 -0
  36. {apsbits-1.0.3 → apsbits-1.0.4}/apsbits.egg-info/requires.txt +0 -0
  37. {apsbits-1.0.3 → apsbits-1.0.4}/apsbits.egg-info/top_level.txt +0 -0
  38. {apsbits-1.0.3 → apsbits-1.0.4}/docs/Makefile +0 -0
  39. {apsbits-1.0.3 → apsbits-1.0.4}/docs/make.bat +0 -0
  40. {apsbits-1.0.3 → apsbits-1.0.4}/docs/resources/create-repository-name.webp +0 -0
  41. {apsbits-1.0.3 → apsbits-1.0.4}/docs/resources/create-repository-owner.webp +0 -0
  42. {apsbits-1.0.3 → apsbits-1.0.4}/docs/resources/demo.ipynb +0 -0
  43. {apsbits-1.0.3 → apsbits-1.0.4}/docs/resources/use-this-template-button.webp +0 -0
  44. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/_static/.gitkeep +0 -0
  45. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/api.rst +0 -0
  46. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/core.rst +0 -0
  47. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/demo_instrument.rst +0 -0
  48. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/demo_qserver.rst +0 -0
  49. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.core.best_effort_init.rst +0 -0
  50. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.core.catalog_init.rst +0 -0
  51. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.core.run_engine_init.rst +0 -0
  52. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.callbacks.nexus_data_file_writer.rst +0 -0
  53. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.callbacks.rst +0 -0
  54. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.callbacks.spec_data_file_writer.rst +0 -0
  55. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.configs.rst +0 -0
  56. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.devices.rst +0 -0
  57. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.plans.dm_plans.rst +0 -0
  58. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.plans.rst +0 -0
  59. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.plans.sim_plans.rst +0 -0
  60. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.rst +0 -0
  61. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_instrument.startup.rst +0 -0
  62. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.demo_qserver.rst +0 -0
  63. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.utils.aps_functions.rst +0 -0
  64. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.utils.config_loaders.rst +0 -0
  65. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.utils.controls_setup.rst +0 -0
  66. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.utils.helper_functions.rst +0 -0
  67. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.utils.logging_setup.rst +0 -0
  68. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.utils.metadata.rst +0 -0
  69. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/generated/apsbits.utils.stored_dict.rst +0 -0
  70. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/index.rst +0 -0
  71. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/api/utils.rst +0 -0
  72. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/bits_overview.rst +0 -0
  73. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/conf.py +0 -0
  74. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/deprecated/console.rst +0 -0
  75. {apsbits-1.0.3/docs/source/guides → apsbits-1.0.4/docs/source/deprecated}/dm.md +0 -0
  76. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/deprecated/logging_config.rst +0 -0
  77. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/deprecated/notebook.rst +0 -0
  78. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/deprecated/script.rst +0 -0
  79. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/creating_devices.rst +0 -0
  80. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/creating_instrument.rst +0 -0
  81. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/developing_bits.rst +0 -0
  82. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/qserver.rst +0 -0
  83. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/qserver_service.rst +0 -0
  84. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/sessions.rst +0 -0
  85. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/setting_iconfig.rst +0 -0
  86. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/guides/template_creation.rst +0 -0
  87. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/history.rst +0 -0
  88. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/index.rst +0 -0
  89. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/install.rst +0 -0
  90. {apsbits-1.0.3 → apsbits-1.0.4}/docs/source/license.rst +0 -0
  91. {apsbits-1.0.3 → apsbits-1.0.4}/pyproject.toml +0 -0
  92. {apsbits-1.0.3 → apsbits-1.0.4}/setup.cfg +0 -0
  93. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/__init__.py +0 -0
  94. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/api/__init__.py +0 -0
  95. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/api/create_new_instrument.py +0 -0
  96. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/api/delete_instrument.py +0 -0
  97. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/api/run_instrument.py +0 -0
  98. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/configs/logging.yml +0 -0
  99. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/core/__init__.py +0 -0
  100. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/core/best_effort_init.py +0 -0
  101. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/core/catalog_init.py +0 -0
  102. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/core/instrument_init.py +0 -0
  103. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/core/run_engine_init.py +0 -0
  104. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/README.md +0 -0
  105. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/__init__.py +0 -0
  106. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/callbacks/__init__.py +0 -0
  107. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/callbacks/nexus_data_file_writer.py +0 -0
  108. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/callbacks/spec_data_file_writer.py +0 -0
  109. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/configs/__init__.py +0 -0
  110. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/configs/devices.yml +0 -0
  111. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/configs/devices_aps_only.yml +0 -0
  112. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/configs/iconfig.yml +0 -0
  113. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/devices/__init__.py +0 -0
  114. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/plans/__init__.py +0 -0
  115. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/plans/dm_plans.py +0 -0
  116. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/plans/sim_plans.py +0 -0
  117. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/suspenders/__init__.py +0 -0
  118. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_instrument/utils/__init__.py +0 -0
  119. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_qserver/qs-config.yml +0 -0
  120. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_qserver/qs_host.sh +0 -0
  121. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/demo_qserver/user_group_permissions.yaml +0 -0
  122. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/__init__.py +0 -0
  123. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/conftest.py +0 -0
  124. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/test_config.py +0 -0
  125. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/test_delete_instrument.py +0 -0
  126. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/test_device_factories.py +0 -0
  127. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/test_general.py +0 -0
  128. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/test_make_devices.py +0 -0
  129. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/test_run_instrument.py +0 -0
  130. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/tests/test_stored_dict.py +0 -0
  131. {apsbits-1.0.3 → apsbits-1.0.4}/src/apsbits/utils/__init__.py +0 -0
@@ -30,10 +30,43 @@ describe future plans.
30
30
  .. Coming release content can be gathered here.
31
31
  Some people object to publishing unreleased changes.
32
32
 
33
- 1.0.2
33
+ 1.0.4
34
34
  #####
35
35
 
36
- release expected 2025-Q2
36
+ release expected ?
37
+
38
+ 1.0.3
39
+ #####
40
+
41
+ released 2025-05-01
42
+
43
+ Enhancements
44
+ ---------------
45
+
46
+ * arguments for run engine
47
+
48
+ Fixes
49
+ -----
50
+
51
+ * 'make_devices()' from yaml file
52
+
53
+ Maintenance
54
+ ---------------
55
+
56
+ * Clean backend
57
+
58
+ 1.0.2
59
+ #####
60
+
61
+ released 2025-04-18
62
+
63
+ Maintenance
64
+ ---------------
65
+
66
+ * Add a release history file
67
+ * Documentation overhaul1
68
+ * adding install docs given new workflow
69
+ * Feature/API_functionalities and Makedevices
37
70
 
38
71
  1.0.1
39
72
  #####
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apsbits
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Model of a Bluesky Data Acquisition Instrument in console, notebook, & queueserver.
5
5
  Author-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
6
6
  Maintainer-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apsbits
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Model of a Bluesky Data Acquisition Instrument in console, notebook, & queueserver.
5
5
  Author-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
6
6
  Maintainer-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
@@ -61,18 +61,21 @@ docs/source/api/generated/apsbits.utils.logging_setup.rst
61
61
  docs/source/api/generated/apsbits.utils.metadata.rst
62
62
  docs/source/api/generated/apsbits.utils.stored_dict.rst
63
63
  docs/source/deprecated/console.rst
64
+ docs/source/deprecated/dm.md
64
65
  docs/source/deprecated/logging_config.rst
65
66
  docs/source/deprecated/notebook.rst
66
67
  docs/source/deprecated/script.rst
67
68
  docs/source/guides/creating_devices.rst
68
69
  docs/source/guides/creating_instrument.rst
69
70
  docs/source/guides/developing_bits.rst
70
- docs/source/guides/dm.md
71
+ docs/source/guides/dm.rst
71
72
  docs/source/guides/index.rst
73
+ docs/source/guides/logging.rst
72
74
  docs/source/guides/qserver.rst
73
75
  docs/source/guides/qserver_service.rst
74
76
  docs/source/guides/sessions.rst
75
77
  docs/source/guides/setting_iconfig.rst
78
+ docs/source/guides/startup.rst
76
79
  docs/source/guides/template_creation.rst
77
80
  src/apsbits/__init__.py
78
81
  src/apsbits/_version.py
@@ -95,6 +98,7 @@ src/apsbits/demo_instrument/callbacks/spec_data_file_writer.py
95
98
  src/apsbits/demo_instrument/configs/__init__.py
96
99
  src/apsbits/demo_instrument/configs/devices.yml
97
100
  src/apsbits/demo_instrument/configs/devices_aps_only.yml
101
+ src/apsbits/demo_instrument/configs/extra_logging.yml
98
102
  src/apsbits/demo_instrument/configs/iconfig.yml
99
103
  src/apsbits/demo_instrument/devices/__init__.py
100
104
  src/apsbits/demo_instrument/plans/__init__.py
@@ -0,0 +1,88 @@
1
+ Guide: APS Data Management Plans
2
+ ==============================
3
+
4
+ Provides a few examples of the plans that interact with APS Data Management (DM)
5
+ tools.
6
+
7
+ Required
8
+ --------
9
+
10
+ The DM tools rely on the existence of a set of environment variables that define various aspects of the DM system.
11
+
12
+ Show any DM jobs still processing
13
+ --------------------------------
14
+
15
+ Use the ``dm_list_processing_jobs()`` plan stub to show DM any workflow jobs that
16
+ are still running or pending. These are installed by calling
17
+ ``aps_dm_setup(DM_SETUP_SCRIPT)`` in each session before you call any other DM
18
+ code.
19
+
20
+ Here, ``DM_SETUP_SCRIPT`` is the full path to the bash setup shell script provided
21
+ by DM for this account. The exact path can be different for some installations.
22
+ If unsure, contact the APS DM team for advice.
23
+
24
+ Note: ``aps_dm_setup`` is not a bluesky plan stub. Call it as a standard Python
25
+ function.
26
+
27
+ Here's an example:
28
+
29
+ .. code-block:: python
30
+
31
+ from apsbits.utils.aps_functions import aps_dm_setup
32
+
33
+ aps_dm_setup("/home/dm/etc/dm.setup.sh")
34
+
35
+ Start a new workflow job
36
+ -----------------------
37
+
38
+ The ``dm_kickoff_workflow()`` plan can be used to start a DM workflow job. See
39
+ the source code for additional options (such as how often to report progress and
40
+ how to wait for the workflow to finish before the bluesky plan proceeds).
41
+
42
+ .. code-block:: python
43
+
44
+ from new_instrument.plans.dm_plans import dm_kickoff_workflow
45
+
46
+ # Use the run with `uid` from the catalog `cat`.
47
+ run = cat[uid]
48
+
49
+ # Create the dictionary of arguments for the chosen workflow.
50
+ argsDict = {
51
+ "filePath": "path/to/data/file.mda", # example
52
+ "experimentName": "testing-2024-11", # example
53
+ "workflowName": "processing", # existing workflow name
54
+ # ... any other items required by the workflow
55
+ }
56
+
57
+ # Start the workflow job from the command line:
58
+ RE(dm_kickoff_workflow(run, argsDict))
59
+
60
+ In a plan, replace the call to ``RE(...)`` with ``yield from ...``, such as:
61
+
62
+ .. code-block:: python
63
+
64
+ def a_plan():
65
+ # earlier steps
66
+ yield from dm_kickoff_workflow(run, argsDict)
67
+ # later steps
68
+
69
+ Start a new workflow job (Low-level)
70
+ ----------------------------------
71
+
72
+ If the ``dm_kickoff_workflow()`` plan stub does more than you want, you might consider the ``dm_submit_workflow_job()``
73
+ plan stub. The ``dm_submit_workflow_job()`` plan stub is
74
+ a thin wrapper around DM's ``startProcessingJob()`` function.
75
+ The plan stub converts this DM function into a bluesky plan, and reports the DM workflow job ``id`` once the job has been submitted.
76
+
77
+ As above, you'll need the ``workflowName`` and the ``argsDict``.
78
+
79
+ From the command line: ``RE(dm_submit_workflow_job(workflowName, argsDict))``
80
+
81
+ In a plan: ``yield from dm_submit_workflow_job(workflowName, argsDict)``
82
+
83
+ References
84
+ ----------
85
+
86
+ The `apstools` package has more support to integrate various capabilities of the DM tools.
87
+
88
+ For more information about DM, see its `API Reference <https://git.aps.anl.gov/DM/dm-docs/-/wikis/DM/Beamline-Services/API-Reference>`_.
@@ -13,6 +13,7 @@ User Documentation
13
13
 
14
14
  template_creation
15
15
  creating_instrument
16
+ startup
16
17
  setting_iconfig
17
18
  creating_devices
18
19
  sessions
@@ -0,0 +1,283 @@
1
+ Logging Configuration Guide
2
+ =========================
3
+
4
+ This guide explains how to configure and customize logging in the BITS package.
5
+
6
+ Overview
7
+ --------
8
+
9
+ The logging system provides:
10
+
11
+ * Console output for immediate feedback
12
+ * File logging for persistent records
13
+ * IPython session logging
14
+ * Module-specific log levels
15
+ * Log rotation to manage disk space
16
+
17
+ Default Configuration
18
+ -------------------
19
+
20
+ The default logging configuration is defined in ``src/apsbits/configs/logging.yml``:
21
+
22
+ .. code-block:: yaml
23
+
24
+ console_logs:
25
+ date_format: "%a-%H:%M:%S"
26
+ log_format: "%(levelname)-.1s %(asctime)s.%(msecs)03d: %(message)s"
27
+ level: info
28
+ root_level: bsdev
29
+
30
+ file_logs:
31
+ date_format: "%Y-%m-%d %H:%M:%S"
32
+ log_directory: .logs
33
+ log_filename_base: logging.log
34
+ log_format: "|\
35
+ %(asctime)s.%(msecs)03d|\
36
+ %(levelname)s|\
37
+ %(process)d|\
38
+ %(name)s|\
39
+ %(module)s|\
40
+ %(lineno)d|\
41
+ %(threadName)s| - \
42
+ %(message)s"
43
+ maxBytes: 1_000_000
44
+ backupCount: 9
45
+ level: info
46
+ rotate_on_startup: true
47
+
48
+ ipython_logs:
49
+ log_directory: .logs
50
+ log_filename_base: ipython_log.py
51
+ log_mode: rotate
52
+ options: -o -t
53
+
54
+ modules:
55
+ apstools: warning
56
+ bluesky-queueserver: warning
57
+ bluesky: warning
58
+ bluesky.RE: warning
59
+ caproto: warning
60
+ databroker: warning
61
+ ophyd: warning
62
+
63
+ Log Levels
64
+ ---------
65
+
66
+ The package defines seven log levels in order of increasing detail:
67
+
68
+ ========= ========= ==================================================
69
+ name severity comments
70
+ ========= ========= ==================================================
71
+ CRITICAL 50 Examine immediately. **Quietest** level.
72
+ ERROR 40 Something has failed.
73
+ WARNING 30 Something needs attention.
74
+ INFO 20 A report that may be of interest.
75
+ BSDEV 15 A report of interest to developers.
76
+ DEBUG 10 Diagnostic. **Noisiest** level.
77
+ NOTSET 0 Initial setting, defaults to WARNING.
78
+ ========= ========= ==================================================
79
+
80
+ Custom Configuration
81
+ ------------------
82
+
83
+ To customize logging for your instrument, create an ``extra_logging.yml`` file in your instrument's config directory. The settings in this file will override the default configuration:
84
+
85
+ .. code-block:: yaml
86
+
87
+ # Custom logging configuration
88
+ # These settings will override the default configuration
89
+ console_logs:
90
+ level: debug # Override console log level
91
+ root_level: debug # Override root log level
92
+
93
+ file_logs:
94
+ log_directory: /custom/path/to/logs # Override log directory
95
+ maxBytes: 2_000_000 # Override max file size
96
+ backupCount: 5 # Override backup count
97
+
98
+ modules:
99
+ your_module: debug # Add or override module logging level
100
+
101
+ The configuration system will:
102
+ 1. Load the default configuration from ``src/apsbits/configs/logging.yml``
103
+ 2. If an extra configuration is provided, merge it with the default configuration:
104
+ * For dictionary settings (like ``console_logs``, ``file_logs``), only the specified keys are overridden
105
+ * For non-dictionary settings, the entire setting is replaced
106
+ * New settings not present in the default configuration are added
107
+
108
+ Then, in your ``startup.py``, configure logging with your custom configuration:
109
+
110
+ .. code-block:: python
111
+
112
+ from pathlib import Path
113
+ from apsbits.utils.logging_setup import configure_logging
114
+
115
+ # Get the path to your instrument's config directory
116
+ instrument_path = Path(__file__).parent
117
+ extra_logging_configs_path = instrument_path / "configs" / "extra_logging.yml"
118
+
119
+ # Configure logging with your custom settings
120
+ # The extra configuration will override the default settings
121
+ configure_logging(extra_logging_configs_path=extra_logging_configs_path)
122
+
123
+ Example of Configuration Override
124
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125
+
126
+ Default configuration:
127
+ .. code-block:: yaml
128
+
129
+ console_logs:
130
+ level: info
131
+ root_level: bsdev
132
+
133
+ file_logs:
134
+ maxBytes: 1_000_000
135
+ backupCount: 9
136
+
137
+ Extra configuration:
138
+ .. code-block:: yaml
139
+
140
+ console_logs:
141
+ level: debug # Only overrides the level, root_level remains bsdev
142
+
143
+ file_logs:
144
+ maxBytes: 2_000_000 # Only overrides maxBytes, backupCount remains 9
145
+
146
+ Resulting configuration:
147
+ .. code-block:: yaml
148
+
149
+ console_logs:
150
+ level: debug # From extra config
151
+ root_level: bsdev # From default config
152
+
153
+ file_logs:
154
+ maxBytes: 2_000_000 # From extra config
155
+ backupCount: 9 # From default config
156
+
157
+ Error Handling
158
+ -------------
159
+
160
+ The logging configuration system includes error handling for common issues:
161
+
162
+ 1. Invalid or Empty Configuration Files:
163
+ * The main logging configuration file must be valid and non-empty
164
+ * If the main configuration is invalid, a ``ValueError`` is raised
165
+ * If the extra configuration is invalid, a warning is logged and the default configuration is used
166
+
167
+ 2. Missing Configuration Files:
168
+ * The main logging configuration file must exist
169
+ * Extra configuration files are optional
170
+ * If an extra configuration file is missing, the default configuration is used
171
+
172
+ Example error handling in your code:
173
+
174
+ .. code-block:: python
175
+
176
+ try:
177
+ configure_logging(extra_logging_configs_path=extra_logging_configs_path)
178
+ except ValueError as e:
179
+ logger.error("Failed to configure logging: %s", e)
180
+ # Handle the error appropriately
181
+ except Exception as e:
182
+ logger.exception("Unexpected error configuring logging")
183
+ # Handle unexpected errors
184
+
185
+ Log File Locations
186
+ ----------------
187
+
188
+ By default, logs are stored in a ``.logs`` directory at the root of your package:
189
+
190
+ .. code-block:: text
191
+
192
+ your_package/
193
+ ├── .logs/
194
+ │ ├── logging.log # Main log file
195
+ │ ├── logging.log.1 # Rotated logs
196
+ │ ├── logging.log.2
197
+ │ └── ipython_log.py # IPython session logs
198
+ ├── src/
199
+ ├── tests/
200
+ └── ...
201
+
202
+ You can override the log directory location by specifying ``log_directory`` in your configuration:
203
+
204
+ .. code-block:: yaml
205
+
206
+ file_logs:
207
+ log_directory: /custom/path/to/logs
208
+ log_filename_base: my_instrument.log
209
+
210
+ Log Rotation
211
+ -----------
212
+
213
+ Log files are automatically rotated to manage disk space:
214
+
215
+ * Files are rotated when they reach the specified size (default: 1MB)
216
+ * A maximum number of backup files is kept (default: 9)
217
+ * Logs can be rotated on startup (default: true)
218
+
219
+ Configure these settings in your logging configuration:
220
+
221
+ .. code-block:: yaml
222
+
223
+ file_logs:
224
+ maxBytes: 2_000_000 # 2MB
225
+ backupCount: 5 # Keep 5 backup files
226
+ rotate_on_startup: true
227
+
228
+ Using Logging in Your Code
229
+ ------------------------
230
+
231
+ To use logging in your code:
232
+
233
+ .. code-block:: python
234
+
235
+ import logging
236
+
237
+ # Get a logger for your module
238
+ logger = logging.getLogger(__name__)
239
+
240
+ # Log messages at different levels
241
+ logger.debug("Detailed information for debugging")
242
+ logger.info("General information about program execution")
243
+ logger.warning("Warning messages for potentially problematic situations")
244
+ logger.error("Error messages for serious problems")
245
+ logger.critical("Critical messages for fatal errors")
246
+ logger.bsdev("Developer-specific information")
247
+
248
+ Best Practices
249
+ -------------
250
+
251
+ 1. Use appropriate log levels:
252
+ * DEBUG: Detailed information for debugging
253
+ * INFO: General information about program execution
254
+ * WARNING: Potentially problematic situations
255
+ * ERROR: Serious problems
256
+ * CRITICAL: Fatal errors
257
+ * BSDEV: Developer-specific information
258
+
259
+ 2. Include relevant context in log messages:
260
+ * Use string formatting for variables
261
+ * Include error details when catching exceptions
262
+ * Add module and function names for clarity
263
+
264
+ 3. Configure module-specific logging levels to reduce noise:
265
+ * Set verbose logging for your modules
266
+ * Set higher levels for third-party modules
267
+
268
+ 4. Use log rotation to manage disk space:
269
+ * Set appropriate file sizes
270
+ * Configure backup count based on available space
271
+ * Consider rotating logs on startup for clean sessions
272
+
273
+ 5. Handle logging configuration errors:
274
+ * Always wrap logging configuration in try-except blocks
275
+ * Provide fallback configurations when needed
276
+ * Log configuration errors appropriately
277
+
278
+ References
279
+ ----------
280
+
281
+ * `Python logging documentation <https://docs.python.org/3/library/logging.html>`_
282
+ * `Bluesky debugging guide <https://blueskyproject.io/bluesky/main/debugging.html>`_
283
+ * `Ophyd logging reference <https://blueskyproject.io/ophyd/user_v1/reference/logging.html>`_
@@ -0,0 +1,167 @@
1
+ Startup Configuration Guide
2
+ =========================
3
+
4
+ This guide explains the configuration and setup of the Bluesky Data Acquisition startup process.
5
+
6
+ Overview
7
+ --------
8
+
9
+ The startup.py file initializes and configures the Bluesky Data Acquisition environment. It supports various execution contexts including:
10
+
11
+ * Python scripts
12
+ * IPython console
13
+ * Jupyter notebook
14
+ * Bluesky queueserver
15
+
16
+ Configuration Blocks
17
+ ------------------
18
+
19
+ Import Block
20
+ ~~~~~~~~~~~
21
+
22
+ The file begins with necessary imports organized into several categories:
23
+
24
+ * Standard Library imports
25
+ * Core functionality imports (BEC, catalog, instrument initialization)
26
+ * Utility function imports
27
+ * Configuration-related imports
28
+
29
+ Configuration Loading
30
+ ~~~~~~~~~~~~~~~~~~~
31
+
32
+ .. code-block:: python
33
+
34
+ instrument_path = Path(__file__).parent
35
+ iconfig_path = instrument_path / "configs" / "iconfig.yml"
36
+ iconfig = load_config(iconfig_path)
37
+
38
+ This block:
39
+ * Determines the instrument package path
40
+ * Loads the main configuration file (iconfig.yml)
41
+ * Configures additional logging if needed
42
+
43
+ Logging Setup
44
+ ~~~~~~~~~~~~
45
+
46
+ .. code-block:: python
47
+
48
+ extra_logging_configs_path = instrument_path / "configs" / "extra_logging.yml"
49
+ configure_logging(extra_logging_configs_path=extra_logging_configs_path)
50
+
51
+ Tips:
52
+ * Create an extra_logging.yml file if you need custom logging configuration
53
+ * The default logging setup from apsbits will be used if no extra configuration is provided
54
+
55
+
56
+ Data Management Setup
57
+ ~~~~~~~~~~~~~~~~~~~
58
+
59
+ .. code-block:: python
60
+
61
+ aps_dm_setup(iconfig.get("DM_SETUP_FILE"))
62
+
63
+ Configures the data management system. Make sure to:
64
+ * Set the DM_SETUP_FILE path in your iconfig.yml
65
+ * Configure appropriate data storage locations
66
+
67
+ Bluesky Initialization
68
+ ~~~~~~~~~~~~~~~~~~~~~
69
+
70
+ .. code-block:: python
71
+
72
+ bec, peaks = init_bec_peaks(iconfig)
73
+ cat = init_catalog(iconfig)
74
+ RE, sd = init_RE(iconfig, bec_instance=bec, cat_instance=cat)
75
+
76
+ This block initializes:
77
+ * Best Effort Callback (BEC) and peak finding
78
+ * Data catalog
79
+ * Run Engine (RE) and Supplemental Data (sd)
80
+
81
+ Optional Callbacks
82
+ ~~~~~~~~~~~~~~~~
83
+
84
+ Nexus Data File Writer
85
+ ^^^^^^^^^^^^^^^^^^^^^
86
+
87
+ .. code-block:: python
88
+
89
+ if iconfig.get("NEXUS_DATA_FILES", {}).get("ENABLE", False):
90
+ from .callbacks.nexus_data_file_writer import nxwriter_init
91
+ nxwriter = nxwriter_init(RE)
92
+
93
+ To enable:
94
+ * Set NEXUS_DATA_FILES.ENABLE to True in iconfig.yml
95
+ * Configure appropriate Nexus file settings
96
+
97
+ SPEC Data File Writer
98
+ ^^^^^^^^^^^^^^^^^^^^
99
+
100
+ .. code-block:: python
101
+
102
+ if iconfig.get("SPEC_DATA_FILES", {}).get("ENABLE", False):
103
+ from .callbacks.spec_data_file_writer import init_specwriter_with_RE
104
+ # ... additional imports ...
105
+
106
+ To enable:
107
+ * Set SPEC_DATA_FILES.ENABLE to True in iconfig.yml
108
+ * Configure SPEC file settings as needed
109
+
110
+ Queue Server Configuration
111
+ ~~~~~~~~~~~~~~~~~~~~~~~~
112
+
113
+ The file handles two different import scenarios:
114
+
115
+ 1. Queue Server Mode:
116
+ * Imports all standard plans
117
+ * Uses specific lineup2 import
118
+
119
+ 2. Standard Mode:
120
+ * Imports apstools plans and utilities
121
+ * Imports bluesky plan stubs and plans with conventional prefixes
122
+
123
+ Device Loading
124
+ ~~~~~~~~~~~~
125
+
126
+ .. code-block:: python
127
+
128
+ RE(make_devices(clear=False, file="devices.yml"))
129
+ if host_on_aps_subnet():
130
+ RE(make_devices(clear=False, file="device_aps_only.yml"))
131
+
132
+ Tips:
133
+ * Create a devices.yml file with your instrument's device configurations
134
+ * Optionally create device_aps_only.yml for APS-specific devices
135
+ * Set clear=False to preserve existing devices
136
+
137
+ Configuration Tips
138
+ ----------------
139
+
140
+ 1. iconfig.yml Structure
141
+ ~~~~~~~~~~~~~~~~~~~~
142
+
143
+ Essential sections:
144
+
145
+ .. code-block:: yaml
146
+
147
+ DM_SETUP_FILE: "path/to/dm_setup.yml"
148
+ NEXUS_DATA_FILES:
149
+ ENABLE: false
150
+ SPEC_DATA_FILES:
151
+ ENABLE: false
152
+
153
+ 2. Logging Configuration
154
+ ~~~~~~~~~~~~~~~~~~~~
155
+
156
+ Create extra_logging.yml for custom logging:
157
+
158
+ .. code-block:: yaml
159
+
160
+ version: 1
161
+ handlers:
162
+ console:
163
+ class: logging.StreamHandler
164
+ level: INFO
165
+ root:
166
+ level: INFO
167
+ handlers: [console]
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '1.0.3'
21
- __version_tuple__ = version_tuple = (1, 0, 3)
20
+ __version__ = version = '1.0.4'
21
+ __version_tuple__ = version_tuple = (1, 0, 4)
@@ -0,0 +1,40 @@
1
+ # # Bluesky Session Logging Configuration
2
+
3
+ # console_logs:
4
+ # date_format: "%a-%H:%M:%S"
5
+ # log_format: "%(levelname)-.1s %(asctime)s.%(msecs)03d: %(message)s"
6
+ # level: info
7
+ # root_level: bsdev
8
+
9
+ # file_logs:
10
+ # date_format: "%Y-%m-%d %H:%M:%S"
11
+ # log_directory: .logs
12
+ # log_filename_base: logging.log
13
+ # log_format: "|\
14
+ # %(asctime)s.%(msecs)03d|\
15
+ # %(levelname)s|\
16
+ # %(process)d|\
17
+ # %(name)s|\
18
+ # %(module)s|\
19
+ # %(lineno)d|\
20
+ # %(threadName)s| - \
21
+ # %(message)s"
22
+ # maxBytes: 1_000_000
23
+ # backupCount: 9
24
+ # level: info
25
+ # rotate_on_startup: true
26
+
27
+ # ipython_logs:
28
+ # log_directory: .logs
29
+ # log_filename_base: ipython_log.py
30
+ # log_mode: rotate
31
+ # options: -o -t
32
+
33
+ # modules:
34
+ # apstools: warning
35
+ # bluesky-queueserver: warning
36
+ # bluesky: warning
37
+ # bluesky.RE: warning
38
+ # caproto: warning
39
+ # databroker: warning
40
+ # ophyd: warning