11import os , sys , time
22
3+ from collections import Counter
4+
35from Configuration .PyReleaseValidation .WorkFlow import WorkFlow
46from Configuration .PyReleaseValidation .WorkFlowRunner import WorkFlowRunner
5-
7+ from Configuration . PyReleaseValidation . MatrixUtil import check_dups
68# ================================================================================
79
810class MatrixRunner (object ):
911
10- def __init__ (self , wfIn = None , nThrMax = 4 , nThreads = 1 ):
12+ def __init__ (self , wfIn = None , nThrMax = 4 , nThreads = 1 , gpu = False ):
1113
1214 self .workFlows = wfIn
1315
1416 self .threadList = []
1517 self .maxThreads = nThrMax
1618 self .nThreads = nThreads
19+ self .gpu = gpu
20+
21+ if self .gpu :
22+ print ("Checks for GPU" )
23+ pass
1724
1825 #the directories in which it happened
1926 self .runDirs = {}
@@ -43,12 +50,19 @@ def runTests(self, opt):
4350 print ('resetting to default number of process threads = %s' % self .maxThreads )
4451
4552 print ('Running %s %s %s, each with %s thread%s per process' % ('up to' if self .maxThreads > 1 else '' , self .maxThreads , 'concurrent jobs' if self .maxThreads > 1 else 'job' , self .nThreads , 's' if self .nThreads > 1 else '' ))
46-
47-
48- for wf in self .workFlows :
49-
50- if testList and float (wf .numId ) not in [float (x ) for x in testList ]: continue
51-
53+
54+ njob = None
55+ wfs_to_run = self .workFlows
56+ withDups = False
57+ if testList :
58+ withDups = len (check_dups (testList ))> 0
59+ wfs_to_run = [wf for wf in self .workFlows if float (wf .numId ) in testList for i in range (Counter (testList )[wf .numId ])]
60+
61+ for n ,wf in enumerate (wfs_to_run ):
62+
63+ if withDups and opt .nProcs > 1 : # to avoid overwriting the work areas
64+ njob = n
65+
5266 item = wf .nameId
5367 if os .path .islink (item ) : continue # ignore symlinks
5468
@@ -58,7 +72,7 @@ def runTests(self, opt):
5872
5973 print ('\n Preparing to run %s %s' % (wf .numId , item ))
6074 sys .stdout .flush ()
61- current = WorkFlowRunner (wf ,opt ,noRun ,dryRun ,cafVeto )
75+ current = WorkFlowRunner (wf ,opt ,noRun ,dryRun ,cafVeto , njob )
6276 self .threadList .append (current )
6377 current .start ()
6478 if not dryRun :
0 commit comments