21 logging.debug(
str(args))
24 for basedir
in os.environ[
'CMSSW_SEARCH_PATH'].
split(
':'):
25 cfg = os.path.join(basedir, cfg_file)
26 if os.path.exists(cfg):
27 logging.info(
'Use config file %s' % cfg)
30 output_db =
'SiStripDetVOff_{delay}.db'.
format(delay=args.delay)
31 if os.path.exists(output_db):
32 logging.info(
'Output sqlite file %s already exists! Deleting...' % output_db)
36 command =
'cmsRun {cfg} delay={delay} destinationConnection={destFile} sourceConnection={sourceDb} conddbConnection={conddb} tag={tag}'.
format(
37 cfg=cfg, delay=args.delay, destFile=
'sqlite:///%s' % output_db, sourceDb=args.sourceDb, conddb=args.condDbRead, tag=args.inputTag)
38 pipe = subprocess.Popen(command, shell=
True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
39 atexit.register(partial(helper.kill_subproc_noexcept, pipe))
40 out = pipe.communicate()[0]
41 logging.info(
'\n%s\n' % out)
42 logging.info(
'@@@CMSSW job return code = %d@@@' % pipe.returncode)
43 if pipe.returncode != 0:
44 raise RuntimeError(
'O2O job FAILED!')
48 logging.info(
'Will not run uploading as requested!')
51 if not helper.exists_iov(output_db, args.inputTag):
52 logging.info(
'No IOV exists in the SQLite file. Will skip upload!')
56 f = helper.upload_payload
58 f = helper.copy_payload
59 f(dbFile=output_db, inputTag=args.inputTag, destTags=args.destTags, destDb=args.destDb, since=
None,
60 userText=
'SiStripDCS {delay} hour delay'.
format(delay=args.delay))
65 os.remove(output_db.replace(
'.db',
'.txt'))