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

Add task timeout support. #1317

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

Conversation

t0momi219
Copy link
Contributor

@t0momi219 t0momi219 commented Nov 12, 2024

Description

In Airflow, both DAGs and tasks can have timeout specified. Since dbt models likely have varying expected execution times for each layer, there could be cases where users want to apply timeout individually to each node.

How about having Cosmos retrieve timeout from the node metadata and apply them individually when rendering nodes?

Specifically, the expected time is specified in the model's config, which will be read accordingly.

version: 2
models:
  - name: stg_customers
    config:
      cosmos_task_timeout: 600 # Specify in seconds.

Related Issue(s)

closes #1316

Breaking Change?

Checklist

  • I have made corresponding changes to the documentation (if required)
  • I have added tests that prove my fix is effective or that my feature works

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Nov 12, 2024
@dosubot dosubot bot added the area:rendering Related to rendering, like Jinja, Airflow tasks, etc label Nov 12, 2024
cosmos/config.py Outdated Show resolved Hide resolved
Copy link
Contributor

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

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

Good idea. Can we show an example of this in one of the DAGs and potentially also mention about it somewhere in our docs?

cosmos/airflow/graph.py Outdated Show resolved Hide resolved
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Nov 18, 2024
@t0momi219
Copy link
Contributor Author

Hi @pankajkoti ,
This PR is ready for review. Could you please check this?

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.85%. Comparing base (a5de8b4) to head (4bd843a).
Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1317   +/-   ##
=======================================
  Coverage   95.85%   95.85%           
=======================================
  Files          67       67           
  Lines        3979     3982    +3     
=======================================
+ Hits         3814     3817    +3     
  Misses        165      165           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

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

LGTM. some minor suggestion inline. Thanks for dropping the SLA piece. Could you please also update the PR title & description to drop SLA & additionally reflect the renamed config key cosmos_task_timeout?

We could merge this once these minor changes are addressed & meantime hopefully @tatiana and/or @pankajastro could also get a chance to review this PR.

docs/configuration/task-timeout.rst Outdated Show resolved Hide resolved
docs/configuration/task-timeout.rst Outdated Show resolved Hide resolved
@t0momi219 t0momi219 changed the title Add task sla and timeout support. Add task timeout support. Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rendering Related to rendering, like Jinja, Airflow tasks, etc size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Task timeout and SLA support
2 participants