Skip to content

create_model_monitor_config

create_model_monitor_config(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    model_monitor_config_name: Optional[ModelMonitorConfigName] = None,
    monitoring_source: Optional[MonitoringSource] = None,
    evaluation_config: Optional[EvaluationConfig] = None,
    schedule_config: Optional[ModelMonitorScheduleConfig] = None,
    role_arn: Optional[RoleArn] = None,
    tags: Optional[TagList] = None,
    client_token: Optional[ModelMonitorClientToken] = None,
) -> CreateModelMonitorConfigResponse

Creates a model monitor configuration.

The operation runs synchronously and is idempotent. If you retry the request with the same ClientToken, you get the result of the original request.

This operation is in public preview release for Amazon SageMaker AI and is subject to change. This feature is not recommended for production environments.

Parameters:

  • model_monitor_config_name (Optional[ModelMonitorConfigName], default: None ) –

    The name of the model monitor configuration.

  • monitoring_source (Optional[MonitoringSource], default: None ) –

    The source that the model monitor configuration monitors.

  • evaluation_config (Optional[EvaluationConfig], default: None ) –

    The evaluation monitoring settings. Specify EvaluationConfig.

  • schedule_config (Optional[ModelMonitorScheduleConfig], default: None ) –

    The schedule on which the model monitor configuration runs.

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

    The Amazon Resource Name (ARN) of the IAM role that the model monitor configuration uses.

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

    A list of key-value pairs to apply to the model monitor configuration. For information about tagging, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference.

  • client_token (Optional[ModelMonitorClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token, you get the result of the original request and no error.

Raises:

  • ConflictException –

    There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

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

  • ResourceNotFound –

    Resource being access is not found.

  • 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_model_monitor_config(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    model_monitor_config_name: Optional[
        "capo_sagemaker.types.model_monitor_config_name.ModelMonitorConfigName"
    ] = None,
    monitoring_source: Optional[
        "capo_sagemaker.types.monitoring_source.MonitoringSource"
    ] = None,
    evaluation_config: Optional[
        "capo_sagemaker.types.evaluation_config.EvaluationConfig"
    ] = None,
    schedule_config: Optional[
        "capo_sagemaker.types.model_monitor_schedule_config.ModelMonitorScheduleConfig"
    ] = None,
    role_arn: Optional["capo_sagemaker.types.role_arn.RoleArn"] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
    client_token: Optional[
        "capo_sagemaker.types.model_monitor_client_token.ModelMonitorClientToken"
    ] = None,
) -> "capo_sagemaker.types.create_model_monitor_config_response.CreateModelMonitorConfigResponse":
    """<p>Creates a model monitor configuration.</p> <p>The operation runs synchronously and is idempotent. If you retry the request with the same <code>ClientToken</code>, you get the result of the original request.</p> <note> <p>This operation is in public preview release for Amazon SageMaker AI and is subject to change. This feature is not recommended for production environments.</p> </note>

    Args:
        model_monitor_config_name: <p>The name of the model monitor configuration.</p>
        monitoring_source: <p>The source that the model monitor configuration monitors.</p>
        evaluation_config: <p>The evaluation monitoring settings. Specify <code>EvaluationConfig</code>.</p>
        schedule_config: <p>The schedule on which the model monitor configuration runs.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that the model monitor configuration uses.</p>
        tags: <p>A list of key-value pairs to apply to the model monitor configuration. For information about tagging, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a> in the <i>Amazon Web Services General Reference</i>.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token, you get the result of the original request and no error.</p>

    Raises:
        capo_sagemaker.errors.conflict_exception.ConflictException: <p>There was a conflict when you attempted to modify a SageMaker entity such as an <code>Experiment</code> or <code>Artifact</code>.</p>
        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.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_model_monitor_config_request.CreateModelMonitorConfigRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_model_monitor_config_response.CreateModelMonitorConfigResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_model_monitor_config

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateModelMonitorConfig")
    )
    input_: capo_sagemaker.types.create_model_monitor_config_request.CreateModelMonitorConfigRequest = {}
    if model_monitor_config_name is not None:
        input_["model_monitor_config_name"] = model_monitor_config_name
    if monitoring_source is not None:
        input_["monitoring_source"] = monitoring_source
    if evaluation_config is not None:
        input_["evaluation_config"] = evaluation_config
    if schedule_config is not None:
        input_["schedule_config"] = schedule_config
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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