Context / Client / list_tasks

list_tasks

Context.Client.list_tasks(**kwargs)

Lists an agent context’s tasks, newest first.

See also: AWS API Documentation

Request Syntax

response = client.list_tasks(
    agentContextId='string',
    status='PENDING'|'IN_PROGRESS'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
    type='IMPORT_DATA_DICTIONARY'|'IMPORT_VERIFIED_QUERIES'|'IMPORT_ONTOLOGY',
    maxResults=123,
    nextToken='string'
)
Parameters:
  • agentContextId (string) –

    [REQUIRED]

    The agent context, as an ID or ARN.

  • status (string) – Specify a status to list only the tasks with that status.

  • type (string) – Specify a type to list only the tasks of that type.

  • maxResults (integer) – The maximum number of tasks to return in one page, from 1–100. The service can return fewer. Defaults to 20. A value outside 1–100 fails with ValidationException.

  • nextToken (string) – The pagination token from a previous ListTasks response. Omit it for the first page, and keep the status and type filters the same on every page.

Return type:

dict

Returns:

Response Syntax

{
    'items': [
        {
            'id': 'string',
            'arn': 'string',
            'agentContextId': 'string',
            'type': 'IMPORT_DATA_DICTIONARY'|'IMPORT_VERIFIED_QUERIES'|'IMPORT_ONTOLOGY',
            'status': 'PENDING'|'IN_PROGRESS'|'COMPLETED'|'FAILED'|'CANCELLING'|'CANCELLED',
            'description': 'string',
            'createdAt': datetime(2015, 1, 1),
            'updatedAt': datetime(2015, 1, 1),
            'statusReasonCode': 'GRAPH_NOT_ACTIVE'|'ONTOLOGY_INVALID'|'ONTOLOGY_IMPORT_UNAVAILABLE'|'ONTOLOGY_ALREADY_IMPORTED',
            'statusMessage': 'string',
            'statistics': {
                'numberOfDocumentsAnalyzed': 123,
                'numberOfChangeSetsCreated': 123,
                'numberOfChangeSetsAutoApproved': 123
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • items (list) –

      The tasks. Always present, and empty when there are none.

      • (dict) –

        Summary information about a task, as returned by ListTasks: its ID, ARN, agent context, type, status, description, timestamps, status reason code and message, and statistics. It omits the task’s input configuration and outputs, which GetTask returns.

        • id (string) –

          The ID of the task. Pass it as taskId to GetTask or CancelTask.

        • arn (string) –

          The Amazon Resource Name (ARN) of the task.

        • agentContextId (string) –

          The agent context’s ID.

        • type (string) –

          The type of the task. It is set by the inputConfiguration member that the task was started with: IMPORT_DATA_DICTIONARY, IMPORT_VERIFIED_QUERIES, or IMPORT_ONTOLOGY.

        • status (string) –

          The status of the task. A task moves from PENDING to IN_PROGRESS and ends COMPLETED, FAILED, or CANCELLED. After CancelTask, it is CANCELLING until it stops.

        • description (string) –

          The description of the task, as given to StartTask.

        • createdAt (datetime) –

          The date and time when the task was created.

        • updatedAt (datetime) –

          The date and time when the task was last updated, such as when its status changed. Equal to createdAt until the task first changes.

        • statusReasonCode (string) –

          The code for why the task failed. Present only when status is FAILED.

          Valid values:

          • GRAPH_NOT_ACTIVE - The agent context was deleted, or was not yet available, while the task ran.

          • ONTOLOGY_INVALID - An ontology is missing, has no loadable source, or its source is unsafe or too large.

          • ONTOLOGY_IMPORT_UNAVAILABLE - An ontology couldn’t be imported because of a temporary problem. Start a new task.

          • ONTOLOGY_ALREADY_IMPORTED - This ontology version is already imported into the agent context.

        • statusMessage (string) –

          The reason the task failed. Present only when status is FAILED.

        • statistics (dict) –

          Counts of the documents that the task analyzed and the change sets that it created. The counts are final once the task is COMPLETED, FAILED, or CANCELLED.

          • numberOfDocumentsAnalyzed (integer) –

            The number of input documents that the task has analyzed.

          • numberOfChangeSetsCreated (integer) –

            The number of change sets that the task has created.

          • numberOfChangeSetsAutoApproved (integer) –

            The number of change sets that the agent context’s curation policies published without review.

    • nextToken (string) –

      The token for the next page of results. Absent on the last page.

Exceptions