Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deregister the ECS task definition in the system test example_batch #40823

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/system/providers/amazon/aws/example_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from airflow.models.baseoperator import chain
from airflow.models.dag import DAG
from airflow.providers.amazon.aws.operators.batch import BatchCreateComputeEnvironmentOperator, BatchOperator
from airflow.providers.amazon.aws.operators.ecs import EcsDeregisterTaskDefinitionOperator
from airflow.providers.amazon.aws.sensors.batch import (
BatchComputeEnvironmentSensor,
BatchJobQueueSensor,
Expand Down Expand Up @@ -240,6 +241,12 @@ def delete_job_queue(job_queue_name):
poke_interval=10,
)

deregister_task_definition = EcsDeregisterTaskDefinitionOperator(
task_id="deregister_task",
task_definition=f"{batch_job_definition_name}:1",
trigger_rule=TriggerRule.ALL_DONE,
)

log_cleanup = prune_logs(
[
# Format: ('log group name', 'log stream prefix')
Expand Down Expand Up @@ -271,6 +278,7 @@ def delete_job_queue(job_queue_name):
wait_for_compute_environment_disabled,
delete_compute_environment(batch_job_compute_environment_name),
delete_job_definition(batch_job_definition_name),
deregister_task_definition,
log_cleanup,
)

Expand Down