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

feat: Update MWAATriggerDagsStage to pass json event to MWAA airflow dag #430

Conversation

devansh-gandhi
Copy link
Contributor

Description

Currently, MWAATriggerDagStage does not pass the sfn event to the MWAA dag. This enhancement enables to pass runtime parameters/sfn event when triggering dag. The parameters can be accessed from the dag_run.conf.

Changes Made

Changes made to MWAATriggerDagStage:

  1. Trigger dag lambda has an additional payload of the sfn event passed in body
  2. airflow command updated to pass sfn event to MWAA dag using --conf

Related Issue

#428

@anmolsgandhi anmolsgandhi added this to the 1.3.0 milestone Aug 20, 2023
@devansh-gandhi devansh-gandhi marked this pull request as draft August 20, 2023 02:01
@devansh-gandhi devansh-gandhi changed the title Update MWAATriggerDagsStage to pass json event to MWAA airflow dag feat: Update MWAATriggerDagsStage to pass json event to MWAA airflow dag Aug 20, 2023
@devansh-gandhi devansh-gandhi marked this pull request as ready for review August 20, 2023 02:05
@devansh-gandhi devansh-gandhi marked this pull request as draft August 20, 2023 02:05
@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DDKIntegrationTestsD8472609-5SCHWjldmWcf
  • Commit ID: c5c6b59
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Collaborator

@anmolsgandhi anmolsgandhi left a comment

Choose a reason for hiding this comment

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

Looks Good, i think this would be useful in all the cases where the dags needs the input from sfn event for processing. @malachi-constant would this need any test coverage?

Copy link
Contributor

@malachi-constant malachi-constant left a comment

Choose a reason for hiding this comment

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

In the case of an empty event is dags trigger DAG_ID --conf {} valid?

@devansh-gandhi
Copy link
Contributor Author

Yes, in case of an empty event, dags trigger DAG_ID --conf {} is valid.

To test this, i created a sample dag the prints out the conf. (logger.info(context['dag_run'].conf))

Scenario 1: In case of a dynamic dag ids passed through dag_path, the event body is not expected to be empty as the sfn event has the dag_ids list. The test dag completed execution and printed the dag_ids list in the logs.

Scenario 2: To test a static dag id, i triggered the dag from the mwaa ui using the "Trigger DAG w/ Config" option. The configuration JSON (conf) was set to {}. The dag completed execution and printed {}

@malachi-constant malachi-constant merged commit f03af14 into awslabs:main Aug 21, 2023
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MWAATriggerDagsStage does not pass runtime args/parameters to MWAA dag
3 participants