예제 #1
0
파일: __init__.py 프로젝트: liqingqiya/task
def exists(task_id):
    """True if the task exists."""
    try:
        db.task_get(task_id)
        return True
    except db.TaskNotFound:
        return False
예제 #2
0
def exists(task_id):
    """True if the task exists."""
    try:
        db.task_get(task_id)
        return True
    except db.TaskNotFound:
        return False
예제 #3
0
파일: __init__.py 프로젝트: liqingqiya/task
def run(task_id):
    """Runs the task with task id.

    Underlying method will receive two kwargs:
        task_id = id of the current task for updating
        progress = last progress passed to task_update"""
    task = db.task_get(task_id)
    if task['is_member']:
        method = getattr(task['args'][0], task['method'])
    else:
        method = task['method']
    db.task_start(task_id)
    return method(task_id=task['id'], progress=task['progress'],
                  *task['args'], **task['kwargs'])
예제 #4
0
def run(task_id):
    """Runs the task with task id.

    Underlying method will receive two kwargs:
        task_id = id of the current task for updating
        progress = last progress passed to task_update"""
    task = db.task_get(task_id)
    if task['is_member']:
        method = getattr(task['args'][0], task['method'])
    else:
        method = task['method']
    db.task_start(task_id)
    return method(task_id=task['id'],
                  progress=task['progress'],
                  *task['args'],
                  **task['kwargs'])
예제 #5
0
파일: __init__.py 프로젝트: liqingqiya/task
def is_complete(task_id):
    """Completed if the task is done."""
    try:
        return db.task_get(task_id)['completed_at'] is not None
    except db.TaskNotFound:
        return False
예제 #6
0
파일: __init__.py 프로젝트: liqingqiya/task
def is_active(task_id):
    """True if the task is active."""
    try:
        return db.task_get(task_id)['is_active']
    except db.TaskNotFound:
        return False
예제 #7
0
파일: __init__.py 프로젝트: liqingqiya/task
def get(task_id):
    """Get task from id."""
    return db.task_get(task_id)
예제 #8
0
def is_complete(task_id):
    """Completed if the task is done."""
    try:
        return db.task_get(task_id)['completed_at'] is not None
    except db.TaskNotFound:
        return False
예제 #9
0
def is_active(task_id):
    """True if the task is active."""
    try:
        return db.task_get(task_id)['is_active']
    except db.TaskNotFound:
        return False
예제 #10
0
def get(task_id):
    """Get task from id."""
    return db.task_get(task_id)