Skip to content

Commit

Permalink
Merge pull request #10607 from davidlange6/dasRetries
Browse files Browse the repository at this point in the history
add a simple retry logic to das queries
  • Loading branch information
davidlange6 committed Aug 7, 2015
2 parents c068edd + 61f4c3b commit 0c4082b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
20 changes: 18 additions & 2 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
import re
import collections
from subprocess import Popen,PIPE
import FWCore.ParameterSet.DictTypes as DictTypes
class Options:
pass
Expand Down Expand Up @@ -122,12 +123,27 @@ def filesFromList(fileName,s=None):
return (prim,sec)

def filesFromDASQuery(query,s=None):
import os
import os,time
import FWCore.ParameterSet.Config as cms
prim=[]
sec=[]
print "the query is",query
for line in os.popen('das_client.py --query "%s"'%(query)):
eC=5
count=0
while eC!=0 and count<3:
if count!=0:
print 'Sleeping, then retrying DAS'
time.sleep(100)
p = Popen('das_client.py --query "%s"'%(query), stdout=PIPE,shell=True)
tupleP = os.waitpid(p.pid, 0)
eC=tupleP[1]
count=count+1
pipe=p.stdout.read()
if eC==0:
print "DAS succeeded after",count,"attempts",eC
else:
print "DAS failed 3 times- I give up"
for line in pipe.split('\n'):
if line.count(".root")>=2:
#two files solution...
entries=line.replace("\n","").split()
Expand Down
3 changes: 2 additions & 1 deletion Configuration/PyReleaseValidation/python/MatrixRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def runTests(self, opt):
continue

print '\nPreparing to run %s %s' % (wf.numId, item)

sys.stdout.flush()
current = WorkFlowRunner(wf,noRun,dryRun,cafVeto, opt.dasOptions, opt.jobReports, opt.nThreads)
self.threadList.append(current)
current.start()
Expand Down Expand Up @@ -95,6 +95,7 @@ def count(collect,result):

report+=' '.join(map(str,totpassed))+' tests passed, '+' '.join(map(str,totfailed))+' failed\n'
print report
sys.stdout.flush()

runall_report_name='runall-report-step123-.log'
runall_report=open(runall_report_name,'w')
Expand Down

0 comments on commit 0c4082b

Please sign in to comment.