Skip to content

create_inference_recommendations_job

create_inference_recommendations_job(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    job_name: Optional[RecommendationJobName] = None,
    job_type: Optional[RecommendationJobType] = None,
    role_arn: Optional[RoleArn] = None,
    input_config: Optional[RecommendationJobInputConfig] = None,
    job_description: Optional[RecommendationJobDescription] = None,
    stopping_conditions: Optional[RecommendationJobStoppingConditions] = None,
    output_config: Optional[RecommendationJobOutputConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateInferenceRecommendationsJobResponse

Starts a recommendation job. You can create either an instance recommendation or load test job.

Parameters:

  • job_name (Optional[RecommendationJobName], default: None ) –

    A name for the recommendation job. The name must be unique within the Amazon Web Services Region and within your Amazon Web Services account. The job name is passed down to the resources created by the recommendation job. The names of resources (such as the model, endpoint configuration, endpoint, and compilation) that are prefixed with the job name are truncated at 40 characters.

  • job_type (Optional[RecommendationJobType], default: None ) –

    Defines the type of recommendation job. Specify Default to initiate an instance recommendation and Advanced to initiate a load test. If left unspecified, Amazon SageMaker Inference Recommender will run an instance recommendation (DEFAULT) job.

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

    The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your behalf.

  • input_config (Optional[RecommendationJobInputConfig], default: None ) –

    Provides information about the versioned model package Amazon Resource Name (ARN), the traffic pattern, and endpoint configurations.

  • job_description (Optional[RecommendationJobDescription], default: None ) –

    Description of the recommendation job.

  • stopping_conditions (Optional[RecommendationJobStoppingConditions], default: None ) –

    A set of conditions for stopping a recommendation job. If any of the conditions are met, the job is automatically stopped.

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

    Provides information about the output artifacts and the KMS key to use for Amazon S3 server-side encryption.

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

    The metadata that you apply to Amazon Web Services resources to help you categorize and organize them. Each tag consists of a key and a value, both of which you define. For more information, see Tagging Amazon Web Services Resources in the Amazon Web Services General Reference.

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/sage_maker.py
def create_inference_recommendations_job(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    job_name: Optional[
        "capo_sagemaker.types.recommendation_job_name.RecommendationJobName"
    ] = None,
    job_type: Optional[
        "capo_sagemaker.types.recommendation_job_type.RecommendationJobType"
    ] = None,
    role_arn: Optional["capo_sagemaker.types.role_arn.RoleArn"] = None,
    input_config: Optional[
        "capo_sagemaker.types.recommendation_job_input_config.RecommendationJobInputConfig"
    ] = None,
    job_description: Optional[
        "capo_sagemaker.types.recommendation_job_description.RecommendationJobDescription"
    ] = None,
    stopping_conditions: Optional[
        "capo_sagemaker.types.recommendation_job_stopping_conditions.RecommendationJobStoppingConditions"
    ] = None,
    output_config: Optional[
        "capo_sagemaker.types.recommendation_job_output_config.RecommendationJobOutputConfig"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_inference_recommendations_job_response.CreateInferenceRecommendationsJobResponse":
    """<p>Starts a recommendation job. You can create either an instance recommendation or load test job.</p>

    Args:
        job_name: <p>A name for the recommendation job. The name must be unique within the Amazon Web Services Region and within your Amazon Web Services account. The job name is passed down to the resources created by the recommendation job. The names of resources (such as the model, endpoint configuration, endpoint, and compilation) that are prefixed with the job name are truncated at 40 characters.</p>
        job_type: <p>Defines the type of recommendation job. Specify <code>Default</code> to initiate an instance recommendation and <code>Advanced</code> to initiate a load test. If left unspecified, Amazon SageMaker Inference Recommender will run an instance recommendation (<code>DEFAULT</code>) job.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your behalf.</p>
        input_config: <p>Provides information about the versioned model package Amazon Resource Name (ARN), the traffic pattern, and endpoint configurations.</p>
        job_description: <p>Description of the recommendation job.</p>
        stopping_conditions: <p>A set of conditions for stopping a recommendation job. If any of the conditions are met, the job is automatically stopped.</p>
        output_config: <p>Provides information about the output artifacts and the KMS key to use for Amazon S3 server-side encryption.</p>
        tags: <p>The metadata that you apply to Amazon Web Services resources to help you categorize and organize them. Each tag consists of a key and a value, both of which you define. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a> in the Amazon Web Services General Reference.</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.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_inference_recommendations_job_request.CreateInferenceRecommendationsJobRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_inference_recommendations_job_response.CreateInferenceRecommendationsJobResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_inference_recommendations_job

        output, http_response = (
            capo_sagemaker._operations.sage_maker.create_inference_recommendations_job.create_inference_recommendations_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateInferenceRecommendationsJob")
    )
    input_: capo_sagemaker.types.create_inference_recommendations_job_request.CreateInferenceRecommendationsJobRequest = {}
    if job_name is not None:
        input_["job_name"] = job_name
    if job_type is not None:
        input_["job_type"] = job_type
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if input_config is not None:
        input_["input_config"] = input_config
    if job_description is not None:
        input_["job_description"] = job_description
    if stopping_conditions is not None:
        input_["stopping_conditions"] = stopping_conditions
    if output_config is not None:
        input_["output_config"] = output_config
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output