AWS Batch Operators¶
AWS Batch enables you to run batch computing workloads on the AWS Cloud. Batch computing is a common way for developers, scientists, and engineers to access large amounts of compute resources. AWS Batch removes the undifferentiated heavy lifting of configuring and managing the required infrastructure.
Prerequisite Tasks¶
To use these operators, you must do a few things:
Create necessary resources using AWS Console or AWS CLI.
Install API libraries via pip.
pip install 'apache-airflow[amazon]'
Detailed information is available Installation
AWS Batch Sensor¶
To wait on the state of an AWS Batch Job until it reaches a terminal state you can
use BatchSensor
.
wait_for_batch_job = BatchSensor(
task_id='wait_for_batch_job',
job_id=JOB_ID,
)
AWS Batch Operator¶
To submit a new AWS Batch Job and monitor it until it reaches a terminal state you can
use BatchOperator
.
submit_batch_job = BatchOperator(
task_id='submit_batch_job',
job_name=JOB_NAME,
job_queue=JOB_QUEUE,
job_definition=JOB_DEFINITION,
overrides=JOB_OVERRIDES,
)