def runDCQueue(): #maybe don't run rasters from here??? global abort_flag autoMounted = 0 #this means the mount was performed from a runQueue, as opposed to a manual mount button push logger.info("running queue in daq server") while (1): if (getBlConfig("queueCollect") == 1 and getBlConfig("beamCheck") == 1): waitBeam() if (abort_flag): abort_flag = 0 #careful about when to reset this return currentRequest = db_lib.popNextRequest(daq_utils.beamline) if (currentRequest == {}): break logger.info("processing request " + str(time.time())) reqObj = currentRequest["request_obj"] setPvDesc("govRobotDetDist", reqObj["detDist"]) setPvDesc("govHumanDetDist", reqObj["detDist"]) if (reqObj["detDist"] >= ROBOT_MIN_DISTANCE and getBlConfig("HePath") == 0): setPvDesc("govRobotDetDistOut", reqObj["detDist"]) setPvDesc("govHumanDetDistOut", reqObj["detDist"]) sampleID = currentRequest["sample"] mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != sampleID): if (getBlConfig("queueCollect") == 0): gui_message( "You can only run requests on the currently mounted sample. Remove offending request and continue." ) return mountStat = mountSample(sampleID) logger.info("automounting mp= " + currentMountedSampleID + " samp= " + str(sampleID)) if (mountStat == 1): autoMounted = 1 elif (mountStat == 2): db_lib.updatePriority(currentRequest["uid"], -1) refreshGuiTree() continue else: return 0 db_lib.updatePriority(currentRequest["uid"], 99999) currentRequest[ 'priority'] = 99999 #TODO have updatePriority return an updated request? refreshGuiTree( ) #just tells the GUI to repopulate the tree from the DB logger.info("calling collect data " + str(time.time())) colStatus = collectData(currentRequest) logger.info("done collecting data") if (autoMounted and db_lib.queueDone(daq_utils.beamline)): unmountSample()
def runDCQueue(): #maybe don't run rasters from here??? global abort_flag autoMounted = 0 #this means the mount was performed from a runQueue, as opposed to a manual mount button push print("running queue in daq server") while (1): if (abort_flag): abort_flag = 0 #careful about when to reset this return currentRequest = db_lib.popNextRequest(daq_utils.beamline) if (currentRequest == {}): break if (1): reqObj = currentRequest["request_obj"] beamline_support.setPvValFromDescriptor("govRobotDetDist",reqObj["detDist"]) beamline_support.setPvValFromDescriptor("govHumanDetDist",reqObj["detDist"]) if (reqObj["detDist"] > 200.0): beamline_support.setPvValFromDescriptor("govRobotDetDistOut",reqObj["detDist"]) beamline_support.setPvValFromDescriptor("govHumanDetDistOut",reqObj["detDist"]) sampleID = currentRequest["sample"] if (get_field("mounted_pin") != sampleID): mountStat = mountSample(sampleID) if (mountStat == 1): autoMounted = 1 elif(mountStat == 2): db_lib.updatePriority(currentRequest["uid"],-1) refreshGuiTree() continue else: ## do this??? db_lib.updatePriority(currentRequest["uid"],99999) return 0 db_lib.updatePriority(currentRequest["uid"],99999) refreshGuiTree() #just tells the GUI to repopulate the tree from the DB colStatus = collectData(currentRequest) if (autoMounted and db_lib.queueDone(daq_utils.beamline)): unmountSample()