diff --git a/ClusterController/Job.py b/ClusterController/Job.py index 7b16064..fa69d70 100644 --- a/ClusterController/Job.py +++ b/ClusterController/Job.py @@ -27,7 +27,9 @@ class JobId: A single integer is no longer enough to identify a job because all elements in a job array share the same sge job identifier. To uniquely define a job array element, we also use the task id. """ + MAX_NUM_JOBS_IN_ARRAY = 1000000 def __init__( self, iJobId, iJobArrayElementId = None): + assert iJobArrayElementId <= self.MAX_NUM_JOBS_IN_ARRAY self.m_iJobId = iJobId self.m_iJobArrayElementId = iJobArrayElementId # None if this identifier does not refer to a job array element @@ -35,7 +37,10 @@ class JobId: """ required to use a JobId as a dict hash key """ - return self.m_iJobId # very simple hashing that conflicts only for job array elements + hash = self.m_iJobId * self.MAX_NUM_JOBS_IN_ARRAY + if self.m_iJobArrayElementId is not None: + hash += self.m_iJobArrayElementId + return hash def __eq__( self, other ): """