Revision 94ed59a5

b/lib/jqueue.py
382 382
    self.acquire()
383 383
    try:
384 384
      for job in self._GetJobsUnlocked(None):
385
        # a failure in loading the job can cause 'None' to be returned
386
        if job is None:
387
          continue
388

  
385 389
        status = job.CalcStatus()
386 390

  
387 391
        if status in (constants.JOB_STATUS_QUEUED, ):
......
553 557
    finally:
554 558
      fd.close()
555 559

  
556
    job = _QueuedJob.Restore(self, data)
560
    try:
561
      job = _QueuedJob.Restore(self, data)
562
    except Exception, err:
563
      new_path = self._GetArchivedJobPath(job_id)
564
      if filepath == new_path:
565
        # job already archived (future case)
566
        logging.exception("Can't parse job %s", job_id)
567
      else:
568
        # non-archived case
569
        logging.exception("Can't parse job %s, will archive.", job_id)
570
        self._RenameFileUnlocked(filepath, new_path)
571
      return None
572

  
557 573
    self._memcache[job_id] = job
558 574
    logging.debug("Added job %s to the cache", job_id)
559 575
    return job

Also available in: Unified diff