'Reset the status of a task to QUEUED after FAILED
@param task_id: the task record ID'

@staticmethod
def reset(task_id):

    db = current.db
    ttable = db.scheduler_task
    query = ((ttable.id == task_id) & (ttable.status == 'FAILED'))
    task = db(query).select(ttable.id, limitby=(0, 1)).first()
    if task:
        task.update_record(status='QUEUED')
