Skip to content

create_retraining_scheduler async

create_retraining_scheduler(
    model_name: ModelName,
    retraining_frequency: RetrainingFrequency,
    lookback_window: LookbackWindow,
    client_token: IdempotenceToken,
    *,
    config_overrides: Optional[AsyncLookoutEquipmentClientConfig] = None,
    retraining_start_date: Optional[Timestamp] = None,
    promote_mode: Optional[ModelPromoteMode] = None,
) -> CreateRetrainingSchedulerResponse

Creates a retraining scheduler on the specified model.

Parameters:

  • model_name (ModelName) –

    The name of the model to add the retraining scheduler to.

  • retraining_start_date (Optional[Timestamp], default: None ) –

    The start date for the retraining scheduler. Lookout for Equipment truncates the time you provide to the nearest UTC day.

  • retraining_frequency (RetrainingFrequency) –

    This parameter uses the ISO 8601 standard to set the frequency at which you want retraining to occur in terms of Years, Months, and/or Days (note: other parameters like Time are not currently supported). The minimum value is 30 days (P30D) and the maximum value is 1 year (P1Y). For example, the following values are valid:

    • P3M15D – Every 3 months and 15 days

    • P2M – Every 2 months

    • P150D – Every 150 days

  • lookback_window (LookbackWindow) –

    The number of past days of data that will be used for retraining.

  • promote_mode (Optional[ModelPromoteMode], default: None ) –

    Indicates how the service will use new models. In MANAGED mode, new models will automatically be used for inference if they have better performance than the current model. In MANUAL mode, the new models will not be used until they are manually activated.

  • client_token (IdempotenceToken) –

    A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one.

Raises:

  • AccessDeniedException –

    The request could not be completed because you do not have access to the resource.

  • ConflictException –

    The request could not be completed due to a conflict with the current state of the target resource.

  • InternalServerException –

    Processing of the request has failed because of an unknown error, exception or failure.

  • ResourceNotFoundException –

    The resource requested could not be found. Verify the resource ID and retry your request.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized.

  • UnknownServiceError –

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

Examples:

Creates a retraining scheduler with a specific start date

>>> await client.create_retraining_scheduler(model_name='sample-model', retraining_start_date='2024-01-01T00:00:00Z', retraining_frequency='P1M', lookback_window='P360D', client_token='sample-client-token')
Creates a retraining scheduler with manual promote mode
>>> await client.create_retraining_scheduler(model_name='sample-model', retraining_frequency='P1M', lookback_window='P360D', promote_mode='MANUAL', client_token='sample-client-token')
Source code in docs_src/capo_lookoutequipment/_services/async_lookout_equipment.py
async def create_retraining_scheduler(
    self,
    model_name: "capo_lookoutequipment.types.model_name.ModelName",
    retraining_frequency: "capo_lookoutequipment.types.retraining_frequency.RetrainingFrequency",
    lookback_window: "capo_lookoutequipment.types.lookback_window.LookbackWindow",
    client_token: "capo_lookoutequipment.types.idempotence_token.IdempotenceToken",
    *,
    config_overrides: Optional[AsyncLookoutEquipmentClientConfig] = None,
    retraining_start_date: Optional[
        "capo_lookoutequipment.types.timestamp.Timestamp"
    ] = None,
    promote_mode: Optional[
        "capo_lookoutequipment.types.model_promote_mode.ModelPromoteMode"
    ] = None,
) -> "capo_lookoutequipment.types.create_retraining_scheduler_response.CreateRetrainingSchedulerResponse":
    """<p>Creates a retraining scheduler on the specified model. </p>

    Args:
        model_name: <p>The name of the model to add the retraining scheduler to. </p>
        retraining_start_date: <p>The start date for the retraining scheduler. Lookout for Equipment truncates the time you provide to the nearest UTC day.</p>
        retraining_frequency: <p>This parameter uses the <a href="https://en.wikipedia.org/wiki/ISO_8601#Durations">ISO 8601</a> standard to set the frequency at which you want retraining to occur in terms of Years, Months, and/or Days (note: other parameters like Time are not currently supported). The minimum value is 30 days (P30D) and the maximum value is 1 year (P1Y). For example, the following values are valid:</p> <ul> <li> <p>P3M15D – Every 3 months and 15 days</p> </li> <li> <p>P2M – Every 2 months</p> </li> <li> <p>P150D – Every 150 days</p> </li> </ul>
        lookback_window: <p>The number of past days of data that will be used for retraining.</p>
        promote_mode: <p>Indicates how the service will use new models. In <code>MANAGED</code> mode, new models will automatically be used for inference if they have better performance than the current model. In <code>MANUAL</code> mode, the new models will not be used <a href="https://docs.aws.amazon.com/lookout-for-equipment/latest/ug/versioning-model.html#model-activation">until they are manually activated</a>.</p>
        client_token: <p>A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one. </p>

    Raises:
        capo_lookoutequipment.errors.access_denied_exception.AccessDeniedException: <p>The request could not be completed because you do not have access to the resource. </p>
        capo_lookoutequipment.errors.conflict_exception.ConflictException: <p> The request could not be completed due to a conflict with the current state of the target resource. </p>
        capo_lookoutequipment.errors.internal_server_exception.InternalServerException: <p> Processing of the request has failed because of an unknown error, exception or failure. </p>
        capo_lookoutequipment.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource requested could not be found. Verify the resource ID and retry your request. </p>
        capo_lookoutequipment.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_lookoutequipment.errors.validation_exception.ValidationException: <p> The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized. </p>
        capo_lookoutequipment.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Creates a retraining scheduler with a specific start date

        >>> await client.create_retraining_scheduler(model_name='sample-model', retraining_start_date='2024-01-01T00:00:00Z', retraining_frequency='P1M', lookback_window='P360D', client_token='sample-client-token')
        Creates a retraining scheduler with manual promote mode

        >>> await client.create_retraining_scheduler(model_name='sample-model', retraining_frequency='P1M', lookback_window='P360D', promote_mode='MANUAL', client_token='sample-client-token')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lookoutequipment.types.create_retraining_scheduler_request.CreateRetrainingSchedulerRequest]",
    ) -> AsyncOperationResponse[
        "capo_lookoutequipment.types.create_retraining_scheduler_response.CreateRetrainingSchedulerResponse"
    ]:
        import capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.create_retraining_scheduler

        (
            output,
            http_response,
        ) = await capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.create_retraining_scheduler.async_create_retraining_scheduler(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRetrainingScheduler")
    )
    input_: capo_lookoutequipment.types.create_retraining_scheduler_request.CreateRetrainingSchedulerRequest = {
        "model_name": model_name,
        "retraining_frequency": retraining_frequency,
        "lookback_window": lookback_window,
        "client_token": client_token,
    }
    if retraining_start_date is not None:
        input_["retraining_start_date"] = retraining_start_date
    if promote_mode is not None:
        input_["promote_mode"] = promote_mode

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