start_task
async
¶
start_task(
agent_context_id: AgentContextIdentifier,
input_configuration: TaskInputConfiguration,
*,
config_overrides: Optional[AsyncContextClientConfig] = None,
client_token: Optional[ClientToken] = None,
description: Optional[TaskDescription] = None,
access_control_config: Optional[AccessControlConfig] = None,
) -> StartTaskResponse
Starts a task that imports a data dictionary, verified queries, or ontologies into an agent context. The task runs asynchronously and records the changes it makes as change sets. GetTask returns its status.
Parameters:
-
agent_context_id(AgentContextIdentifier) –The agent context, as an ID or ARN.
-
client_token(Optional[ClientToken], default:None) –A unique, case-sensitive identifier that you provide to ensure that the request completes no more than one time. The token is scoped to your account and the agent context. If you reuse a token on the same agent context with different parameters, the request fails with
ValidationException. -
description(Optional[TaskDescription], default:None) –A description of the task. Up to 1,024 characters, with no control characters.
-
input_configuration(TaskInputConfiguration) –What the task imports. Set exactly one member. The member that you set determines the task's
type. -
access_control_config(Optional[AccessControlConfig], default:None) –Who can see the content that the task adds to the agent context. AWS Context supports only one entry:
ALLOWwithprincipalId*, so that every reader of the agent context can see it. If you omit it or send no entries, AWS Context uses that entry. If you name any other principal, include aDENYentry, or send more than one entry, the request fails withValidationException, and no task is started.
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.
-
InternalServerException–The request failed because of an internal error. Retry the request.
-
ThrottlingException–The request was denied because it exceeded a request rate quota. Wait, then retry the request.
-
ValidationException–The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.
-
ConflictException–The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.
-
ResourceNotFoundException–The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.
-
ServiceQuotaExceededException–The request would exceed a service quota. Check the quota that
quotaCodenames, reduce your usage, and then retry the request. -
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Import a data dictionary into an agent context The following example starts a task that imports a CSV data dictionary that describes the columns of a sales table.
>>> await client.start_task(agent_context_id='ac-3f9c2e7a1b8d4c56a0e4f7b29d1c8e53', client_token='3c8f1a2e-6b4d-4f9a-8e2c-1d7b5a9f0e64', description='Import the sales data dictionary', input_configuration={'importDataDictionary': {'documents': [{'name': 'sales-columns.csv', 'contentType': 'CSV', 'content': 'Y29sdW1uLHRhYmxlLGRlc2NyaXB0aW9uCm9yZGVyX3RvdGFsLHNhbGVzLm9yZGVycyxPcmRlciBhbW91bnQgaW4gVVNEIGFmdGVyIGRpc2NvdW50cwpyZWdpb25fY29kZSxzYWxlcy5vcmRlcnMsVHdvLWxldHRlciBzYWxlcyByZWdpb24gY29kZQo='}]}})
Import an ontology into an agent context
The following example starts a task that imports version 1.2.0 of an ontology into an agent context.
>>> await client.start_task(agent_context_id='ac-3f9c2e7a1b8d4c56a0e4f7b29d1c8e53', input_configuration={'importOntology': {'ontologies': [{'ontologyId': 'ont-5b8e1f4a9c2d4e7fb3a6c0d9e8f1a274', 'ontologyVersion': '1.2.0'}]}}, access_control_config={'accessControlList': [{'access': 'ALLOW', 'principalId': '*'}]})
Source code in docs_src/capo_context/_services/async_context.py
3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 | |