def finish(task_id): """Mark the task completed.""" values = {} values['updated_at'] = _now() values['completed_at'] = _now() values['is_active'] = False db.task_update(task_id, values) logging.debug('Finished task %s', task_id)
def update(task_id, progress): """Update the current task progress.""" now = _now() values = {} values['updated_at'] = now values['progress'] = progress db.task_update(task_id, values) logging.debug('Updated task %s at %s', task_id, now)
def fail(task_id, progress=None): """Fail the current task with optional progress.""" now = _now() values = {} values['updated_at'] = now values['is_active'] = False if progress: values['progress'] = progress db.task_update(task_id, values) logging.debug('Failed task %s at %s', task_id, now)