BCDA-APS / use_bluesky

Tools to help APS use the Bluesky Framework (https://blueskyproject.io/)
8 stars 3 forks source link

ProgrammingError: SQLite with 2020_4 setup #50

Closed prjemian closed 4 years ago

prjemian commented 4 years ago

Using the 2020_4 setup, getting this error on RHEL and linuxmint:

ProgrammingError: SQLite objects created in a thread can only be used in that same thread.

``` In [4]: RE.md["versions"] Out[4]: {'bluesky': '1.6.0', 'ophyd': '1.5.0', 'databroker': '1.0.2', 'apstools': '1.1.16', 'epics': '3.4.1', 'numpy': '1.18.1', 'matplotlib': '3.1.3', 'spec2nexus': '2021.1.7', 'pyRestTable': '2020.0.2'} (bluesky_2020_1) jemian@otz ~ $ conda activate bluesky (bluesky) jemian@otz ~ $ bluesky_session.sh Python 3.7.7 (default, Mar 26 2020, 15:48:22) Type 'copyright', 'credits' or 'license' for more information IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help. IPython profile: bluesky Activating auto-logging. Current session state plus future input saved. Filename : /home/beams1/JEMIAN/.logs/ipython_console.log Mode : rotate Output logging : True Raw input log : False Timestamping : True State : active I Fri-15:43:38 - ############################################################ startup I Fri-15:43:38 - logging started I Fri-15:43:38 - logging level = 10 I Fri-15:43:38 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/collection.py I Fri-15:43:38 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/mpl/console.py I Fri-15:43:39 - are our soft IOCS running? I Fri-15:43:39 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/iocs/check_iocs.py I Fri-15:43:40 - EPICS IOCs ready... I Fri-15:43:40 - bluesky framework I Fri-15:43:40 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/framework/check_python.py I Fri-15:43:40 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/framework/check_bluesky.py I Fri-15:43:40 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/framework/initialize.py Loading metadata history from /home/beams/JEMIAN/.config/bluesky/bluesky_history.db /home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py:832: UserWarning: bluesky.utils.install_qt_kicker is no longer necessary and has no effect. Please remove your use of it. It may be removed in a future release of bluesky. warnings.warn("bluesky.utils.install_qt_kicker is no longer necessary and " I Fri-15:43:45 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/framework/user_dir.py I Fri-15:43:45 - User code directory: /home/beams/JEMIAN/.ipython/user I Fri-15:43:45 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/framework/metadata.py I Fri-15:43:46 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/framework/callbacks.py I Fri-15:43:46 - writing to SPEC file: /home/beams1/JEMIAN/20200501-154346.dat I Fri-15:43:46 - >>>> Using default SPEC file name <<<< I Fri-15:43:46 - file will be created when bluesky ends its next scan I Fri-15:43:46 - to change SPEC file, use command: newSpecFile('title') I Fri-15:43:46 - configure instrument I Fri-15:43:46 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/aps_source.py I Fri-15:43:46 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/calcs.py I Fri-15:43:47 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/motors.py I Fri-15:43:47 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/scaler.py /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/scaler.py:19: UserWarning: You have called obj.value on EpicsSignal(read_pv='sky:scaler1.NM1', name='scaler_channels_chan01_chname', parent='scaler_channels_chan01', value='clock', timestamp=631152000.0, auto_monitor=False, string=False, write_pv='sky:scaler1.NM1', limits=False, put_complete=False) (scaler_channels_chan01_chname.channels.chan01.chname) which is a non-monitored signal. We are falling back to calling `.get` and interrogating the underlying control system, however this may cause several other problems: 1. This property access may take an arbitrarily long time 2. This property access, which you expect to be read only may change other state in the Signal. Your options to fix this are: - do not use obj.value. - If you are using this is in a plan you like want to be using bps.read, bps.rd, bpp.reset_positions_decorator, bpp.reset_positions_wrapper, bpp.relative_set_decorator, or bpp.relative_set_wrapper - if you are doing this in an ophyd method use `self.get` - set up the Signal to monitor This behavior will likely change in the future. if len(scaler.channels.chan01.chname.value) == 0: I Fri-15:43:48 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/signals.py I Fri-15:43:48 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/simdet.py I Fri-15:43:48 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/simulators.py W Fri-15:43:48 - reset `calc2` since `registers` not available In [1]: RE(bp.scan([noisy], m1, -2.1, 2.1, 23)) Run aborted Traceback (most recent call last): File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py", line 1355, in _run msg = self._plan_stack[-1].send(resp) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 1307, in __call__ return (yield from plan) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 1162, in baseline_wrapper return (yield from plan_mutator(plan, insert_baseline)) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 803, in monitor_during_wrapper return (yield from plan2) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 861, in fly_during_wrapper return (yield from plan2) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/plans.py", line 1079, in scan per_step=per_step, md=_md)) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/plans.py", line 973, in scan_nd return (yield from inner_scan_nd()) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py", line 1045, in dec_inner return (yield from plan) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 952, in stage_wrapper return (yield from finalize_wrapper(inner(), unstage_devices())) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 509, in finalize_wrapper ret = yield from plan File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 950, in inner return (yield from plan) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py", line 1045, in dec_inner return (yield from plan) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 317, in run_wrapper rs_uid = yield from open_run(md) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/plan_stubs.py", line 825, in open_run return (yield Msg('open_run', **(md or {}))) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 78, in plan_mutator msg = plan_stack[-1].throw(exception) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py", line 140, in single_gen return (yield msg) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 78, in plan_mutator msg = plan_stack[-1].throw(exception) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py", line 140, in single_gen return (yield msg) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 78, in plan_mutator msg = plan_stack[-1].throw(exception) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py", line 140, in single_gen return (yield msg) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py", line 1415, in _run new_response = await coro(msg) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py", line 1579, in _open_run self.md['scan_id'] = self.scan_id_source(self.md) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/historydict.py", line 87, in __setitem__ return self._put(key, val) File "/home/beams/JEMIAN/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/historydict.py", line 158, in _put self._conn.execute(INSERTION_QUERY, (hk, hk, data_str)) # yes, twice sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 139801642895168 and this is thread id 139801033172736. --------------------------------------------------------------------------- ProgrammingError Traceback (most recent call last) in ----> 1 RE(bp.scan([noisy], m1, -2.1, 2.1, 23)) ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py in __call__(self, *args, **metadata_kw) 795 self._task_fut.add_done_callback(set_blocking_event) 796 --> 797 self._resume_task(init_func=_build_task) 798 799 if self._interrupted: ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py in _resume_task(self, init_func) 919 if (exc is not None 920 and not isinstance(exc, _RunEnginePanic)): --> 921 raise exc 922 923 def install_suspender(self, suspender): ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py in _run(self) 1488 exit_reason = str(err) 1489 self.log.exception("Run aborted") -> 1490 raise err 1491 finally: 1492 if not exit_reason: ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py in _run(self) 1353 else: 1354 try: -> 1355 msg = self._plan_stack[-1].send(resp) 1356 # We have exhausted the top generator 1357 except StopIteration: ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in __call__(self, plan) 1305 plan = monitor_during_wrapper(plan, self.monitors) 1306 plan = baseline_wrapper(plan, self.baseline) -> 1307 return (yield from plan) 1308 1309 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in baseline_wrapper(plan, devices, name) 1160 return (yield from plan) 1161 else: -> 1162 return (yield from plan_mutator(plan, insert_baseline)) 1163 1164 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 168 continue 169 else: --> 170 raise ex 171 # if inserting / mutating, put new generator on the stack 172 # and replace the current msg with the first element from the ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 121 ret = result_stack.pop() 122 try: --> 123 msg = plan_stack[-1].send(ret) 124 except StopIteration as e: 125 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in monitor_during_wrapper(plan, signals) 801 plan1 = plan_mutator(plan, insert_after_open) 802 plan2 = plan_mutator(plan1, insert_before_close) --> 803 return (yield from plan2) 804 805 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 168 continue 169 else: --> 170 raise ex 171 # if inserting / mutating, put new generator on the stack 172 # and replace the current msg with the first element from the ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 121 ret = result_stack.pop() 122 try: --> 123 msg = plan_stack[-1].send(ret) 124 except StopIteration as e: 125 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 168 continue 169 else: --> 170 raise ex 171 # if inserting / mutating, put new generator on the stack 172 # and replace the current msg with the first element from the ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 121 ret = result_stack.pop() 122 try: --> 123 msg = plan_stack[-1].send(ret) 124 except StopIteration as e: 125 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in fly_during_wrapper(plan, flyers) 859 plan1 = plan_mutator(plan, insert_after_open) 860 plan2 = plan_mutator(plan1, insert_before_close) --> 861 return (yield from plan2) 862 863 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 168 continue 169 else: --> 170 raise ex 171 # if inserting / mutating, put new generator on the stack 172 # and replace the current msg with the first element from the ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 121 ret = result_stack.pop() 122 try: --> 123 msg = plan_stack[-1].send(ret) 124 except StopIteration as e: 125 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 168 continue 169 else: --> 170 raise ex 171 # if inserting / mutating, put new generator on the stack 172 # and replace the current msg with the first element from the ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 121 ret = result_stack.pop() 122 try: --> 123 msg = plan_stack[-1].send(ret) 124 except StopIteration as e: 125 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/plans.py in scan(detectors, num, per_step, md, *args) 1077 1078 return (yield from scan_nd(detectors, full_cycler, -> 1079 per_step=per_step, md=_md)) 1080 1081 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/plans.py in scan_nd(detectors, cycler, per_step, md) 971 yield from per_step(detectors, step, pos_cache) 972 --> 973 return (yield from inner_scan_nd()) 974 975 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs) 1043 plan = gen_func(*inner_args, **inner_kwargs) 1044 plan = wrapper(plan, *args, **kwargs) -> 1045 return (yield from plan) 1046 return dec_inner 1047 return dec ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in stage_wrapper(plan, devices) 950 return (yield from plan) 951 --> 952 return (yield from finalize_wrapper(inner(), unstage_devices())) 953 954 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in finalize_wrapper(plan, final_plan, pause_for_debug) 507 cleanup = True 508 try: --> 509 ret = yield from plan 510 except GeneratorExit: 511 cleanup = False ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in inner() 948 def inner(): 949 yield from stage_devices() --> 950 return (yield from plan) 951 952 return (yield from finalize_wrapper(inner(), unstage_devices())) ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs) 1043 plan = gen_func(*inner_args, **inner_kwargs) 1044 plan = wrapper(plan, *args, **kwargs) -> 1045 return (yield from plan) 1046 return dec_inner 1047 return dec ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in run_wrapper(plan, md) 315 metadata to be passed into the 'open_run' message 316 """ --> 317 rs_uid = yield from open_run(md) 318 319 def except_plan(e): ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/plan_stubs.py in open_run(md) 823 :func:`bluesky.plans_stubs.close_run` 824 """ --> 825 return (yield Msg('open_run', **(md or {}))) 826 827 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 76 # if we have a stashed exception, pass it along 77 try: ---> 78 msg = plan_stack[-1].throw(exception) 79 except StopIteration as e: 80 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py in single_gen(msg) 138 the input message 139 ''' --> 140 return (yield msg) 141 142 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 193 try: 194 # yield out the 'current message' and collect the return --> 195 inner_ret = yield msg 196 except GeneratorExit: 197 # special case GeneratorExit. We must clean up all of our plans ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 193 try: 194 # yield out the 'current message' and collect the return --> 195 inner_ret = yield msg 196 except GeneratorExit: 197 # special case GeneratorExit. We must clean up all of our plans ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 76 # if we have a stashed exception, pass it along 77 try: ---> 78 msg = plan_stack[-1].throw(exception) 79 except StopIteration as e: 80 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py in single_gen(msg) 138 the input message 139 ''' --> 140 return (yield msg) 141 142 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 193 try: 194 # yield out the 'current message' and collect the return --> 195 inner_ret = yield msg 196 except GeneratorExit: 197 # special case GeneratorExit. We must clean up all of our plans ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 193 try: 194 # yield out the 'current message' and collect the return --> 195 inner_ret = yield msg 196 except GeneratorExit: 197 # special case GeneratorExit. We must clean up all of our plans ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 76 # if we have a stashed exception, pass it along 77 try: ---> 78 msg = plan_stack[-1].throw(exception) 79 except StopIteration as e: 80 # discard the exhausted generator ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/utils.py in single_gen(msg) 138 the input message 139 ''' --> 140 return (yield msg) 141 142 ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc) 193 try: 194 # yield out the 'current message' and collect the return --> 195 inner_ret = yield msg 196 except GeneratorExit: 197 # special case GeneratorExit. We must clean up all of our plans ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py in _run(self) 1413 # exceptions (coming in via throw) can be 1414 # raised -> 1415 new_response = await coro(msg) 1416 1417 # special case `CancelledError` and let the outer ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/bluesky/run_engine.py in _open_run(self, msg) 1577 1578 # Run scan_id calculation method -> 1579 self.md['scan_id'] = self.scan_id_source(self.md) 1580 1581 # For metadata below, info about plan passed to self.__call__ for. ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/historydict.py in __setitem__(self, key, val) 85 raise ValueError("can not set internal keys through []") 86 ---> 87 return self._put(key, val) 88 89 def __iter__(self): ~/.conda/envs/bluesky_2020_4/lib/python3.7/site-packages/historydict.py in _put(self, key, data) 156 hk = hashlib.sha1(str(key).encode('utf-8')).hexdigest() 157 data_str = json.dumps(data) --> 158 self._conn.execute(INSERTION_QUERY, (hk, hk, data_str)) # yes, twice 159 self._conn.commit() 160 ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 139801642895168 and this is thread id 139801033172736. ```

Switched back to known working 2020_1 environment and same error. Needs research.

Some dependency is broken.

prjemian commented 4 years ago

Looks like https://github.com/bluesky/bluesky/issues/1282

prjemian commented 4 years ago

As stated by @mrakitin, see https://github.com/bluesky/bluesky/issues/1227#issuecomment-510674489 for the fix.

prjemian commented 4 years ago

Particularly, this code: https://github.com/BCDA-APS/use_bluesky/blob/e96bdc07da8585c33b03187cf5f0b5fc54b81fe2/templates/profile_bluesky/startup/instrument/framework/initialize.py#L30-L31 needs to be changed to include the described changes:

  1. deprecate bluesky.get_history()
  2. in favor of PersistentDict.
prjemian commented 4 years ago

documentation: https://blueskyproject.io/bluesky/metadata.html#md-persistence

prjemian commented 4 years ago

Fun. We get to decide for ourselves where to save the data for RE.md. Since it is related to to the get_history() command, we'll call it history and make it a sibling of the IPython startup directory. Will this fail for jupyter notebooks? Probably

prjemian commented 4 years ago

Right, it's a problem for IPython. Need a better location and name for this.

prjemian commented 4 years ago

using sys.platform to identify: