def setProposalID(proposalID): if (getProposalID() != proposalID): #proposalID changed - create a new visit. print("you changed proposals! " + str(proposalID)) try: visitName = ispybLib.createVisit(proposalID) except: visitName = "999999-1234" print("ispyb error") setVisitName(visitName) db_lib.setBeamlineConfigParam(beamline,"proposal",proposalID)
def setProposalID(proposalID, createVisit=True): if (getProposalID() != proposalID): #proposalID changed - create a new visit. logger.info("you changed proposals! " + str(proposalID)) try: if (createVisit): visitName = ispybLib.createVisit(proposalID) db_lib.setBeamlineConfigParam(beamline, "proposal", proposalID) else: visitName, visitNum = ispybLib.createVisitName(proposalID) except Exception as e: visitName = "999999-1234" logger.error("ispyb error in set proposal. Error: %s" % e) setVisitName(visitName)
def setProposalID( proposalID, createVisit=True ): # TODO JA proposalID implies a database ID, which it is not (just proposal number). Misleading if (getProposalID() != proposalID): #proposalID changed - create a new visit. logger.info("you changed proposals! " + str(proposalID)) logger.info( 'ignoring createVisit for now - ISPyB required to properly account for visit numbers' ) try: visitName, visitNum = createVisitName(proposalID) db_lib.setBeamlineConfigParam(beamline, "proposal", proposalID) except Exception as e: visitName = "999999-1234" logger.error("error in set proposal. Error: %s" % e) setVisitName(visitName)
def setVisitName(visitName): return db_lib.setBeamlineConfigParam(beamline, "visitName", visitName)
def setBlConfig(param, value): db_lib.setBeamlineConfigParam(beamline, param, value)
import db_lib import time import os import string import sys beamline_id = sys.argv[1] beamlineConfigList = db_lib.getAllBeamlineConfigParams(beamline_id) tmpFileName = "/tmp/blConfig"+str(time.time()) tmpConfigFile = open(tmpFileName,"w+") for i in range (0,len(beamlineConfigList)): infoName = beamlineConfigList[i]['info_name'] info = beamlineConfigList[i]['info'] if ("val" in info.keys()): tmpConfigFile.write(infoName + " " + str(info["val"]) + "\n") tmpConfigFile.close() #exit(0) comm_s = "emacs -nw " + tmpFileName os.system(comm_s) tmpConfigFile = open(tmpFileName,"r") for line in tmpConfigFile.readlines(): print line (key,val) = line.split() # (key,val) = string.split(line) db_lib.setBeamlineConfigParam(beamline_id, key, val) tmpConfigFile.close() #os.system("rm " + tmpFileName)
def setVisitName(visitName): return db_lib.setBeamlineConfigParam(beamline,"visitName",visitName)