Giter VIP home page Giter VIP logo

Comments (3)

dosubot avatar dosubot commented on June 3, 2024 4

🤖

Hello @Santhin! I'm Dosu, a friendly bot here to assist you in resolving issues, answering queries, and helping you become a contributor. While we wait for a human maintainer to assist further, I'm here to help you as best as I can!

Thank you for providing such a detailed description of the issue you're facing. It seems like the TestBehavior.AFTER_ALL option is not behaving as expected due to the way the build_airflow_graph function is structured in the Cosmos codebase.

In the current implementation, the TestBehavior.AFTER_ALL option creates a single test task after all the "leaf" tasks in the DAG. A leaf task is one that does not have any downstream tasks. The test task is created and then added as a downstream task to all the leaf tasks. However, the seeds are also considered as leaf tasks, which means that the test task is being run concurrently with the seed tasks, leading to the errors you're experiencing.

Here is the relevant code snippet from the build_airflow_graph function:

if test_behavior == TestBehavior.AFTER_ALL:
    test_meta = create_test_task_metadata(
        f"{dbt_project_name}_test",
        execution_mode,
        test_indirect_selection,
        task_args=task_args,
        on_warning_callback=on_warning_callback,
    )
    test_task = create_airflow_task(test_meta, dag, task_group=task_group)
    leaves_ids = calculate_leaves(tasks_ids=list(tasks_map.keys()), nodes=nodes)
    for leaf_node_id in leaves_ids:
        tasks_map[leaf_node_id] >> test_task

(Source: cosmos/airflow/graph.py)

To resolve this issue, you would need to modify the logic in the build_airflow_graph function to ensure that the test task is only run after all other tasks, including the seed tasks, have completed. This could involve creating a separate group for the seed tasks and ensuring that the test task is only run after this group has completed.

I also found a similar issue that was resolved in the Cosmos repository: Configure testing behavior. This issue was closed by a commit on January 10, 2023, which refactored the parsing and generation of tasks to support different testing types (after_each, after_all, none). This might provide some insights into how to handle your issue.

I hope this helps! If you have any further questions or need more clarification, please let me know.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

from astronomer-cosmos.

dosubot avatar dosubot commented on June 3, 2024 2

Hi, @Santhin,

I'm helping the Cosmos team manage their backlog and am marking this issue as stale. From what I understand, you raised an issue regarding unexpected behavior of the TestBehavior.AFTER_ALL option in the astronomer-cosmos on K8s using kind and airflow helm chart. Dosubot provided a detailed analysis of the issue and suggested a modification to the logic in the build_airflow_graph function to ensure the test task runs after all other tasks, including the seed tasks, have completed. You later inquired about any updates on the issue.

Could you please confirm if this issue is still relevant to the latest version of the Cosmos repository? If it is, please let the Cosmos team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or the issue will be automatically closed in 7 days.

Thank you for your understanding and cooperation. If you have any further questions or need assistance, feel free to reach out.

from astronomer-cosmos.

Santhin avatar Santhin commented on June 3, 2024

Any updates on this?

from astronomer-cosmos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.