66 parser = argparse.ArgumentParser(description=
'Run SiStrip DCS O2O.')
67 parser.add_argument(
'jobname', metavar=
'JOBNAME', type=str, help=
'O2O job name as in DB.')
68 parser.add_argument(
'--mail-from', default=
'trk.o2o@cern.ch', help=
'Account to send email notification.')
69 parser.add_argument(
'--mail-to', default=
'trk.o2o@cern.ch', help=
'List of O2O notification recipients.')
70 parser.add_argument(
'--mail-log-to', default=
'trk.o2o@cern.ch', help=
'List of O2O log recipients.')
71 parser.add_argument(
'--db', default=
'pro', help=
'The database for o2o job management: pro ( for prod ) or dev ( for prep ). Default: %(default)s.')
72 parser.add_argument(
'--debug', action=
"store_true", default=
False, help=
'Switch on debug mode. Default: %(default)s.')
74 args = parser.parse_args()
75 args.mail_to = args.mail_to.strip().
split(
',')
76 args.mail_log_to = args.mail_log_to.strip().
split(
',')
80 logdir = os.environ[logDirVar]
if logDirVar
in os.environ
else '/tmp'
81 if not os.path.exists(logdir):
83 logfile = os.path.join(logdir,
'SiStripsDCSO2O_%s.log' %
str(args.jobname))
84 loglevel = logging.DEBUG
if args.debug
else logging.INFO
85 helper.configLogger(logfile, loglevel)
89 helper.send_mail(
'DCS O2O Failure: %s' % args.jobname, traceback.format_exc(), args.mail_to, args.mail_from)
98 helper.send_mail(
'DCS O2O Failure: %s' % args.jobname, traceback.format_exc(), args.mail_to, args.mail_from)
102 return ' --- O2O FAILED! ---'