app/soc/cron/job.py
changeset 2366 1a954e80d444
parent 2345 f78caf12f32d
equal deleted inserted replaced
2365:a66e1dd8ced7 2366:1a954e80d444
    55   """
    55   """
    56 
    56 
    57   def __init__(self):
    57   def __init__(self):
    58     """Constructs a new Handler with all known jobs set.
    58     """Constructs a new Handler with all known jobs set.
    59     """
    59     """
    60 
    60     # pylint: disable-msg=C0103
    61     self.OUT_OF_TIME = 0
    61     self.OUT_OF_TIME = 0
    62     self.ALREADY_CLAIMED = 1
    62     self.ALREADY_CLAIMED = 1
    63     self.SUCCESS = 2
    63     self.SUCCESS = 2
    64     self.ABORTED = 3
    64     self.ABORTED = 3
    65     self.ERRORED = 4
    65     self.ERRORED = 4
    85     if job.status != 'waiting':
    85     if job.status != 'waiting':
    86       raise db.Rollback()
    86       raise db.Rollback()
    87 
    87 
    88     job.status = 'started'
    88     job.status = 'started'
    89 
    89 
       
    90     # pylint: disable-msg=E1103
    90     if job.put():
    91     if job.put():
    91       return job
    92       return job
    92     else:
    93     else:
    93       return None
    94       return None
    94 
    95