Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pdb no longer works with airflow test command since 2.3.3 #26802

Closed
ashb opened this issue Sep 30, 2022 Discussed in #26352 · 1 comment · Fixed by #26806
Closed

pdb no longer works with airflow test command since 2.3.3 #26802

ashb opened this issue Sep 30, 2022 Discussed in #26352 · 1 comment · Fixed by #26806
Labels
area:CLI kind:bug This is a clearly a bug

Comments

@ashb
Copy link
Member

ashb commented Sep 30, 2022

Converted back to issue as I've reproduced it and traced the issue back to #24362

Discussed in #26352

Originally posted by GuruComposer September 12, 2022

Apache Airflow version

2.3.4

What happened

I used to be able to use ipdb to debug DAGs by running airflow tasks test <dag_name> <dag_id>, and hitting an ipdb breakpoint (ipdb.set_trace()).

This no longer works. I get a strange type error:

    return self.dispatch_line(frame)
  File "/usr/local/lib/python3.9/bdb.py", line 112, in dispatch_line
    self.user_line(frame)
  File "/usr/local/lib/python3.9/pdb.py", line 262, in user_line
    self.interaction(frame, None)
  File "/home/astro/.local/lib/python3.9/site-packages/IPython/core/debugger.py", line 336, in interaction
    OldPdb.interaction(self, frame, traceback)
  File "/usr/local/lib/python3.9/pdb.py", line 357, in interaction
    self._cmdloop()
  File "/usr/local/lib/python3.9/pdb.py", line 322, in _cmdloop
    self.cmdloop()
  File "/usr/local/lib/python3.9/cmd.py", line 126, in cmdloop
    line = input(self.prompt)
TypeError: an integer is required (got type NoneType)```



### What you think should happen instead

I should get the ipdb shell.

### How to reproduce

1. Add ipdb breakpoint anywhere in airflow task.
import ipdb; ipdb.set_trace()

2. Run that task:
Run `airflow tasks test <dag_name> <dag_id>`, and 

### Operating System

Debian GNU/Linux

### Versions of Apache Airflow Providers

2.3.4
@ashb ashb added kind:bug This is a clearly a bug area:CLI labels Sep 30, 2022
@ashb
Copy link
Member Author

ashb commented Sep 30, 2022

Minimal repro:

from contextlib import redirect_stdout
from airflow.utils.log.secrets_masker import RedactedIO


with redirect_stdout(RedactedIO()):
    breakpoint()
    ...
airflow ❯ python testredir.py   
[0] > /home/ash/code/astro/upgrade-test-project/testredir.py(7)<module>()
-> ...
Traceback (most recent call last):
  File "/home/ash/code/astro/upgrade-test-project/testredir.py", line 7, in <module>
    ...
  File "/home/ash/code/astro/upgrade-test-project/testredir.py", line 7, in <module>
    ...
  File "/usr/lib/python3.10/bdb.py", line 90, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python3.10/bdb.py", line 114, in dispatch_line
    self.user_line(frame)
  File "/usr/lib/python3.10/pdb.py", line 262, in user_line
    self.interaction(frame, None)
  File "/home/ash/.virtualenvs/airflow/lib/python3.10/site-packages/pdb.py", line 231, in interaction
    self._cmdloop()
  File "/usr/lib/python3.10/pdb.py", line 322, in _cmdloop
    self.cmdloop()
  File "/usr/lib/python3.10/cmd.py", line 126, in cmdloop
    line = input(self.prompt)
TypeError: 'NoneType' object cannot be interpreted as an integer

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area:CLI kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant