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: sensor to check status of Dataform action #43055

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steve148
Copy link

@steve148 steve148 commented Oct 15, 2024

Summary

Adds a new sensor to the Google Cloud provider that waits on the status of a target in a workflow invocation.

Why might this be useful?

Right now I use Airflow to trigger a Dataform workflow on a schedule. I use the async=True argument on the DataformCreateWorkflowInvocationOperator and the DataformWorkflowInvocationStateSensor to wait until the workflow is complete before running subsequent steps. This approach is simple but comes with some tradeoffs due to its lack of granularity.

  1. If any target in the workflow fails, the sensor will also fail. If I want to have subsequent tasks run for any target that does succeed, this approach will not work.
  2. If I have multiple targets that my subsequent tasks depend on, there may be large gap between when Dataform completes the tasks. This approach has subsequent tasks run when the whole Dataform workflow is complete.

The sensor added in this PR addresses the trade offs listed above by providing a more granular sensor. Instead of waiting for the workflow to complete, it waits for a target within the workflow to complete.

@boring-cyborg boring-cyborg bot added area:providers kind:documentation provider:google Google (including GCP) related issues labels Oct 15, 2024
Copy link

boring-cyborg bot commented Oct 15, 2024

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@steve148 steve148 force-pushed the feat/dataform-workflow-invocation-action-sensor branch from daafa10 to 3257f33 Compare October 15, 2024 20:54
Copy link
Contributor

@shahar1 shahar1 left a comment

Choose a reason for hiding this comment

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

Welcome to Apache Airflow and thanks for your contribution!
Looks good overall - could you please add unit tests?

@steve148 steve148 force-pushed the feat/dataform-workflow-invocation-action-sensor branch from 3257f33 to d66355e Compare October 18, 2024 17:14
Adds a new sensor to check the status of a WorkflowInvocationAction in
Google Cloud Dataform. Heavily based on theDataformWorkflowInvocationStateSensor
which already exists.

Useful for checking the status of a specific target within a Dataform
workflow invocation and taking action based on the status.
@steve148 steve148 force-pushed the feat/dataform-workflow-invocation-action-sensor branch from d66355e to 5abd6b2 Compare October 18, 2024 17:15
@steve148
Copy link
Author

Hey @shahar1! Thanks for having me here. I rebased the branch to add unit tests and update it to the latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers kind:documentation provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants