airflow.providers.amazon.aws.triggers.sagemaker

Module Contents

Classes

SageMakerTrigger

SageMakerTrigger is fired as deferred class with params to run the task in triggerer.

class airflow.providers.amazon.aws.triggers.sagemaker.SageMakerTrigger(job_name, job_type, poke_interval=30, max_attempts=None, aws_conn_id='aws_default')[source]

Bases: airflow.triggers.base.BaseTrigger

SageMakerTrigger is fired as deferred class with params to run the task in triggerer.

Parameters
  • job_name (str) – name of the job to check status

  • job_type (str) – Type of the sagemaker job whether it is Transform or Training

  • poke_interval (int) – polling period in seconds to check for the status

  • max_attempts (int | None) – Number of times to poll for query state before returning the current state, defaults to None.

  • aws_conn_id (str) – AWS connection ID for sagemaker

serialize()[source]

Serializes SagemakerTrigger arguments and classpath.

hook()[source]
async run()[source]

Runs the trigger in an asynchronous context.

The trigger should yield an Event whenever it wants to fire off an event, and return None if it is finished. Single-event triggers should thus yield and then immediately return.

If it yields, it is likely that it will be resumed very quickly, but it may not be (e.g. if the workload is being moved to another triggerer process, or a multi-event trigger was being used for a single-event task defer).

In either case, Trigger classes should assume they will be persisted, and then rely on cleanup() being called when they are no longer needed.

Was this entry helpful?