Closed wes-devore-mpulse closed 1 year ago
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
@phanikumv can you please assign this to me
Replacing import ipdb; ipdb.set_trace()
with from IPython.core import debugger; debugger.Pdb().set_trace()
worked for me in airflow 2.6.1.
With below dag
from __future__ import annotations
from pprint import pprint
import pendulum
from airflow import DAG
from airflow.decorators import task
from IPython.core import debugger
with DAG(
dag_id="ipdb",
schedule=None,
start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
catchup=False,
tags=["example"],
) as dag:
@task(task_id="print_the_context")
def print_context(ds=None, **kwargs):
"""Print the Airflow context and ds variable from the context."""
pprint(kwargs)
debugger.Pdb().set_trace()
return "Whatever you return gets printed in the logs"
print_context()
Also, the below dag is failing in airflow 2.4.0 and 26.1 for me with the same error. It doesn't look like an airflow issue.
from __future__ import annotations
from pprint import pprint
import pendulum
from airflow import DAG
from airflow.decorators import task
from IPython.core import debugger
with DAG(
dag_id="ipdb",
schedule=None,
start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
catchup=False,
tags=["example"],
) as dag:
@task(task_id="print_the_context")
def print_context(ds=None, **kwargs):
"""Print the Airflow context and ds variable from the context."""
pprint(kwargs)
import ipdb; ipdb.set_trace()
# debugger.Pdb().set_trace()
return "Whatever you return gets printed in the logs"
print_context()
This issue has been automatically marked as stale because it has been open for 30 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.
This issue has been closed because it has not received response from the issue author.
I have met same issue with ipdb
Apache Airflow version
2.6.1
What happened
We want to use "import ipdb; ipdb.set_trace()" in the task execution thread (the python callable)
This just broke when upgrading from 2.4.0 to 2.6.1.
Now we get the following stack trace:
What you think should happen instead
We should get into the ipdb debugging shell.
How to reproduce
import ipdb; ipdb.set_trace()
Operating System
Debian 11.3
Versions of Apache Airflow Providers
No response
Deployment
Astronomer
Deployment details
No response
Anything else
I reported this exact same bug back in 2.3.4, and it was fixed, but it has come back. Can we please add tests to make sure debuggers like ipdb won't break with future releases?
Are you willing to submit PR?
Code of Conduct