2 from __future__
import print_function
3 from builtins
import range
4 import os,subprocess,sys,re,time,random
5 from threading
import *
6 from subprocess
import call
8 STATE_CREATED,STATE_COMPLETED,STATE_ERROR=list(
range(3))
38 rValue=call([
'ssh',self.
Queue,
'cd ~/CMSSW_3_5_7;scram build -j %d' % self.
QueueList.Jay,self.
BuildNode.LibName])
40 call([
'ssh',self.
Queue,
'cd ~/CMSSW_3_5_7;eval `scram runtime -sh`;EdmPluginRefresh %s' % self.
BuildNode.LibName])
59 while not depsCompleted:
62 if deps.State
is STATE_ERROR :
65 if deps.State
is not STATE_COMPLETED :
67 deps.BThread.IsComplete.acquire()
68 deps.BThread.IsComplete.wait()
70 deps.BThread.IsComplete.release()
86 list.__init__(self,value)
102 itP=it.AreDependent.findLib(lib,head)
109 if not node.BThread.is_alive():
114 node.AreDependent.startThreads()
117 return self.
findLib(dep.replace(
"/",
""))
120 if not value.__class__ == BuildTreeNode:
121 raise TypeError(
"Expected BuildTreeNode")
125 list.__setitem__(self,index,value)
128 if not value.__class__ == BuildTreeNode:
129 raise TypeError(
"Expected BuildTreeNode")
133 list.append(self,value)
135 def __str__(self,topDown=False,direction=False):
137 return "[\n...%s]" %
str(
"\n...".
join([
str(it).
replace(
"...",
"......")
for it
in self]))
140 return "[\n---%s]" %
"\n---".
join([
"'%s':'%s'\n------State = %d \n------DependsOn : %s " % (it.LibName,it.SubModule
or it.Module,it.State,it.DependsOn.__str__(
True,
True).
replace(
"---",
"------"))
for it
in self ])
142 return "\n".
join([it.__str__(
True)
for it
in self])
146 def __init__(self,libname="",module="",submodule="",depends=None,areDependent=None,weight=1,srvqueue=None):
151 if areDependent==
None:
162 if name
is "DependsOn" or name
is "AreDependent":
163 if not value.__class__ == BuildTreeNodeList:
164 raise TypeError(
"Expected BuildTreeNodeList")
165 elif name
is "State" or name
is "ModulesToDo":
166 if not value.__class__ == int:
167 raise TypeError(
"Expected int")
168 elif name
is "Module" or name
is "SubModule" or name
is "LibName":
169 if not value.__class__ == str:
170 raise TypeError(
"Expected str")
171 object.__setattr__(self,name,value)
193 self.
ThreadLog.
append([t,item.BuildNode.LibName,
"INFO: %s thread %s added for Library %s" % (t,item.name,item.BuildNode.LibName)])
199 return sum([x.Weight
for x
in self.
RunningThreads if x.is_alive()])
205 dict.__init__(self,dict.fromkeys(servers))
206 for srv
in self.keys():
215 smallest=self.keys()[0]
216 sizeSmallest=self[smallest].pendingThreads()
217 for srv
in self.keys()[1:]:
218 size=self[srv].pendingThreads()
219 if size < sizeSmallest:
225 thinnest=self.keys()[0]
226 weightThinnest=self[thinnest].queueWeight()
227 for srv
in self.keys()[1:]:
228 weight=self[srv].queueWeight()
229 if weight < weightThinnest:
231 weightThinnest = weight
def __str__(self, topDown=False, direction=False)
def findLib(self, lib, head=None)
def replace(string, replacements)
def __init__(self, cores=4, jay=2)
def __init__(self, value=None)
def __setattr__(self, name, value)
def releaseAllLocks(self)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def __str__(self, topDown=False)
def __init__(self, servers=[], cores=4, jay=2)
static std::string join(char **cmd)
def __setitem__(self, index, value)
def __init__(self, libname="", module="", submodule="", depends=None, areDependent=None, weight=1, srvqueue=None)
def putInServerQueue(self)
def __init__(self, parent, queue, weight=1)