コード例 #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)