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

[BUG] Exception is not properly detected in Databricks #2455

Closed
pstanisl opened this issue Aug 8, 2022 · 4 comments
Closed

[BUG] Exception is not properly detected in Databricks #2455

pstanisl opened this issue Aug 8, 2022 · 4 comments

Comments

@pstanisl
Copy link

pstanisl commented Aug 8, 2022

If rich.traceback is installed (e.g., by a package like Kedro), the traceback of the error is, and string output for the cell in Databricks notebook, and the run is not interrupted.

The installed package (Kedro) used in our solution use rich.traceback. Therefore, putting the solution into production is impossible because the orchestration tool does not get an error output from the Databricks.

Zaznam.obrazovky.2022-08-03.v.14.44.57.mov

Platform

Click to expand

Azure Databricks single node cluster

  • OS Linux
  • Python 3.8
  • Spark 3.2.1

Report output:

╭────────────────────── <class 'rich.console.Console'> ───────────────────────╮
│ A high level console interface.                                             │
│                                                                             │
│ ╭─────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=80 None>                                                 │ │
│ ╰─────────────────────────────────────────────────────────────────────────╯ │
│                                                                             │
│     color_system = None                                                     │
│         encoding = 'utf-8'                                                  │
│             file = <PythonShellImpl.ConsoleBuffer object at 0x7f0610722670> │
│           height = 25                                                       │
│    is_alt_screen = False                                                    │
│ is_dumb_terminal = False                                                    │
│   is_interactive = False                                                    │
│       is_jupyter = False                                                    │
│      is_terminal = False                                                    │
│   legacy_windows = False                                                    │
│         no_color = False                                                    │
│          options = ConsoleOptions(                                          │
│                        size=ConsoleDimensions(width=80, height=25),         │
│                        legacy_windows=False,                                │
│                        min_width=1,                                         │
│                        max_width=80,                                        │
│                        is_terminal=False,                                   │
│                        encoding='utf-8',                                    │
│                        max_height=25,                                       │
│                        justify=None,                                        │
│                        overflow=None,                                       │
│                        no_wrap=False,                                       │
│                        highlight=None,                                      │
│                        markup=None,                                         │
│                        height=None                                          │
│                    )                                                        │
│            quiet = False                                                    │
│           record = False                                                    │
│         safe_box = True                                                     │
│             size = ConsoleDimensions(width=80, height=25)                   │
│        soft_wrap = False                                                    │
│           stderr = False                                                    │
│            style = None                                                     │
│         tab_size = 8                                                        │
│            width = 80                                                       │
╰─────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available.                           │
│                                                       │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│                                                       │
│ truecolor = False                                     │
│        vt = False                                     │
╰───────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ {                                  │
│     'TERM': 'unknown',             │
│     'COLORTERM': None,             │
│     'CLICOLOR': None,              │
│     'NO_COLOR': None,              │
│     'TERM_PROGRAM': None,          │
│     'COLUMNS': None,               │
│     'LINES': None,                 │
│     'JUPYTER_COLUMNS': None,       │
│     'JUPYTER_LINES': None,         │
│     'JPY_PARENT_PID': None,        │
│     'VSCODE_VERBOSE_LOGGING': None │
│ }                                  │
╰────────────────────────────────────╯
platform="Linux"
@pstanisl
Copy link
Author

pstanisl commented Aug 8, 2022

The workaround is to save iPython._showtraceback before installing rich.traceback and then revert it after installing.

ip = get_ipython()
ip__showtraceback = ip._showtraceback

rich.traceback.install(...)

ip._showtraceback = ip__showtraceback

The workaround is crucial for me because a dependency is installing rich.traceback while importing it, i.e., it looks like this

ip = get_ipython()
ip__showtraceback = ip._showtraceback

from kedro.framework.startup import bootstrap_project

ip._showtraceback = ip__showtraceback

@antonymilne
Copy link
Contributor

antonymilne commented Aug 8, 2022

I'm a maintainer of Kedro 🙂 We have a PR that would disable the rich.traceback.install call if the user is on Databricks: kedro-org/kedro#1769

If this can't be fixed on the rich side then we can merge that, but if it is possible to get exception handling working correctly on Databricks that would be even better 🙏

Edit: @pstanisl please check the new issue here also: #2461

@willmcgugan
Copy link
Collaborator

One for the Kendro maintainers.

Copy link

github-actions bot commented Jul 2, 2024

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants