Skip to content

Commit d4203da

Browse files
authored
fix: Retry ValueError for airflow tests (aws#3566)
This change adds a retry to import utils from airflow in case it trys to load util from local module instead of airflow dependency
1 parent 11ff7c0 commit d4203da

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/integ/test_airflow_config.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from sagemaker.sklearn import SKLearn
4343
from sagemaker.tensorflow import TensorFlow
4444
from sagemaker.utils import sagemaker_timestamp
45-
from sagemaker.workflow import airflow as sm_airflow
4645
from sagemaker.xgboost import XGBoost
4746
from tests.integ import datasets, DATA_DIR
4847
from tests.integ.record_set import prepare_record_set_from_local_files
@@ -54,7 +53,8 @@
5453
seconds_to_sleep=6,
5554
):
5655
try:
57-
from airflow import utils
56+
import sagemaker.workflow.airflow as sm_airflow
57+
import airflow.utils as utils
5858
from airflow import DAG
5959
from airflow.providers.amazon.aws.operators.sagemaker import SageMakerTrainingOperator
6060
from airflow.providers.amazon.aws.operators.sagemaker_transform import (
@@ -64,6 +64,11 @@
6464
break
6565
except ParsingError:
6666
pass
67+
except ValueError as ve:
68+
if "Unable to configure formatter" in str(ve):
69+
print(f"Received: {ve}")
70+
else:
71+
raise ve
6772

6873
PYTORCH_MNIST_DIR = os.path.join(DATA_DIR, "pytorch_mnist")
6974
PYTORCH_MNIST_SCRIPT = os.path.join(PYTORCH_MNIST_DIR, "mnist.py")

0 commit comments

Comments
 (0)