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

NOTE ON ExceptionGroup IN JUPYTER NOTEBOOK #29

Open
DavidT3 opened this issue Dec 7, 2022 · 0 comments
Open

NOTE ON ExceptionGroup IN JUPYTER NOTEBOOK #29

DavidT3 opened this issue Dec 7, 2022 · 0 comments
Labels
wontfix This will not be worked on

Comments

@DavidT3
Copy link
Owner

DavidT3 commented Dec 7, 2022

Very limited parts of DAXA use a new Python feature (introduced in 3.11, backported by exceptiongroup module), that allows me to raise a set of exceptions together.

Specifically this is used when Python errors occur during the parallel tasks that run command line SAS tools (and possibly other telescope specific command line tools in the future) - to be clear Python errors shouldn't happen in those parallelised tasks, but if they do an ExceptionGroup is used.

It seems that at the moment (this is true on my setup on the date this issue was created) that Jupyter notebooks do not show the tracebacks properly for ExceptionGroup. For instance in the notebook a test raised ExceptionGroup gives this traceback:

ExceptionGroup: pythony errors (3 sub-exceptions)

Whereas in a script run from terminal this is what you get (and should get):

  • Exception Group Traceback (most recent call last):
    | File "/Users/dt237/code/test_daxa/testo.py", line 12, in
    | success, errors, outs = cif_build(arch)
    | ^^^^^^^^^^^^^^^
    | File "/Users/dt237/code/DAXA/daxa/process/xmm/_common.py", line 209, in wrapper
    | raise ExceptionGroup("pythony errors", python_errors)
    | ExceptionGroup: pythony errors (3 sub-exceptions)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/opt/anaconda3/envs/daxa_dev/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    | result = (True, func(*args, **kwds))
    | ^^^^^^^^^^^^^^^^^^^
    | File "/Users/dt237/code/DAXA/daxa/process/xmm/_common.py", line 89, in execute_cmd
    | print(boi)
    | ^^^
    | NameError: name 'boi' is not defined
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    | File "/opt/anaconda3/envs/daxa_dev/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    | result = (True, func(*args, **kwds))
    | ^^^^^^^^^^^^^^^^^^^
    | File "/Users/dt237/code/DAXA/daxa/process/xmm/_common.py", line 89, in execute_cmd
    | print(boi)
    | ^^^
    | NameError: name 'boi' is not defined
    +---------------- 3 ----------------
    | Traceback (most recent call last):
    | File "/opt/anaconda3/envs/daxa_dev/lib/python3.11/multiprocessing/pool.py", line 125, in worker
    | result = (True, func(*args, **kwds))
    | ^^^^^^^^^^^^^^^^^^^
    | File "/Users/dt237/code/DAXA/daxa/process/xmm/_common.py", line 89, in execute_cmd
    | print(boi)
    | ^^^
    | NameError: name 'boi' is not defined
    +------------------------------------

So just be aware of that!

@DavidT3 DavidT3 added the wontfix This will not be worked on label Dec 7, 2022
@DavidT3 DavidT3 pinned this issue Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant