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: Implement running Prefect task after models #52

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kiyanmair
Copy link

@kiyanmair kiyanmair commented Nov 8, 2024

This PR adds a new optional run_task_after_model parameter to the DbtDagOptions class. When a Prefect task is provided as an argument, generate_tasks_dag will inject that task into the DAG, running it after each model.

The task must have exactly one required parameter: model_id of type str, which is supplied the value node.unique_id. This enables the Prefect task to operate according to the specific model which it is running after. Of course, tasks which don't require this parameter can simply discard it.

The implementation maintains consistency with the existing run_test_after_model parameter, and ensures that both can be used independently. If arguments are provided for both, the Prefect task depends on (waits for) the dbt test task.

Additionally, this PR removes the parameter run_test_after_model from generate_tasks_dag, which already receives dag_options where run_test_after_model and run_task_after_model are both defined. This saves unnecessary argument passing and null checking.

Resolves #51.

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.

Support running arbitrary tasks after models
1 participant