def list_lcls_runs(self): from xfel.xpp.simulate import file_table query = "https://pswww.slac.stanford.edu/ws-auth/dataexport/placed?exp_name=%s" % (self.params.facility.lcls.experiment) FT = file_table(self.params.facility.lcls, query, enforce80=self.params.facility.lcls.web.enforce80, enforce81=self.params.facility.lcls.web.enforce81) runs = FT.get_runs() for r in runs: r['run'] = str(r['run']) return runs
def list_lcls_runs(self): if self.params.facility.lcls.web.user is None or len(self.params.facility.lcls.web.user) == 0: from xfel.command_line.auto_submit import match_runs import os exp_prefix = self.params.facility.lcls.experiment[0:3].upper() xtc_dir = os.path.join(os.environ.get('SIT_PSDM_DATA', '/reg/d/psdm'), exp_prefix, self.params.facility.lcls.experiment, 'xtc') return [{'run':str(r.id)} for r in match_runs(xtc_dir, False)] else: from xfel.xpp.simulate import file_table query = "https://pswww.slac.stanford.edu/ws-auth/dataexport/placed?exp_name=%s" % (self.params.facility.lcls.experiment) FT = file_table(self.params.facility.lcls, query, enforce80=self.params.facility.lcls.web.enforce80, enforce81=self.params.facility.lcls.web.enforce81) runs = FT.get_runs() for r in runs: r['run'] = str(r['run']) return runs
# set up extra run tags, if provided if params.run_tags is not None: extra1 = ", tags" extra2 = ",'%s'"%params.run_tags else: extra1 = "" extra2 = "" while True: # Get the set of known runs in the experiment database cmd = "SELECT run from %s_runs"%params.experiment_tag cursor = dbobj.cursor() cursor.execute(cmd) # Get the set of runs from SLAC's database FT = file_table(params,query) # Find the delta known_runs = [int(entry[0]) for entry in cursor.fetchall()] unknown_runs = [run for run in FT.rundict if run not in known_runs] print "%d new runs"%len(unknown_runs) # Enter any new runs into the experiment database if len(unknown_runs) > 0: cmd = "INSERT INTO %s_runs (run%s) VALUES "%(params.experiment_tag, extra1) comma = "" for run in unknown_runs: cmd += comma + "(%d%s)"%(run, extra2) comma = ", "
def list_lcls_runs(self): from xfel.xpp.simulate import file_table query = "https://pswww.slac.stanford.edu/ws-auth/dataexport/placed?exp_name=%s" % (self.params.experiment) FT = file_table(self.params, query, enforce80=self.params.web.enforce80, enforce81=self.params.web.enforce81) return FT.get_runs()
def run(args): try: from cxi_xdr_xes.cftbx.cspad_ana import db as db except ImportError: raise Sorry("Trial logging not supported for this installation. Contact the developers for access.") phil = iotbx.phil.process_command_line(args=args, master_string=master_phil) params = phil.work.extract() if params.db.host is None: raise Usage("Please provide a host name") if params.db.name is None: raise Usage("Please provide a database name") if params.db.user is None: raise Usage("Please provide a user name") if params.db.password is None: import getpass password = getpass.getpass() else: password = params.db.password try: dbobj = db.dbconnect(host=params.db.host, db=params.db.name, username=params.db.user, password=password) except Exception as e: raise Sorry(e) from xfel.xpp.simulate import file_table query = "https://pswww.slac.stanford.edu/ws-auth/dataexport/placed?exp_name=%s"%(params.experiment) # set up extra run tags, if provided if params.run_tags is not None: extra1 = ", tags" extra2 = ",'%s'"%params.run_tags else: extra1 = "" extra2 = "" while True: # Get the set of known runs in the experiment database cmd = "SELECT run from %s_runs"%params.experiment_tag cursor = dbobj.cursor() cursor.execute(cmd) # Get the set of runs from SLAC's database FT = file_table(params,query) # Find the delta known_runs = [int(entry[0]) for entry in cursor.fetchall()] unknown_runs = [run for run in FT.rundict if run not in known_runs] print "%d new runs"%len(unknown_runs) # Enter any new runs into the experiment database if len(unknown_runs) > 0: cmd = "INSERT INTO %s_runs (run%s) VALUES "%(params.experiment_tag, extra1) comma = "" for run in unknown_runs: cmd += comma + "(%d%s)"%(run, extra2) comma = ", " cursor = dbobj.cursor() cursor.execute(cmd) dbobj.commit() time.sleep(10)
# set up extra run tags, if provided if params.run_tags is not None: extra1 = ", tags" extra2 = ",'%s'" % params.run_tags else: extra1 = "" extra2 = "" while True: # Get the set of known runs in the experiment database cmd = "SELECT run from %s_runs" % params.experiment_tag cursor = dbobj.cursor() cursor.execute(cmd) # Get the set of runs from SLAC's database FT = file_table(params, query) # Find the delta known_runs = [int(entry[0]) for entry in cursor.fetchall()] unknown_runs = [run for run in FT.rundict if run not in known_runs] print "%d new runs" % len(unknown_runs) # Enter any new runs into the experiment database if len(unknown_runs) > 0: cmd = "INSERT INTO %s_runs (run%s) VALUES " % ( params.experiment_tag, extra1) comma = "" for run in unknown_runs: cmd += comma + "(%d%s)" % (run, extra2) comma = ", "