1 from __future__
import print_function
3 import configparser
as ConfigParser
16 from datetime
import datetime
17 import CondCore.Utilities.conddblib
as conddb
22 """This function executes `command` and returns it output. 24 - `command`: Shell command to be invoked by this function. 26 child = os.popen(command)
30 print (
'%s failed w/ exit code %d' % (command, err))
36 out = subprocess.check_output([
"curl",
"-k",
"-s",
"https://cmsweb.cern.ch/t0wmadatasvc/prod/firstconditionsaferun"])
37 response = json.loads(out)[
"result"][0]
43 out = subprocess.check_output([
"curl",
"-k",
"-s",
"https://cmsweb.cern.ch/t0wmadatasvc/prod/reco_config"])
44 response = json.loads(out)[
"result"][0][
'global_tag']
50 out = subprocess.check_output([
"curl",
"-k",
"-s",
"https://cmsweb.cern.ch/t0wmadatasvc/prod/express_config"])
51 response = json.loads(out)[
"result"][0][
'global_tag']
55 if __name__ ==
"__main__":
58 parser = optparse.OptionParser(usage =
'Usage: %prog [options] <file> [<file> ...]\n')
60 parser.add_option(
'-t',
'--validationTag',
61 dest =
'validationTag',
62 default =
"SiStripApvGainAfterAbortGap_PCL_multirun_v0_prompt",
63 help =
'validation tag',
66 parser.add_option(
'-s',
'--since',
69 help =
'sinces to copy from validation tag',
72 (options, arguments) = parser.parse_args()
78 print (
"Current FCSR:",FCSR,
"| Express Global Tag",expressGT,
"| Prompt Global Tag",promptGT)
80 con = conddb.connect(url = conddb.make_url(
"pro"))
81 session = con.session()
82 IOV = session.get_dbtype(conddb.IOV)
83 TAG = session.get_dbtype(conddb.Tag)
84 GT = session.get_dbtype(conddb.GlobalTag)
85 GTMAP = session.get_dbtype(conddb.GlobalTagMap)
86 RUNINFO = session.get_dbtype(conddb.RunInfo)
88 myGTMap = session.query(GTMAP.record, GTMAP.label, GTMAP.tag_name).\
89 filter(GTMAP.global_tag_name ==
str(expressGT)).\
90 order_by(GTMAP.record, GTMAP.label).\
94 con2 = conddb.connect(url = conddb.make_url(
"dev"))
95 session2 = con2.session()
96 validationTagIOVs = session2.query(IOV.since,IOV.payload_hash,IOV.insertion_time).
filter(IOV.tag_name == options.validationTag).
all()
100 if(options.since==-1):
101 IOVsToValidate.append(validationTagIOVs[-1][0])
102 print(
"changing the default validation tag since to:",IOVsToValidate[0])
105 for entry
in validationTagIOVs:
106 if(options.since!=1
and int(entry[0])>=
int(options.since)):
107 print(
"appending to the validation list:",entry[0],entry[1],entry[2])
108 IOVsToValidate.append(entry[0])
110 for element
in myGTMap:
115 if(Record==
"SiStripApvGain2Rcd"):
116 TagIOVs = session.query(IOV.since,IOV.payload_hash,IOV.insertion_time).
filter(IOV.tag_name == Tag).
all()
117 lastG2Payload = TagIOVs[-1]
118 print(
"last payload has IOV since:",lastG2Payload[0],
"payload hash:",lastG2Payload[1],
"insertion time:",lastG2Payload[2])
119 command =
'conddb_import -c sqlite_file:toCompare.db -f frontier://FrontierProd/CMS_CONDITIONS -i '+
str(Tag) +
' -t '+
str(Tag)+
' -b '+
str(lastG2Payload[0])
123 for i,theValidationTagSince
in enumerate(IOVsToValidate):
125 command =
'conddb_import -c sqlite_file:toCompare.db -f frontier://FrontierPrep/CMS_CONDITIONS -i '+
str(options.validationTag) +
' -t '+
str(Tag)+
' -b '+
str(theValidationTagSince)
126 if(theValidationTagSince < lastG2Payload[0]):
127 print(
"the last available IOV in the validation tag is older than the current last express IOV, taking FCSR as a since!")
128 command =
'conddb_import -c sqlite_file:toCompare.db -f frontier://FrontierPrep/CMS_CONDITIONS -i '+
str(options.validationTag) +
' -t '+
str(Tag)+
' -b '+
str(FCSR+i)
133 command =
'./testCompare.sh SiStripApvGain_FromParticles_GR10_v1_express '+
str(lastG2Payload[0])+
' '+
str(theValidationTagSince)+
' toCompare.db' 134 if(theValidationTagSince < lastG2Payload[0]):
135 command =
'./testCompare.sh SiStripApvGain_FromParticles_GR10_v1_express '+
str(lastG2Payload[0])+
' '+
str(FCSR+i)+
' toCompare.db'
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def getCommandOutput(command)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)