NSLS-II-SST / rsoxs

RSoXS Bluesky code
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Bug: data type incompatibility upon upgrading to 2024-2.3-py311-tiled Bluesky environment #8

Closed PriyankaKetkarBNL closed 2 weeks ago

PriyankaKetkarBNL commented 2 weeks ago

This migration initially started as a result of there being a long pause at the end of scans (e.g., a 3-min NEXAFS scan would pause for an additional 7 min, a spiral scan would have a 6-min pause, a 10-min RSoXS scan would pause 12-25 min). This occurred even though stream=False was applied throughout the package.

It was suspected that that these pauses were caused due to an out-of-date environment with overlays that would result in an older version of Bluesky being used. The environment was upgraded (BS_ENV=/nsls2/conda/envs/2024-2.3-py311-tiled BS_PYTHONPATH=/nsls2/data3/sst/rsoxs/shared/config/bluesky_overlays/2024-2.3-py311-tiled/lib/python3.11/site-packages/ bsui), as described in this Jira Ticket.

After the environment upgrade, TypeError: can't pickle _thread.lock objects was encountered while starting any type of scan.

PriyankaKetkarBNL commented 2 weeks ago

Threadlocking issues addressed by PR #9.

The threadlocking error was due to using nslsii.md_dict.RunEngineRedisDict. This used files on lustre to store the persistent dictionary (from bluesky.utils import PersistentDict)

To resolve the error, this codebase was migrated to RedisJSONDict and RunEnginRedisDict in the 20241001_UpdateRedis branch. This resulted in the removal of the Sync_Dict class. The manual rsoxs_config.read() , rsoxs_config.write(), @finalize_decorator(rsoxs_config.write_plan), and rsoxs_config[’bar’] = gbar also were removed throughout the package because RedisJSONDict automatically keeps bar entries updated. The update_bar function also was modified such that all automated fiducial and diode entries are made at the beginning instead of the end; this addresses Issue #2. The clear_bar function was removed. After further updates in this branch, the rsoxs package can be run without errors.

However, a couple issues remain. The pauses after scans still occur. These will be explored in a separate branch. Also, the rsoxs_scans package is not currently compatible with these upgrades because of changes in datatypes. These are being updated in the 20241006_CommissioningUpdates branch.