Closed prjemian closed 2 years ago
Looks as if the instrument
package will need some changes before the queueserver can run it. In these next steps, the queueserver cannot even find the instrument package.
Starting from a local repository clone (in the root directory of the clone):
cd ./qserver
conda activate queue_server
start-re-manager --startup-dir ./
shows this output in the console:
(queue_server) prjemian@zap:~/.../bdp_controls/qserver$ start-re-manager --startup-dir ./
[W 2022-03-21 17:35:45,209 bluesky_queueserver.manager.start_manager] The file with the list of allowed plans and devices ('/home/prjemian/Documents/projects/BCDA-APS/bdp_controls/qserver/existing_plans_and_devices.yaml') does not exist. The manager will be started with empty list. The list will be populated after RE worker environment is opened the first time.
[I 2022-03-21 17:35:45,214 bluesky_queueserver.manager.manager] Starting ZMQ server at 'tcp://*:60615'
[I 2022-03-21 17:35:45,214 bluesky_queueserver.manager.manager] ZMQ control channels: encryption disabled
[I 2022-03-21 17:35:45,216 bluesky_queueserver.manager.manager] Starting RE Manager process
[I 2022-03-21 17:35:45,229 bluesky_queueserver.manager.manager] Loading the lists of allowed plans and devices ...
[W 2022-03-21 17:35:45,229 bluesky_queueserver.manager.profile_ops] List of plans and devices is not loaded. File '/home/prjemian/Documents/projects/BCDA-APS/bdp_controls/qserver/existing_plans_and_devices.yaml' does not exist.
[I 2022-03-21 17:35:45,230 bluesky_queueserver.manager.manager] Starting ZeroMQ server ...
[I 2022-03-21 17:35:45,231 bluesky_queueserver.manager.manager] ZeroMQ server is waiting on tcp://*:60615
cd ./qserver
conda activate queue_server
qserver environment open
shows this output in the console:
Arguments: ['environment', 'open']
17:36:34 - MESSAGE:
{'msg': '', 'success': True}
This is the console where start-re-manager
is running:
[I 2022-03-21 17:36:34,715 bluesky_queueserver.manager.manager] Opening the new RE environment ...
[I 2022-03-21 17:36:34,716 bluesky_queueserver.manager.start_manager] Starting RE Worker ...
[I 2022-03-21 17:36:34,718 bluesky_queueserver.manager.manager] Waiting for RE worker to start ...
[I 2022-03-21 17:36:34,954 bluesky_queueserver.manager.profile_ops] Loading RE Worker startup code from directory '/home/prjemian/Documents/projects/BCDA-APS/bdp_controls/qserver' ...
[I 2022-03-21 17:36:34,954 bluesky_queueserver.manager.profile_ops] Startup directory: '/home/prjemian/Documents/projects/BCDA-APS/bdp_controls/qserver'
[I 2022-03-21 17:36:34,955 bluesky_queueserver.manager.profile_ops] Loading startup file '/home/prjemian/Documents/projects/BCDA-APS/bdp_controls/qserver/starter.py' ...
sys.path[-1] = '/tmp/bluesky'
[E 2022-03-21 17:36:34,957 bluesky_queueserver.manager.worker] Failed to start RE Worker environment. Error while loading startup code: No module named 'instrument'.
Traceback (most recent call last):
File "/home/prjemian/.local/lib/python3.8/site-packages/bluesky_queueserver/manager/worker.py", line 954, in run
self._re_namespace = load_worker_startup_code(
File "/home/prjemian/.local/lib/python3.8/site-packages/bluesky_queueserver/manager/profile_ops.py", line 390, in load_worker_startup_code
nspace = load_profile_collection(startup_dir, keep_re=keep_re)
File "/home/prjemian/.local/lib/python3.8/site-packages/bluesky_queueserver/manager/profile_ops.py", line 252, in load_profile_collection
raise exc_info[1].with_traceback(exc_info[2])
File "/tmp/qserver/profile_temp.py", line 22, in <module>
import instrument
ModuleNotFoundError: No module named 'instrument'
[I 2022-03-21 17:36:34,957 bluesky_queueserver.manager.worker] Environment is waiting to be closed ...
[I 2022-03-21 17:36:35,320 bluesky_queueserver.manager.manager] Waiting for exit confirmation from RE worker ...
[I 2022-03-21 17:36:35,321 bluesky_queueserver.manager.worker] Run Engine environment was closed successfully
[I 2022-03-21 17:36:35,321 bluesky_queueserver.manager.manager] Wait for RE Worker process to close (join)
[I 2022-03-21 17:36:35,321 bluesky_queueserver.manager.start_manager] Joining RE Worker ...
[E 2022-03-21 17:36:35,324 bluesky_queueserver.manager.manager] Error occurred while opening RE Worker environment.
instrument
into regular Python sessionTest that the instrument can be loaded by the starter.py
:
(queue_server) prjemian@zap:~/.../bdp_controls/qserver$ python ./starter.py
sys.path[-1] = '/home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky'
instrument = <module 'instrument' from '/home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/__init__.py'>
I Mon-17:42:30 - ############################################################ startup
I Mon-17:42:30 - logging started
I Mon-17:42:30 - logging level = 10
I Mon-17:42:30 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/collection.py
I Mon-17:42:30 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/mpl/console.py
I Mon-17:42:31 - #### Bluesky Framework ####
I Mon-17:42:31 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/framework/check_python.py
I Mon-17:42:31 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/utils/configuration.py
I Mon-17:42:31 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/framework/check_bluesky.py
I Mon-17:42:32 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/framework/initialize.py
I Mon-17:42:32 - using databroker catalog 'bdp2022'
I Mon-17:42:32 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/framework/metadata.py
I Mon-17:42:32 - #### Devices ####
I Mon-17:42:32 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/aps_source.py
I Mon-17:42:32 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/calculation_records.py
I Mon-17:42:33 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/coarse_xy_stage_device.py
I Mon-17:42:33 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/feedback_api.py
I Mon-17:42:33 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/fine_xy_stage_device.py
I Mon-17:42:33 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/ioc_stats.py
I Mon-17:42:33 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/simulated_beam.py
I Mon-17:42:33 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/simulated_shutter.py
I Mon-17:42:33 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/devices/area_detector.py
I Mon-17:42:34 - #### Callbacks ####
I Mon-17:42:34 - #### Plans ####
I Mon-17:42:34 - /home/prjemian/Documents/projects/BCDA-APS/bdp_controls/bluesky/instrument/plans/bpd_simulation.py
I Mon-17:42:34 - #### Utilities ####
I Mon-17:42:34 - #### Startup is complete. ####
==== =============== ======== ========
name ophyd structure EPICS PV label(s)
==== =============== ======== ========
==== =============== ======== ========
The queueserver
is in early development and may not be prepared for how we load the instrument
package. Also, the instrument
package needs to separate the steps that run the framework (since this will be handled by the queueserver
) and the steps that define the devices and plans. As it stands now, those steps are too intermingled in the instrument
package.
sd
)get_ipython()
setup.py
file for local installation via pip install -e .
Note that the new instrument/configuration.yml
file is very helpful!
Confirmed it necessary to reconfigure the instrument package, extracting all IPython references and making a local cat
(databroker) object as needed.
Was not necessary to make an installable package but note that instrument
cannot be located in queueserver by manipulation of the sys.path
. Rather, a starter.py
file is needed in the same directory as the instrument
package to be imported. (Might have implications how the standard instrument package should be changed.)
start-re-manager
terminalAlso removed any calls to setup supplementary data, such as baseline signals.
This works! Queueing these jobs:
qserver queue add plan '{"name": "move_coarse_positioner", "args": [2.71, 3.14]}'
qserver queue add plan '{"name": "move_fine_positioner", "args": [.123, -0.456]}'
qserver queue add plan '{"name": "take_image", "kwargs": {"md": {"task": "use the qserver"}}}'
qserver queue add plan front '{"name": "set_acquire_time", "args": [0.5]}'
qserver queue start
shows this qserver console output:
[I 2022-03-22 14:28:54,925 bluesky_queueserver.manager.manager] Starting queue processing ...
[I 2022-03-22 14:28:54,925 bluesky_queueserver.manager.manager] Processing the next queue item: 4 plans are left in the queue.
[I 2022-03-22 14:28:54,927 bluesky_queueserver.manager.manager] Starting the plan:
{'args': [0.5],
'item_uid': '1429629a-3e53-4c08-9f0a-343b0107dacd',
'kwargs': {},
'meta': {},
'name': 'set_acquire_time',
'user': 'qserver-cli',
'user_group': 'admin'}.
[I 2022-03-22 14:28:54,927 bluesky_queueserver.manager.worker] Starting execution of a plan ...
[I 2022-03-22 14:28:54,927 bluesky_queueserver.manager.worker] Starting a plan 'set_acquire_time'.
[I 2022-03-22 14:28:55,309 bluesky_queueserver.manager.manager] Processing the next queue item: 3 plans are left in the queue.
[I 2022-03-22 14:28:55,310 bluesky_queueserver.manager.manager] Starting the plan:
{'args': [2.71, 3.14],
'item_uid': 'd6c86650-7bd4-4ae5-a929-a8605def5614',
'kwargs': {},
'meta': {},
'name': 'move_coarse_positioner',
'user': 'qserver-cli',
'user_group': 'admin'}.
[I 2022-03-22 14:28:55,310 bluesky_queueserver.manager.worker] Starting execution of a plan ...
[I 2022-03-22 14:28:55,310 bluesky_queueserver.manager.worker] Starting a plan 'move_coarse_positioner'.
[I 2022-03-22 14:28:58,824 bluesky_queueserver.manager.manager] Processing the next queue item: 2 plans are left in the queue.
[I 2022-03-22 14:28:58,826 bluesky_queueserver.manager.manager] Starting the plan:
{'args': [0.123, -0.456],
'item_uid': '4993eeff-9045-425d-8b99-3b8f6bd645b8',
'kwargs': {},
'meta': {},
'name': 'move_fine_positioner',
'user': 'qserver-cli',
'user_group': 'admin'}.
[I 2022-03-22 14:28:58,826 bluesky_queueserver.manager.worker] Starting execution of a plan ...
[I 2022-03-22 14:28:58,826 bluesky_queueserver.manager.worker] Starting a plan 'move_fine_positioner'.
[I 2022-03-22 14:28:59,327 bluesky_queueserver.manager.manager] Processing the next queue item: 1 plans are left in the queue.
[I 2022-03-22 14:28:59,330 bluesky_queueserver.manager.manager] Starting the plan:
{'args': [],
'item_uid': 'f7c6c5f2-12c8-4a6c-b562-b77bb36c30a9',
'kwargs': {'md': {'task': 'use the qserver'}},
'meta': {},
'name': 'take_image',
'user': 'qserver-cli',
'user_group': 'admin'}.
[I 2022-03-22 14:28:59,330 bluesky_queueserver.manager.worker] Starting execution of a plan ...
[I 2022-03-22 14:28:59,330 bluesky_queueserver.manager.worker] Starting a plan 'take_image'.
Transient Scan ID: 3 Time: 2022-03-22 14:29:00
Persistent Unique Scan ID: '4c74553b-75e2-455a-a780-5af3cda66a7f'
[I 2022-03-22 14:29:00,282 bluesky_queueserver.manager.plan_monitoring] New run was open: '4c74553b-75e2-455a-a780-5af3cda66a7f'
New stream: 'primary'
+-----------+------------+
| seq_num | time |
+-----------+------------+
| 1 | 14:29:00.4 |
+-----------+------------+
generator take_image ['4c74553b'] (scan num: 3)
Run was closed: '4c74553b-75e2-455a-a780-5af3cda66a7f'
[I 2022-03-22 14:29:01,839 bluesky_queueserver.manager.manager] No items are left in the queue.
[I 2022-03-22 14:29:01,839 bluesky_queueserver.manager.manager] Queue is empty.
Working now.
Started running a GUI for the queueserver today and decided it would be easier if the API for take_image()
was simpler. Specifically, the arguments that could be None
or tuple
are very difficult to provide reliably through the qserver. Separate the jobs from inside the take_image()
plan so they can be executed individually. But, combine the acquisition time into the take_image()
API.
Might be nice to run the queueserver in a screen session, like the feedback IOC is run. Sounds like an enhancement feature.
@keenanlang @tguruswamy : This is ready for review. Demo at tomorrow's meeting.
@keenanlang @tguruswamy : Today's demo was a test of this PR. I'd like to merge it today so I can move forward on other issues. If no objections, I'll merge later this evening.