args = parser.parse_args() sg = SpawnerClass() wf = WorkFlow() sg.config_file = args.config_file process_client_config_file(sg, wf) if args.status == '': args.status = wf.workflow_actions[0] # connect to the database dbi = StillDataBaseInterface(sg.dbhost, sg.dbport, sg.dbtype, sg.dbname, sg.dbuser, sg.dbpasswd, test=False) # Setup logging logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger('reset_observations.py') if args.debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) # for each file get the obsnum, then reset the status to first item in
help="List of integer julian dates to reset.") parser.set_defaults(config_file="%setc/still.cfg" % basedir) args = parser.parse_args() sg = SpawnerClass() wf = WorkFlow() sg.config_file = args.config_file process_client_config_file(sg, wf) if args.status == '': args.status = wf.workflow_actions[0] # connect to the database dbi = StillDataBaseInterface(sg.dbhost, sg.dbport, sg.dbtype, sg.dbname, sg.dbuser, sg.dbpasswd, test=False) # Setup logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger('reset_observations.py') if args.debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) # for each file get the obsnum, then reset the status to first item in config files workflow_actions obsnum=0 # for filename in glob.glob(args.files):
parser.add_argument('names', nargs='+', type=str, metavar='FILENAME', help="Names of the files to potentially retry.") parser.set_defaults(config_file="%setc/still.cfg" % basedir) args = parser.parse_args() sg = SpawnerClass() wf = WorkFlow() sg.config_file = args.config_file process_client_config_file(sg, wf) reset_status = wf.workflow_actions[0] # connect to the database dbi = StillDataBaseInterface( sg.dbhost, sg.dbport, sg.dbtype, sg.dbname, sg.dbuser, sg.dbpasswd, test=False) # Setup logging logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger('retry_failed_by_filename.py') if args.debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) # Fairly straightforward ... if args.reset:
type=str, metavar='OBSNUM', help='The "obsnum" to query.') args = parser.parse_args() # Set up stuff sg = SpawnerClass() wf = WorkFlow() sg.config_file = args.config_file process_client_config_file(sg, wf) dbi = StillDataBaseInterface(sg.dbhost, sg.dbport, sg.dbtype, sg.dbname, sg.dbuser, sg.dbpasswd, test=False) # Let's do it. info = dbi.get_obs_latest_log(args.obsnum) if info is None: print('No log items associated with obsnum %r.' % (args.obsnum, )) else: print('Stage:', info['stage']) print('Exit status:', info['exit_status']) print('Start time:', info['start_time']) print('End time:', info['end_time'])
parser.add_argument('obsnums', nargs='+', type=str, metavar='OBSNUM', help='List of "obsnums" to reset.') args = parser.parse_args() # Set up stuff sg = SpawnerClass() wf = WorkFlow() sg.config_file = args.config_file process_client_config_file(sg, wf) if args.status == '': args.status = wf.workflow_actions[0] dbi = StillDataBaseInterface(sg.dbhost, sg.dbport, sg.dbtype, sg.dbname, sg.dbuser, sg.dbpasswd, test=False) # Let's do it. try: s = dbi.Session() obsnums = [o.obsnum for o in s.query(Observation).filter(Observation.obsnum.in_ (args.obsnums))] s.close() for obsnum in obsnums: dbi.set_obs_status(obsnum, args.status) dbi.set_obs_pid(obsnum, None) dbi.set_obs_still_host(obsnum, None) dbi.add_log(obsnum, args.status, "resetting (reset_observations_by_obsnum)", 0) dbi.update_obs_current_stage(obsnum, None) except Exception as e:
parser = argparse.ArgumentParser(description='Get the latest log item associated with an observation.') parser.add_argument('--config_file', dest='config_file', required=False, default=basedir + 'etc/still.cfg', help="Path to the RTP config file") parser.add_argument('obsnum', type=str, metavar='OBSNUM', help='The "obsnum" to query.') args = parser.parse_args() # Set up stuff sg = SpawnerClass() wf = WorkFlow() sg.config_file = args.config_file process_client_config_file(sg, wf) dbi = StillDataBaseInterface(sg.dbhost, sg.dbport, sg.dbtype, sg.dbname, sg.dbuser, sg.dbpasswd, test=False) # Let's do it. info = dbi.get_obs_latest_log(args.obsnum) if info is None: print ('No log items associated with obsnum %r.' % (args.obsnum,)) else: print ('Stage:', info['stage']) print ('Exit status:', info['exit_status']) print ('Start time:', info['start_time']) print ('End time:', info['end_time']) print ('Text:') print (info['logtext'])
dest='config_file', required=False, help="Specify the complete path to the config file") parser.set_defaults(config_file="%setc/still.cfg" % basedir) args, unknown = parser.parse_known_args() sg = SpawnerClass() wf = WorkFlow() sg.config_file = args.config_file process_client_config_file(sg, wf) dbi = StillDataBaseInterface(sg.dbhost, sg.dbport, sg.dbtype, sg.dbname, sg.dbuser, sg.dbpasswd, test=False) # connect to the database if args.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.WARNING) logger = logging.getLogger('summarize_still') # Create database interface with SQL Alchemy s = dbi.Session() print "summarizing Distiller"