def __init__(self):
    from chroma_core.models import Job, StateLock
    self.write_locks = []
    self.write_by_item = defaultdict(list)
    self.read_locks = []
    self.read_by_item = defaultdict(list)
    self.all_by_job = defaultdict(list)
    self.all_by_item = defaultdict(list)
    for job in Job.objects.filter((~ Q(state='complete'))):
        if job.locks_json:
            locks = json.loads(job.locks_json)
            for lock in locks:
                self._add(StateLock.from_dict(job, lock))
def __init__(self):
    from chroma_core.models import Job, StateLock
    self.write_locks = []
    self.write_by_item = defaultdict(list)
    self.read_locks = []
    self.read_by_item = defaultdict(list)
    self.all_by_job = defaultdict(list)
    self.all_by_item = defaultdict(list)
    for job in Job.objects.filter((~ Q(state='complete'))):
        if job.locks_json:
            locks = json.loads(job.locks_json)
            for lock in locks:
                self._add(StateLock.from_dict(job, lock))