Skip to content

Commit

Permalink
Check for right exit code, use airflow user for exec runs
Browse files Browse the repository at this point in the history
  • Loading branch information
greenape committed Dec 18, 2019
1 parent 8154a64 commit d292dab
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions flowetl/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ def wait_for_container(
"Saving airflow logs to /mounts/logs/ and outputting to stdout "
"(because FLOWETL_INTEGRATION_TESTS_SAVE_AIRFLOW_LOGS=TRUE)."
)
container.exec_run("bash -c 'cp -r $AIRFLOW_HOME/logs/* /mounts/logs/'")
container.exec_run(
"bash -c 'cp -r $AIRFLOW_HOME/logs/* /mounts/logs/'", user="airflow"
)
airflow_logs = container.exec_run(
"bash -c 'find /mounts/logs -type f -exec cat {} \;'"
)
Expand All @@ -362,15 +364,17 @@ def trigger_dags_function():
for dag in dags:
tries = 0
while True:
exit_code, result = flowetl_container.exec_run(f"airflow unpause {dag}")
exit_code, result = flowetl_container.exec_run(
f"airflow unpause {dag}", user="airflow"
)
logger.info(f"Triggered: {dag}. {result}")
if exit_code == 1:
if exit_code == 0:
break
if tries > 10:
Exception(f"Failed to unpause {dag}: {result}")
tries += 1

flowetl_container.exec_run("airflow trigger_dag etl_sensor")
flowetl_container.exec_run("airflow trigger_dag etl_sensor", user="airflow")

return trigger_dags_function

Expand Down

0 comments on commit d292dab

Please sign in to comment.