Skip to content

feat: update promotion scripts to accommodate Airflow v1 and v2 (for Airflow 3 upgrade) - #454

Open
botanical wants to merge 34 commits into
mainfrom
feat/airflow3-flag
Open

botanical wants to merge 34 commits into
mainfrom
feat/airflow3-flag

Conversation

@botanical

@botanical botanical commented Sep 11, 2026

Copy link
Copy Markdown
Member

https://github.com/NASA-IMPACT/veda-architecture/issues/849

What Changed

  • I added scripts/airflow_api.py that triggers that DAGs according to the version it identifies based on env var settings
  • I updated the promotion scripts so that it would check the Airflow versions on Staging and Production (defaulting to use v2/ Airflow 3)
  • Notably, this refactor handles both Airflow 2 and Airflow 3 and allows staging and prod instances to be on different versions are we're staggering our rollout

@botanical
botanical requested a review from smohiudd as a code owner September 11, 2026 22:03

@anayeaye anayeaye left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good--was the main update just to the airflow base url?

Comment thread scripts/airflow_api.py Outdated
Comment thread scripts/promote_collection.py
Comment thread scripts/promote_collection.py Outdated
Comment thread scripts/airflow_api.py
Comment thread scripts/airflow_api.py Outdated
Comment thread scripts/promote_dataset.py Outdated
@botanical
botanical requested a review from a team September 18, 2026 21:16
else
echo "$collection_id failed to publish ❌"
exit 1
fi

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can delete this file once this PR is reviewed!

Comment thread scripts/promote_collection.py Outdated
"""Extract the HTTP status code from the AirflowAPIError
message and return 500 otherwise
"""
try:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use contextlib to suppress these errors rather than an except/pass if there's no intention to log the error

import contextlib

with contextlib.suppress(ValueError, IndexError):
   parts = error_message.split(" returns ")
   if len(parts) > 1:
      status_str = parts[1].split(":")[0]
      return int(status_str)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a style choice though - feel free to just resolve the comment

Comment thread scripts/promote_dataset.py Outdated
Comment on lines +18 to +24
try:
parts = error_message.split(" returns ")
if len(parts) > 1:
status_str = parts[1].split(":")[0]
return int(status_str)
except (ValueError, IndexError):
pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment

Comment thread scripts/promote_dataset.py Outdated
Comment on lines +64 to +65
status_code = _extract_http_status_code(str(e))
print(json.dumps({"statusCode": status_code, "error": str(e)}))

@jjfrench jjfrench Sep 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this raise? 🤷🏼‍♂️

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily 🫨 See my comment below

Comment thread scripts/promote_dataset.py Outdated
Comment on lines +96 to +97
status_code = _extract_http_status_code(str(e))
print(json.dumps({"statusCode": status_code, "error": str(e)}))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this raise?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want it to raise necessarily because I don't want it to prematurely abort before it reports on the results of the files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I'm confused then, should we catching a different exception? AirflowAPIError reads as if the trigger_dag_run request failed and the dag never started

@jjfrench
jjfrench requested a review from a team September 21, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants