AWS system test: example_batch. Add logs for debugging purposes (#31599)
diff --git a/tests/system/providers/amazon/aws/example_batch.py b/tests/system/providers/amazon/aws/example_batch.py
index a035b12..db5a6a5 100644
--- a/tests/system/providers/amazon/aws/example_batch.py
+++ b/tests/system/providers/amazon/aws/example_batch.py
@@ -16,6 +16,7 @@
# under the License.
from __future__ import annotations
+import logging
from datetime import datetime
import boto3
@@ -37,6 +38,8 @@
split_string,
)
+log = logging.getLogger(__name__)
+
DAG_ID = "example_batch"
# Externally fetched variables:
@@ -94,6 +97,15 @@
)
+# Only describe the job if a previous task failed, to help diagnose
+@task(trigger_rule=TriggerRule.ONE_FAILED)
+def describe_job(job_id):
+ client = boto3.client("batch")
+ response = client.describe_jobs(jobs=[job_id])
+ log.info("Describing the job %s for debugging purposes", job_id)
+ log.info(response["jobs"])
+
+
@task(trigger_rule=TriggerRule.ALL_DONE)
def delete_job_definition(job_definition_name):
client = boto3.client("batch")
@@ -250,6 +262,7 @@
submit_batch_job,
wait_for_batch_job,
# TEST TEARDOWN
+ describe_job(submit_batch_job.output),
disable_job_queue(batch_job_queue_name),
wait_for_job_queue_modified,
delete_job_queue(batch_job_queue_name),