sagemaker.core.model_monitor.cron_expression_generator#

This module contains code related to the CronExpressionGenerator class.

Codes are used for generating cron expressions compatible with Amazon SageMaker Model Monitoring Schedules.

Classes

CronExpressionGenerator()

Generates cron expression strings for the SageMaker Model Monitoring Schedule API.

class sagemaker.core.model_monitor.cron_expression_generator.CronExpressionGenerator[source]#

Bases: object

Generates cron expression strings for the SageMaker Model Monitoring Schedule API.

static daily(hour=0)[source]#

Generates daily cron expression that denotes that a job runs at the top of every hour.

Parameters:

hour (int) –

The hour in HH24 format (UTC) to run the job at, on a daily schedule. .. rubric:: Examples

  • 00

  • 12

  • 17

  • 23

Returns:

The cron expression format accepted by the Amazon SageMaker Model Monitoring

Schedule API.

Return type:

str

static daily_every_x_hours(hour_interval, starting_hour=0)[source]#

Generates “daily every x hours” cron expression.

That denotes that a job runs every day at the specified hour, and then every x hours, as specified in hour_interval.

Example:
>>> daily_every_x_hours(hour_interval=2, starting_hour=0)
This will run every 2 hours starting at midnight.
>>> daily_every_x_hours(hour_interval=10, starting_hour=0)
This will run at midnight, 10am, and 8pm every day.
Parameters:
  • hour_interval (int) – The hour interval to run the job at.

  • starting_hour (int) – The hour at which to begin in HH24 format (UTC).

Returns:

The cron expression format accepted by the Amazon SageMaker Model Monitoring

Schedule API.

Return type:

str

static hourly()[source]#

Generates hourly cron expression that denotes that a job runs at the top of every hour.

Returns:

The cron expression format accepted by the Amazon SageMaker Model Monitoring

Schedule API.

Return type:

str

static now()[source]#

Returns the string used to depict the one-time schedule