From d23c25ba064faab64bf97f948603ad758d07a9a4 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Fri, 17 Jan 2014 14:49:37 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20521=20-=20le=20cluster=20ne=20prend=20plu?= =?UTF-8?q?s=20de=20jobs=20et=20qstat=20ne=20marche=20pas=20:=20correction?= =?UTF-8?q?=20qui=20fait=20que=20le=20code=20est=20beaucoup=20plus=20perfo?= =?UTF-8?q?rmant=20quand=20il=20y=20a=20des=20gros=20job=20array=20(alexan?= =?UTF-8?q?dra=20a=20des=20job=20array=20de=201400=20=C3=A9l=C3=A9ments)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ClusterController/JobsState.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ClusterController/JobsState.py b/ClusterController/JobsState.py index c096c51..76fb7c1 100644 --- a/ClusterController/JobsState.py +++ b/ClusterController/JobsState.py @@ -6,17 +6,29 @@ class JobsState: """ def __init__( self ): self.m_jobs = {} # list of jobs + self.m_jobArrayJobs = {} # a dictionary of jobs for each job array, indexed by job array id self.m_queueMachines = {} # list of queue machines such as allintel.q@simpatix10 self.m_stateTime = None # the time at which the state was snapshot def deleteAllJobs( self ): self.m_jobs = {} - + self.m_jobArrayJobs = {} + def addJob( self, job ): - self.m_jobs[ job.getId() ] = job + jobId = job.getId() + self.m_jobs[ jobId ] = job + if jobId.isJobArrayElement(): + tasks = self.m_jobArrayJobs.get(jobId.m_iJobId) + if tasks == None: + tasks = {} + self.m_jobArrayJobs[ jobId.m_iJobId ] = tasks + tasks[jobId] = job def getJob( self, jobId ): return self.m_jobs.get( jobId ) + + def getJobArrayJobs( self, iJobArrayId ): + return self.m_jobArrayJobs.get( iJobArrayId ) def setTime( self, stateTime ): self.m_stateTime = stateTime