Skip to content

Module API.tasks

Variables

CELERY_BROKER_URL
DEFAULT_QUEUE_NAME
ONDEMAND_QUEUE_NAME
queues
router

Functions

discard_all_waiting_tasks

def discard_all_waiting_tasks(
    user: API.auth.AuthUser = Depends(admin_required)
)
Discards all waiting tasks from the queue Returns : Number of tasks discarded

get_list_details

def get_list_details(
    queue_name: str,
    args: bool = Query(False)
)

get_queue_info

def get_queue_info(

)

get_task_status

def get_task_status(
    task_id,
    only_args: bool = Query(False)
)
Tracks the request from the task id provided by Raw Data API for the request

Args:

task_id ([type]): [Unique id provided on response from /snapshot/]

Returns:

id: Id of the task
status : Possible values includes:

        PENDING

            The task is waiting for execution.

        STARTED

            The task has been started.

        RETRY

            The task is to be retried, possibly because of failure.

        FAILURE

            The task raised an exception, or has exceeded the retry limit. The result attribute then contains the exception raised by the task.

        SUCCESS

            The task executed successfully. The result attribute then contains the tasks return value.

result : Result of task

Successful task will have additional nested json inside

inspect_workers

def inspect_workers(
    request: starlette.requests.Request,
    summary: bool = Query(True)
)
Inspects tasks assigned to workers

Returns: active: Current Active tasks ongoing on workers

ping_workers

def ping_workers(

)
Pings available workers

Returns: {worker_name : return_result}

revoke_task

def revoke_task(
    task_id,
    user: API.auth.AuthUser = Depends(staff_required)
)
Revokes task , Terminates if it is executing

Args: task_id (type): task id of raw data task

Returns: id: id of revoked task