Skip to content

Flag on CLI airflow tasks test to attach debugger #15119

Closed

Description

@GuillaumeDesforges

Description

Any way to allow to attach a debugger when using airflow tasks test

Use case / motivation

Following discussion:

I generate DAGs dynamically using a database.
I want to debug tasks.

The doc (Debug Executor) suggests to add

if __name__ == '__main__':
  from airflow.utils.state import State
  dag.clear(dag_run_state=State.NONE)
  dag.run()

and run from IDE.

The above code snippet is something I'd rather avoid:

  • it is hard to select the right dag and tasks when they are generated automatically
  • it's a code artifact I'd rather avoid having, because everytime I test another dag, task or execution time, it creates git diffs

Are you willing to submit a PR?

No

Related Issues

Haven't seen any (?)

Activity

  1. ashb commented on Mar 31, 2021

    @ashb
    Member

    Are you aware of the the dag.cli() function? That might help you

  2. GuillaumeDesforges commented on Apr 8, 2021

    @GuillaumeDesforges
    Author

    You seem to be referring to this?

    In order to use this command, I need to hard-write in my code which DAG to use, when my script generates a lot of them. I do not want to write which dag should be tested to the git history, when it changes frequently.

  3. locked and limited conversation to collaborators on Mar 15, 2022
  4. converted this issue into a discussion #22293 on Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions