aps-8id-dys / ipython-8idiuser

8-ID-I ipython configuration for bluesky (and other)
1 stars 1 forks source link

AD_Acquire run error when using Lambda #203

Closed qzhang234 closed 4 years ago

qzhang234 commented 4 years ago

@prjemian I tried running lambda using AD_Acquire and I get the following error complaining about os.path. I did alter the sequence of the variables a bit but I did not change the script of AD_Acquire. The error messages and the AD_Acquire script are attached.

Does this has to do with the deployment of the new aps_tool?

Thanks,

Current 'AD_Acquire' ``` def AD_Acquire(areadet, file_name, acquire_time, acquire_period, num_images, path='/home/8-id-i/2020-2/qzhang202007/', submit_xpcs_job=True, atten=0, md={}): """ acquisition sequence initiating data management workflow outline of acquisition sequence: * define cam params such as acquire time, period, num images, camera mode * define file plugin immout params such as file path, file name, num_images, file_number, capture * configure scaler channels for monitoring some scalers and devices such as temperature * trigger area detector while monitoring the above params """ logger.info("AD_Acquire starting") # path = path or f"/home/8-id-i/{aps.aps_cycle.get()}/bluesky" file_name = dm_workflow.cleanupFilename(file_name) file_path = os.path.join(path,file_name) if not file_path.endswith(os.path.sep): file_path += os.path.sep logger.info(f"file_path = {file_path}") plan_args = dict( detector_name = areadet.name, acquire_time = acquire_time, acquire_period = acquire_period, num_images = num_images, file_name = file_name, submit_xpcs_job = str(submit_xpcs_job), ) if atten is not None: plan_args["atten"] = atten if path is not None: plan_args["path"] = path md["ARun_number"] = file_name md["plan_args"] = plan_args atten = atten or Atten1 assert atten in (Atten1, Atten2) # select the detector's number yield from bps.mv(dm_pars.detNum, areadet.detector_number) yield from areadet.cam.setup_modes(num_images) yield from areadet.cam.setTime(acquire_time, acquire_period) # Ask the devices to configure themselves for this plan. # no need to yield here, method does not have "yield from " calls scaler1.staging_setup_DM(acquire_period) areadet.staging_setup_DM(file_path, file_name, num_images, acquire_time, acquire_period) dm_workflow.set_xpcs_qmap_file(areadet.qmap_file) scaler1.select_channels(None) monitored_things = [ timebase, pind1, pind2, Atten1, Atten2, T_A, T_SET, ] """ #Timebase, pind1, pind2, pind3, pind4, pdbs, I_APS, I0Mon, APD, cstar_l, cstar_h, oxygen, scaler1_time, """ def timestamp_now(): return datetime.datetime.now().strftime("%c").strip() def make_hdf5_workflow_filename(): path = file_path if path.startswith("/data"): path = os.path.join("/", "home", "8-id-i", *path.split("/")[2:]) logger.debug(f"modified path: {path}") if not os.path.exists(path): os.makedirs(path) logger.debug(f"created path: {path}") fname = ( f"{file_name}" f"_{dm_pars.data_begin.get():04.0f}" f"-{dm_pars.data_end.get():04.0f}" ) fullname = os.path.join(path, f"{fname}.hdf") suffix = 0 while os.path.exists(fullname): suffix += 1 fullname = os.path.join(path, f"{fname}__{suffix:03d}.hdf") if suffix > 0: logger.info(f"using modified file name: {fullname}") return fullname def update_metadata_prescan(): detNum = int(dm_pars.detNum.get()) det_pars = dm_workflow.detectors.getDetectorByNumber(detNum) logger.info(f"detNum={detNum}, det_pars={det_pars}") yield from bps.mv( # StrReg 2-7 in order dm_pars.root_folder, file_path, ) # logger.debug("dm_pars.root_folder") yield from bps.mv( dm_pars.user_data_folder, os.path.dirname(file_path), # just last item in path ) # logger.debug("dm_pars.user_data_folder") yield from bps.mv( dm_pars.data_folder, file_name, ) # logger.debug("dm_pars.data_folder") yield from bps.mv( dm_pars.source_begin_datetime, timestamp_now(), ) # logger.debug("dm_pars.source_begin_datetime") yield from bps.mv( # Reg 121 dm_pars.source_begin_current, aps.current.get(), # Reg 101-110 in order dm_pars.roi_x1, 0, dm_pars.roi_x2, det_pars["ccdHardwareColSize"]-1, dm_pars.roi_y1, 0, dm_pars.roi_y2, det_pars["ccdHardwareRowSize"]-1, dm_pars.cols, det_pars["ccdHardwareColSize"], dm_pars.rows, det_pars["ccdHardwareRowSize"], dm_pars.kinetics_state, 0, # FIXME: SPEC generated this dm_pars.kinetics_window_size, 0, # FIXME: dm_pars.kinetics_top, 0, # FIXME: dm_pars.attenuation, atten.get(), ) # logger.debug("Reg 121, 101-110 done") yield from bps.mv( # Reg 111-120 in order #dm_pars.dark_begin, -1, # edit if detector needs this #dm_pars.dark_end, -1, # op cit dm_pars.data_begin, 1, dm_pars.data_end, num_images, dm_pars.exposure_time, acquire_time, dm_pars.exposure_period, acquire_period, # dm_pars.specscan_dark_number, -1, # not used, detector takes no darks dm_pars.stage_x, detu.x.position, dm_pars.stage_z, detu.z.position, ) # logger.debug("Reg 111-120 done") # yield from bps.mv( # # Reg 123-127 in order # dm_pars.I0mon, I0Mon.get(), # dm_pars.burst_mode_state, 0, # 0 for Lambda, other detector might use this # dm_pars.number_of_bursts, 0, # 0 for Lambda, other detector might use this # dm_pars.first_usable_burst, 0, # 0 for Lambda, other detector might use this # dm_pars.last_usable_burst, 0, # 0 for Lambda, other detector might use this # ) # # logger.debug("Reg 123-127 done") try: yield from bps.mv( # Reg 123-127 in order dm_pars.I0mon, I0Mon.get(), dm_pars.burst_mode_state, 0, # 0 for Lambda, other detector might use this dm_pars.number_of_bursts, 0, # 0 for Lambda, other detector might use this dm_pars.first_usable_burst, 0, # 0 for Lambda, other detector might use this dm_pars.last_usable_burst, 0, # 0 for Lambda, other detector might use this ) except ophyd.signal.ReadTimeoutError as exc: logger.warn("EPICS ReadTimeoutError from scaler (ignoring): %s", str(exc)) def update_metadata_postscan(): # since we inherited ALL the user's namespace, we have RE and db scan_id = RE.md["scan_id"] uid = db[-1].start["uid"] yield from bps.mv( # source end values dm_pars.source_end_datetime, timestamp_now(), dm_pars.source_end_current, aps.current.get(), dm_pars.uid, uid, dm_pars.scan_id, int(scan_id), dm_pars.datafilename, areadet.plugin_file_name, ) # logger.debug("dm_pars.datafilename") def inner_count(devices, md={}): yield from bps.open_run(md=md) for obj in devices: yield from bps.stage(obj) grp = bps._short_uid('trigger') no_wait = True for obj in devices: if hasattr(obj, 'trigger'): no_wait = False yield from bps.trigger(obj, group=grp) if areadet.cam.EXT_TRIGGER > 0: yield from soft_glue.start_trigger() # Skip 'wait' if none of the devices implemented a trigger method. if not no_wait: yield from bps.wait(group=grp) yield from bps.create('primary') # ret = {} # collect and return readings to give plan access to them for obj in devices: reading = (yield from bps.read(obj)) # if reading is not None: # ret.update(reading) yield from bps.save() for obj in devices: yield from bps.unstage(obj) yield from bps.close_run() # return ret @bpp.stage_decorator([scaler1]) @bpp.monitor_during_decorator(monitored_things) def full_acquire_procedure(md={}): logger.debug("before update_metadata_prescan()") yield from update_metadata_prescan() logger.debug("after update_metadata_prescan()") logger.debug("supplied metadata = %s", md) logger.debug("file_name = %s", file_name) logger.debug("file_path = %s", file_path) _md = { "file_name": file_name, "file_path": file_path } _md.update(md) logger.debug("metadata = %s", _md) # start autocount on the scaler yield from bps.mv(scaler1.count, "Count") logger.info("scaler should be autocounting now") # do the acquisition (the scan) logger.debug("before count()") # yield from bp.count([areadet], md=md) yield from inner_count([areadet], md=_md) logger.debug("after count()") yield from update_metadata_postscan() hdf_with_fullpath = make_hdf5_workflow_filename() print(f"HDF5 workflow file name: {hdf_with_fullpath}") if not os.path.exists(os.path.dirname(hdf_with_fullpath)): os.makedirs(os.path.dirname(hdf_with_fullpath)) dm_workflow.create_hdf5_file(hdf_with_fullpath) # update these str values from the string registers dm_workflow.transfer = dm_pars.transfer.get() dm_workflow.analysis = dm_pars.analysis.get() # no need to yield from since the function is not a plan kickoff_DM_workflow(hdf_with_fullpath, analysis=submit_xpcs_job) @apstools.utils.run_in_thread def kickoff_DM_workflow(hdf_workflow_file, analysis=True): logger.info(f"DM workflow kickoff starting: analysis:{analysis} file:{hdf_workflow_file}") if analysis: out, err = dm_workflow.DataAnalysis(hdf_workflow_file) else: out, err = dm_workflow.DataTransfer(hdf_workflow_file) logger.info("DM workflow kickoff done") logger.info(out) if len(err) > 0: logger.error(err) logger.info("calling full_acquire_procedure()") return (yield from full_acquire_procedure(md=md)) ```
Terminal Output ``` In [1]: RE(AD_Acquire(lambdadet,'A001',0.01,0.01,1000)) Transient Scan ID: 65566 Time: 2020-07-14 01:32:33 Persistent Unique Scan ID: 'c186f4db-f72d-4c9c-9771-c8e6e6021c1e' New stream: 'baseline' New stream: 'Timebase_monitor' New stream: 'pind1_monitor' New stream: 'pind2_monitor' Run aborted Traceback (most recent call last): File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py", line 1353, in _run msg = self._plan_stack[-1].send(resp) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 1307, in __call__ return (yield from plan) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 1162, in baseline_wrapper return (yield from plan_mutator(plan, insert_baseline)) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 803, in monitor_during_wrapper return (yield from plan2) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 861, in fly_during_wrapper return (yield from plan2) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 170, in plan_mutator raise ex File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 123, in plan_mutator msg = plan_stack[-1].send(ret) File "/home/beams/8IDIUSER/.ipython-bluesky/profile_bluesky/startup/instrument/plans/xpcs_acquire.py", line 314, in AD_Acquire return (yield from full_acquire_procedure(md=md)) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/utils.py", line 1046, in dec_inner return (yield from plan) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 952, in stage_wrapper return (yield from finalize_wrapper(inner(), unstage_devices())) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 509, in finalize_wrapper ret = yield from plan File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 950, in inner return (yield from plan) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/utils.py", line 1046, in dec_inner return (yield from plan) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 803, in monitor_during_wrapper return (yield from plan2) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 78, in plan_mutator msg = plan_stack[-1].throw(exception) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 78, in plan_mutator msg = plan_stack[-1].throw(exception) File "/home/beams/8IDIUSER/.ipython-bluesky/profile_bluesky/startup/instrument/plans/xpcs_acquire.py", line 282, in full_acquire_procedure yield from inner_count([areadet], md=_md) File "/home/beams/8IDIUSER/.ipython-bluesky/profile_bluesky/startup/instrument/plans/xpcs_acquire.py", line 235, in inner_count yield from bps.stage(obj) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/plan_stubs.py", line 698, in stage return (yield Msg('stage', obj)) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/preprocessors.py", line 195, in plan_mutator inner_ret = yield msg [Previous line repeated 4 more times] File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py", line 1413, in _run new_response = await coro(msg) File "/home/beams/8IDIUSER/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py", line 2156, in _stage result = obj.stage() File "/home/beams/8IDIUSER/.ipython-bluesky/profile_bluesky/startup/instrument/devices/lambda_750k.py", line 540, in stage root = os.path.join("/", "home", "8-id-i/") NameError: name 'os' is not defined New stream: 'Atten1_monitor' New stream: 'Atten2_monitor' New stream: 'pid1_controlled_value_monitor' New stream: 'pid1_final_value_monitor' --------------------------------------------------------------------------- NameError Traceback (most recent call last) in ----> 1 RE(AD_Acquire(lambdadet,'A001',0.01,0.01,1000)) ~/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py in __call__(self, *args, **metadata_kw) 793 self._task_fut.add_done_callback(set_blocking_event) 794 --> 795 self._resume_task(init_func=_build_task) 796 797 if self._interrupted: ~/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py in _resume_task(self, init_func) 917 if (exc is not None 918 and not isinstance(exc, _RunEnginePanic)): --> 919 raise exc 920 921 def install_suspender(self, suspender): ~/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py in _run(self) 1486 exit_reason = str(err) 1487 self.log.exception("Run aborted") -> 1488 raise err 1489 finally: 1490 if not exit_reason: ~/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py in _run(self) 1351 else: 1352 try: -> 1353 msg = self._plan_stack[-1].send(resp) 1354 # We have exhausted the top generator 1355 except StopIteration: ~/.conda/envs/bluesky_2020_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/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 ~/.ipython-bluesky/profile_bluesky/startup/instrument/plans/xpcs_acquire.py in AD_Acquire(areadet, file_name, acquire_time, acquire_period, num_images, path, submit_xpcs_job, atten, md) 312 313 logger.info("calling full_acquire_procedure()") --> 314 return (yield from full_acquire_procedure(md=md)) ~/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs) 1044 plan = gen_func(*inner_args, **inner_kwargs) 1045 plan = wrapper(plan, *args, **kwargs) -> 1046 return (yield from plan) 1047 return dec_inner 1048 return dec ~/.conda/envs/bluesky_2020_5/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_5/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_5/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_5/lib/python3.7/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs) 1044 plan = gen_func(*inner_args, **inner_kwargs) 1045 plan = wrapper(plan, *args, **kwargs) -> 1046 return (yield from plan) 1047 return dec_inner 1048 return dec ~/.conda/envs/bluesky_2020_5/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_5/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_5/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 ~/.ipython-bluesky/profile_bluesky/startup/instrument/plans/xpcs_acquire.py in full_acquire_procedure(md) 280 logger.debug("before count()") 281 # yield from bp.count([areadet], md=md) --> 282 yield from inner_count([areadet], md=_md) 283 logger.debug("after count()") 284 ~/.ipython-bluesky/profile_bluesky/startup/instrument/plans/xpcs_acquire.py in inner_count(devices, md) 233 yield from bps.open_run(md=md) 234 for obj in devices: --> 235 yield from bps.stage(obj) 236 grp = bps._short_uid('trigger') 237 no_wait = True ~/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/plan_stubs.py in stage(obj) 696 :func:`bluesky.plan_stubs.unstage` 697 """ --> 698 return (yield Msg('stage', obj)) 699 700 ~/.conda/envs/bluesky_2020_5/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_5/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_5/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_5/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_5/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_5/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_5/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_5/lib/python3.7/site-packages/bluesky/run_engine.py in _run(self) 1411 # exceptions (coming in via throw) can be 1412 # raised -> 1413 new_response = await coro(msg) 1414 1415 # special case `CancelledError` and let the outer ~/.conda/envs/bluesky_2020_5/lib/python3.7/site-packages/bluesky/run_engine.py in _stage(self, msg) 2154 if not hasattr(obj, 'stage'): 2155 return [] -> 2156 result = obj.stage() 2157 self._staged.add(obj) # add first in case of failure below 2158 await self._reset_checkpoint_state_coro() ~/.ipython-bluesky/profile_bluesky/startup/instrument/devices/lambda_750k.py in stage(self) 538 def stage(self): 539 super().stage() --> 540 root = os.path.join("/", "home", "8-id-i/") 541 if self._file_path.startswith("/data/"): 542 self._file_path = self._file_path[len("/data/"):] NameError: name 'os' is not defined ```
prjemian commented 4 years ago

It's not due to the new apstools package. That's not installed yet in your environment yet.

It's because the lambda_750k device file is missing import os: https://github.com/aps-8id-dys/ipython-8idiuser/blob/6cf428f574734d30008fd26573e75fb3b3d73bd7/profile_bluesky/startup/instrument/devices/lambda_750k.py#L17-L29

prjemian commented 4 years ago

Here's the information:

~/.ipython-bluesky/profile_bluesky/startup/instrument/devices/lambda_750k.py in stage(self)
    538     def stage(self):
    539         super().stage()
--> 540         root = os.path.join("/", "home", "8-id-i/")
    541         if self._file_path.startswith("/data/"):
    542             self._file_path = self._file_path[len("/data/"):]

NameError: name 'os' is not defined
qzhang234 commented 4 years ago

I see. Do we do this by simply adding import os in lambda_750k.py?

prjemian commented 4 years ago

Yes. As is customary, add it in alphabetical order in that block.

qzhang234 commented 4 years ago

Change made in lambda_750k.py. Waiting for Suresh to give the clear signal to test Bluesky