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

Fix running debuggers inside airflow tasks test #26806

Merged
merged 1 commit into from Sep 30, 2022

Conversation

ashb
Copy link
Member

@ashb ashb commented Sep 30, 2022

Fixes #26802

As part of 2.3.3 we added redaction to output from the tasks test
command, but unfortunately that broke using a debugger with this error:

  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

(ipdb has a similar but different error)

The "fix" is to assign a fileno attribute to the object. input() needs
this to write the prompt. It feels like a "bug" that it doesn't work
without it, but as this class is only used in tasks test this is a
safe change


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

As part of 2.3.3 we added redaction to output from the tasks test
command, but unfortunately that broke using a debugger with this error:

```
  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
```

(ipdb has a similar but different error)

The "fix" is to assign a fileno attribute to the object. `input()` needs
this to write the prompt. It feels like a "bug" that it doesn't work
without it, but as this class is only used in `tasks test` this is a
safe change
@ashb ashb added this to the Airflow 2.4.2 milestone Sep 30, 2022
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label Sep 30, 2022

def test_input_builtin(self, monkeypatch):
"""
Test that when redirect is inplace the `input()` builtin works.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Test that when redirect is inplace the `input()` builtin works.
Test that when redirect is in place the `input()` builtin works.

@ashb ashb merged commit 029ebac into apache:main Sep 30, 2022
@ashb ashb deleted the breakpoint-fix-tasks-test branch September 30, 2022 17:46
ephraimbuddy pushed a commit that referenced this pull request Oct 18, 2022
As part of 2.3.3 we added redaction to output from the tasks test
command, but unfortunately that broke using a debugger with this error:

```
  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
```

(ipdb has a similar but different error)

The "fix" is to assign a fileno attribute to the object. `input()` needs
this to write the prompt. It feels like a "bug" that it doesn't work
without it, but as this class is only used in `tasks test` this is a
safe change

(cherry picked from commit 029ebac)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logging type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pdb no longer works with airflow test command since 2.3.3
4 participants