Skip to content
Snippets Groups Projects
Commit 6fbce9aa authored by John Derek Chapman's avatar John Derek Chapman Committed by Graeme Stewart
Browse files

revert changes in G4AtlasTests-01-00-08, so that this branch is compatible...

revert changes in G4AtlasTests-01-00-08, so that this branch is compatible with releases prior to the TrackRecord migration. Tagging G4AtlasTests-01-00-11-01 (G4AtlasTests-01-00-11-01)
parent c5be73cd
No related branches found
No related tags found
No related merge requests found
......@@ -14,23 +14,26 @@ dryrun=False
def checkStatus(path,days=1):
if not os.path.exists(path+"/jobExitCode.txt"):
print path+"/jobExitCode.txt","does not exist"
return False,0
print path+"/jobExitCode.txt","missing - skipping this nightly"
return False,999
f = open(path+"/jobExitCode.txt")
print "Checking job status..."
print path+"/jobExitCode.txt"
print "Found "+path+"/jobExitCode.txt"
file_status=False
for line in f:
if line.strip()=='0':
file_status=True
print line,
#print line,
if "<jobSuccess>True</jobSuccess>" in line:
file_status=True
print line,
#print line,
elif "<jobSuccess>False</jobSuccess>" in line:
file_status=False
print line,
#print line,
if file_status: print "Job succeeded in this nightly."
else:
print "Job failed in this nightly."
return False,999
#check date
#<timeStamp>1352062929</timeStamp>
if os.path.exists(path+"/rttjobinfo.xml"):
......@@ -40,7 +43,7 @@ def checkStatus(path,days=1):
#<timeStamp>1352062929</timeStamp>#
m=re.search('<timeStamp>([0-9]*)</timeStamp>',l)
if m is not None:
print m.groups()
#print m.groups()
ts=int(m.groups()[0])
import datetime as dt
yes=dt.date.fromtimestamp(ts)
......@@ -48,13 +51,14 @@ def checkStatus(path,days=1):
days=(now-yes).days
if days>6:
# to old, ignore
print 'WARNING found too old results in ',path
print 'WARNING results found in '+path+' are more than a week old'
# file_status=False
return file_status,days
###get the recent tag###
def get_recent(path):
print "####### Get the most recent successful job as reference ######"
print "---------------------------------------------------------------------------------------"
pathlist=path.split('/')
pos_index=0
release_list=[]
......@@ -62,53 +66,51 @@ def get_recent(path):
if a.find("rel_")>=0:
pos_index=i
release_list=a.split('_')
todays_release=pathlist[pos_index]
recent_days=999;
recent_index=0;
recent_days=0;
for i in xrange(7):
for i in xrange(7):
release_tag=release_list[0]+"_"+str(i)
# print release_tag
pathlist[pos_index]=release_tag
path_refill="/".join(pathlist)
# print path_refill
print "Checking for results for "+release_tag+"..."
status_tmp,days_tmp=checkStatus(path_refill)
print "===>Release: "+release_tag+" Days: "+str(days_tmp)
if i==0:
recent_days=days_tmp
recent_index=i
elif status_tmp==True and days_tmp!=0 and days_tmp<recent_days:
recent_days=days_tmp
recent_index=i
if status_tmp:
print "==> Nightly: "+release_tag+" Age: "+str(days_tmp)+" days"
if days_tmp>0 and days_tmp<recent_days:
recent_days=days_tmp
recent_index=i
else:
print "==> Nightly: "+release_tag+" Age: N/A"
print "---------------------------------------------------------------------------------------"
if recent_days>998:
print "=====> Could not find another release to compare to. Returning today's nightly ("+todays_release+") as the reference."
return todays_release
recent_release="rel_"+str(recent_index)
print "=====> Most recent release: "+recent_release
print "=====> "+recent_release+" is the most recent nightly to use as reference."
return recent_release
###Add EOS prefix###
def eoscp(filename,jobname,tag,store_tag):
rel_list=["0","1","2","3","4","5","6"]
def eoscp(filename,jobname,tag,store_tag,release):
##rel_list=["0","1","2","3","4","5","6"]
current=os.getcwd()
if os.environ.has_key('LS_SUBCWD'):
current=os.environ['LS_SUBCWD']
#current='/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_2/19.2.X.Y-VAL/build/x86_64-slc6-gcc47-opt/offline/ISF_Validation/ttbar_ISF_G4_sim_Reg'
argv=current.split('/')
argv.pop()
for arg in argv:
if arg.find("rel_")==0:
arg_list=arg.split("_")
print arg_list
if tag=="today":
release=arg
print release
elif tag=="yesterday":
release=arg_list[0]+"_"+rel_list[int(arg_list[1])-1]
print release
##for arg in argv:
## if arg.find("rel_")==0:
## arg_list=arg.split("_")
## #print arg_list
## if tag=="today":
## release=arg
## print release
## elif tag=="yesterday":
## release=arg_list[0]+"_"+rel_list[int(arg_list[1])-1]
## print release
postfix='/'.join(argv[-3:])
#middle='/'.join(argv[-6:-5])
middle=argv[-5]
......@@ -116,13 +118,13 @@ def eoscp(filename,jobname,tag,store_tag):
# status=0
for path in pathlist:
prefix="root://eosatlas//eos/atlas/atlascerngroupdisk/proj-sit/rtt/"+path+"/rtt"
print "postfix: "+postfix
print "middle: "+middle
print "prefix: "+prefix
print "jobname: "+jobname
print "filename: "+filename
##print "postfix: "+postfix
##print "middle: "+middle
##print "prefix: "+prefix
##print "jobname: "+jobname
##print "filename: "+filename
path=prefix+'/'+release+'/'+middle+'/'+postfix+'/'+jobname+'/'+filename
print path
print "Path to check on eos: "+path
if store_tag!='':
command_cp="xrdcp %s %s.%s.root"%(path,tag,store_tag)
else:
......@@ -137,33 +139,29 @@ if __name__ == "__main__":
pwd=os.getcwd()
if os.environ.has_key('LS_SUBCWD'):
pwd= os.environ['LS_SUBCWD']
#pwd='/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/rel_2/19.2.X.Y-VAL/build/x86_64-slc6-gcc47-opt/offline/ISF_Validation/ttbar_ISF_G4_sim_Reg'
print pwd
argv=pwd.split('/')
argv.pop()
argv.append(sys.argv[1])
corr_path='/'.join(argv)
## Find a release to use as a reference
recent_rel=get_recent(corr_path)
this_rel="rel_X"
## Construct the reference directory path
pos=9
for i,a in enumerate(argv):
if a.find("rel_")>=0 :
print "found at ",i
pos=i
## if argv[pos] == 'rel_0':
## prevrelease = 'rel_6'
## else:
## prevrelease = 'rel_%d' % (int(argv[pos].split('_')[1])-1)
## pass
#print "found at ",i
this_rel = a
pos = i
refPath='/'.join(argv)
# argv[pos]=prevrelease
valPath='/'.join(argv)
argv[pos]=recent_rel
valPath='/'.join(argv)
refPath='/'.join(argv)
print "Releases to compare:"
print "Releases to compare: "+recent_rel+", "+this_rel
print refPath
print valPath
......@@ -188,13 +186,13 @@ if __name__ == "__main__":
print file_list_ref
file_list_val=compfiles[:]
try:
file_status_ref,days=checkStatus(refPath)
if file_status_ref==True:
print "Success"
print "Confirming today's job status..."
file_status_val,days=checkStatus(valPath)
if file_status_val==True:
#print "Success"
file_root=False
for f in os.listdir(refPath):
for f in os.listdir(valPath):
if f.endswith(file_name) and f != 'yesterday.root' and f!= 'today.root':
print f
name,suffix=f.split('.',1)
......@@ -204,35 +202,36 @@ if __name__ == "__main__":
elif len(compfiles)>=2:
continue
if store_tag!='':
cmd = 'cp'+' '+refPath+'/'+f+' '+'today.'+store_tag+".root"
cmd = 'cp'+' '+valPath+'/'+f+' '+'today.'+store_tag+".root"
else:
cmd = 'cp'+' '+refPath+'/'+f+' '+'today.'+suffix
cmd = 'cp'+' '+valPath+'/'+f+' '+'today.'+suffix
print cmd
if not dryrun:
os.system(cmd)
file_root=True
if f in file_list_ref:
file_list_ref.remove(f)
print file_list_ref
# if file_root==False:
file_list_ref.remove('ISFBroker.root')
if len(file_list_ref)!=0:
print("Several .root file can not been found in reference path!, try to copy from EOS.")
for ref_f in file_list_ref:
if eoscp(ref_f,sys.argv[1],"today",store_tag)!=0 :
if f in file_list_val:
file_list_val.remove(f)
print file_list_val
if 'ISFBroker.root' in file_list_val:
file_list_val.remove('ISFBroker.root')
if len(file_list_val)!=0:
print "The following files were not found in the output directory of today's job: "+str(file_list_val)+", will try to copy them from EOS instead."
for val_f in file_list_val:
if eoscp(val_f,sys.argv[1],"today",store_tag,this_rel)!=0 :
print "File does not exist in EOS."
else:
file_list_val.remove(val_f)
file_status_val=False
file_status_ref=False
file_list_ref_orig = file_list_ref
for i in range(1,5):
file_status_val,days_val=checkStatus(valPath)
if file_status_val==True:
print "Success"
print("Looking for .root files to compare...")
print "Confirming "+recent_rel+"'s job status..."
file_status_ref,days_ref=checkStatus(refPath)
if file_status_ref==True:
#print("Looking for .root files to compare...")
file_root=False
for f in os.listdir(valPath):
for f in os.listdir(refPath):
if f.endswith(file_name) and f != 'yesterday.root' and f!= 'today.root':
print f
name,suffix=f.split('.',1)
......@@ -243,51 +242,54 @@ if __name__ == "__main__":
elif len(compfiles)>=2:
continue
if store_tag!='':
cmd = 'cp'+' '+valPath+'/'+f+' '+'yesterday.'+store_tag+'.root'
cmd = 'cp'+' '+refPath+'/'+f+' '+'yesterday.'+store_tag+'.root'
else:
cmd = 'cp'+' '+valPath+'/'+f+' '+'yesterday.'+suffix
cmd = 'cp'+' '+refPath+'/'+f+' '+'yesterday.'+suffix
print cmd
if not dryrun:
os.system(cmd)
file_root=True
if f in file_list_val:
file_list_val.remove(f)
print file_list_val
# if file_root==False:
file_list_val.remove('ISFBroker.root')
if len(file_list_val)!=0:
print("No .root file found in validation path!, try to copy from EOS")
for val_f in file_list_val :
if eoscp(val_f,sys.argv[1],"yesterday",store_tag)!=0:
if f in file_list_ref:
file_list_ref.remove(f)
print file_list_ref
if 'ISFBroker.root' in file_list_ref:
file_list_ref.remove('ISFBroker.root')
if len(file_list_ref)!=0:
print "The following files were not found in the output directory of "+recent_rel+"'s job: "+str(file_list_ref)+", will try to copy them from EOS instead."
for ref_f in file_list_ref :
if eoscp(ref_f,sys.argv[1],"yesterday",store_tag,recent_rel)!=0:
print "File does not exist in EOS."
else:
file_list_ref.remove(ref_f)
# found a release!
if len(file_list_ref)==0:
break
#elif(i==2):
#print("Release to compare has failed. No validation release was found!")
elif file_status_val==False:
if argv[pos] == 'rel_0':
prevrelease = 'rel_6'
else:
##clean up files
print "Could not find a full set of files for "+recent_rel+", so removing any we did find."
if(len(file_list_ref)+1) < len(file_list_ref_orig): os.system('rm yesterday.*')
file_list_ref = file_list_ref_orig
file_status_ref=False
previous_rel = recent_rel
if recent_rel == 'rel_0':
recent_rel = 'rel_6'
else:
prevrelease = 'rel_%d' % (int(argv[pos].split('_')[1])-1)
recent_rel = 'rel_%d' % (int(recent_rel.split('_')[1])-1)
argv[pos]=prevrelease
valPath='/'.join(argv)
print "The previous release has failed. New releases to compare:"
print refPath
argv[pos]=recent_rel
refPath='/'.join(argv)
print "As we failed to find all required files in "+previous_rel+", trying again with "+recent_rel
print valPath
print refPath
if not file_status_val==True:
print("Release to compare has failed. No validation release was found!")
# make fileGrepper happy
print "leaving with code 0"
if not file_status_ref==True:
print("Failed to find a usable reference nightly!")
else:
# make fileGrepper happy
print "leaving with code 0"
elif file_status_ref==False:
print "Job has failed in validation path"
elif file_status_val==False:
print "Failed to find expected files in the path for today's nightly!"
except (OSError,IOError):
print "No running in this release!"
......@@ -20,13 +20,14 @@ athenaCommonFlags.EvtMax = 3
## Set global conditions tag
from AthenaCommon.GlobalFlags import jobproperties
jobproperties.Global.ConditionsTag = "OFLCOND-MC12-SIM-00"
jobproperties.Global.ConditionsTag = "OFLCOND-RUN12-SDR-19"
## Simulation flags
from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags()
simFlags.SimLayout.set_On()
simFlags.SimLayout='ATLAS-GEO-20-00-01_VALIDATION'
simFlags.SimLayout='ATLAS-R2-2015-03-01-00_VALIDATION'
simFlags.RunNumber=222525
## Use single particle generator
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment