Skip to content

create_flow_definition async

create_flow_definition(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    flow_definition_name: Optional[FlowDefinitionName] = None,
    human_loop_request_source: Optional[HumanLoopRequestSource] = None,
    human_loop_activation_config: Optional[HumanLoopActivationConfig] = None,
    human_loop_config: Optional[HumanLoopConfig] = None,
    output_config: Optional[FlowDefinitionOutputConfig] = None,
    role_arn: Optional[RoleArn] = None,
    tags: Optional[TagList] = None,
) -> CreateFlowDefinitionResponse

Creates a flow definition.

Parameters:

  • flow_definition_name (Optional[FlowDefinitionName], default: None ) –

    The name of your flow definition.

  • human_loop_request_source (Optional[HumanLoopRequestSource], default: None ) –

    Container for configuring the source of human task requests. Use to specify if Amazon Rekognition or Amazon Textract is used as an integration source.

  • human_loop_activation_config (Optional[HumanLoopActivationConfig], default: None ) –

    An object containing information about the events that trigger a human workflow.

  • human_loop_config (Optional[HumanLoopConfig], default: None ) –

    An object containing information about the tasks the human reviewers will perform.

  • output_config (Optional[FlowDefinitionOutputConfig], default: None ) –

    An object containing information about where the human review results will be uploaded.

  • role_arn (Optional[RoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the role needed to call other services on your behalf. For example, arn:aws:iam::1234567890:role/service-role/AmazonSageMaker-ExecutionRole-20180111T151298.

  • tags (Optional[TagList], default: None ) –

    An array of key-value pairs that contain metadata to help you categorize and organize a flow definition. Each tag consists of a key and a value, both of which you define.

Raises:

  • ResourceInUse –

    Resource being accessed is in use.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_flow_definition(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    flow_definition_name: Optional[
        "capo_sagemaker.types.flow_definition_name.FlowDefinitionName"
    ] = None,
    human_loop_request_source: Optional[
        "capo_sagemaker.types.human_loop_request_source.HumanLoopRequestSource"
    ] = None,
    human_loop_activation_config: Optional[
        "capo_sagemaker.types.human_loop_activation_config.HumanLoopActivationConfig"
    ] = None,
    human_loop_config: Optional[
        "capo_sagemaker.types.human_loop_config.HumanLoopConfig"
    ] = None,
    output_config: Optional[
        "capo_sagemaker.types.flow_definition_output_config.FlowDefinitionOutputConfig"
    ] = None,
    role_arn: Optional["capo_sagemaker.types.role_arn.RoleArn"] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_flow_definition_response.CreateFlowDefinitionResponse":
    """<p>Creates a flow definition.</p>

    Args:
        flow_definition_name: <p>The name of your flow definition.</p>
        human_loop_request_source: <p>Container for configuring the source of human task requests. Use to specify if Amazon Rekognition or Amazon Textract is used as an integration source.</p>
        human_loop_activation_config: <p>An object containing information about the events that trigger a human workflow.</p>
        human_loop_config: <p>An object containing information about the tasks the human reviewers will perform.</p>
        output_config: <p>An object containing information about where the human review results will be uploaded.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the role needed to call other services on your behalf. For example, <code>arn:aws:iam::1234567890:role/service-role/AmazonSageMaker-ExecutionRole-20180111T151298</code>.</p>
        tags: <p>An array of key-value pairs that contain metadata to help you categorize and organize a flow definition. Each tag consists of a key and a value, both of which you define.</p>

    Raises:
        capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_flow_definition_request.CreateFlowDefinitionRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_flow_definition_response.CreateFlowDefinitionResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_flow_definition

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_flow_definition.async_create_flow_definition(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFlowDefinition")
    )
    input_: capo_sagemaker.types.create_flow_definition_request.CreateFlowDefinitionRequest = {}
    if flow_definition_name is not None:
        input_["flow_definition_name"] = flow_definition_name
    if human_loop_request_source is not None:
        input_["human_loop_request_source"] = human_loop_request_source
    if human_loop_activation_config is not None:
        input_["human_loop_activation_config"] = human_loop_activation_config
    if human_loop_config is not None:
        input_["human_loop_config"] = human_loop_config
    if output_config is not None:
        input_["output_config"] = output_config
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output