Context / Client / get_task

get_task

Context.Client.get_task(**kwargs)

Returns a task’s configuration, status, and results.

See also: AWS API Documentation

Request Syntax

response = client.get_task(
    agentContextId='string',
    taskId='string'
)
Parameters:
  • agentContextId (string) –

    [REQUIRED]

    The agent context, as an ID or ARN.

  • taskId (string) –

    [REQUIRED]

    The ID of the task to return.

Return type:

dict

Returns:

Response Syntax

{
    '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
    },
    'inputConfiguration': {
        'importDataDictionary': {
            'documents': [
                {
                    'name': 'string',
                    'sizeBytes': 123,
                    'contentType': 'CSV'|'JSON'|'YAML'|'MARKDOWN'|'SQL'|'TXT'
                },
            ]
        },
        'importVerifiedQueries': {
            'documents': [
                {
                    'name': 'string',
                    'sizeBytes': 123,
                    'contentType': 'CSV'|'JSON'|'YAML'|'MARKDOWN'|'SQL'|'TXT'
                },
            ]
        },
        'importOntology': {
            'ontologies': [
                {
                    'ontologyArn': 'string',
                    'ontologyVersion': 'string'
                },
            ]
        }
    },
    'outputs': [
        {
            'changeSet': {
                'changeSetId': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) –

    • 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.

    • inputConfiguration (dict) –

      A summary of the input that the task was started with. Each document is returned as its name, size, and content type, not its content, and each ontology is returned as its ARN and, if set, its version.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: importDataDictionary, importVerifiedQueries, importOntology. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • importDataDictionary (dict) –

        The data dictionary documents that an IMPORT_DATA_DICTIONARY task was started with.

        • documents (list) –

          The names and sizes of the documents, in request order.

          • (dict) –

            The name, size, and content type of a document that a task was started with. The document’s content isn’t returned.

            • name (string) –

              The name of the document, as given in the StartTask request.

            • sizeBytes (integer) –

              The size of the document’s content, in bytes.

            • contentType (string) –

              The content type of the document, as declared in the StartTask request.

      • importVerifiedQueries (dict) –

        The verified query documents that an IMPORT_VERIFIED_QUERIES task was started with.

        • documents (list) –

          Names and sizes, in request order.

          • (dict) –

            The name, size, and content type of a document that a task was started with. The document’s content isn’t returned.

            • name (string) –

              The name of the document, as given in the StartTask request.

            • sizeBytes (integer) –

              The size of the document’s content, in bytes.

            • contentType (string) –

              The content type of the document, as declared in the StartTask request.

      • importOntology (dict) –

        The ontologies that an IMPORT_ONTOLOGY task was started with.

        • ontologies (list) –

          The ontologies that the task imports, in import order.

          • (dict) –

            An ontology that an IMPORT_ONTOLOGY task was started with, and the version that was requested.

            • ontologyArn (string) –

              The Amazon Resource Name (ARN) of the ontology to import.

            • ontologyVersion (string) –

              The ontology version, as requested. Absent if the request omitted it, in which case the task imported the default version at the time the import ran.

    • outputs (list) –

      What the task created, in creation order. Set when it finishes.

      • (dict) –

        One thing a task created: exactly one member.

        Note

        This is a Tagged Union structure. Only one of the following top level keys will be set: changeSet. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

        'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
        
        • changeSet (dict) –

          A change set that the task created. Pass its changeSetId to GetChangeSet to read it.

          • changeSetId (string) –

            The ID of a change set that the task created. Pass it to GetChangeSet to read the change set.

Exceptions

  • Context.Client.exceptions.ThrottlingException

  • Context.Client.exceptions.ValidationException

  • Context.Client.exceptions.InternalServerException

  • Context.Client.exceptions.ResourceNotFoundException

  • Context.Client.exceptions.AccessDeniedException