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 python stack traces #1554

Merged
merged 4 commits into from
Sep 22, 2024
Merged

Fix python stack traces #1554

merged 4 commits into from
Sep 22, 2024

Conversation

jmthomas
Copy link
Member

closes #1552
closes #1548

@jmthomas jmthomas requested a review from ryanmelt September 19, 2024 02:33
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 77.03%. Comparing base (5e4b7a0) to head (c548b7a).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...riptrunner/src/tools/ScriptRunner/ScriptRunner.vue 11.11% 8 Missing ⚠️
...mos-script-runner-api/app/models/running_script.rb 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1554   +/-   ##
=======================================
  Coverage   77.02%   77.03%           
=======================================
  Files         611      611           
  Lines       46000    46006    +6     
  Branches      800      802    +2     
=======================================
+ Hits        35431    35440    +9     
+ Misses      10481    10478    -3     
  Partials       88       88           
Flag Coverage Δ
frontend 55.84% <11.11%> (+0.06%) ⬆️
python 84.61% <ø> (+<0.01%) ⬆️
ruby-api 48.87% <0.00%> (+0.02%) ⬆️
ruby-backend 82.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmthomas
Copy link
Member Author

Tested with a simple script:

wait_check("INST HEALTH_STATUS COLLECTS < 0", 1)

Same output in both Ruby and Python

Also tested Suite with a simple divide by 0 error and the stack trace looks good.

The only issue is trying to raise a full stack in a much lower level method. It appears like the full stack trace isn't there like it is in Ruby. For example I tried raising an error in clear.py which is called by collect.rb and it only showed the trace from clear.py. This is the output when I print all the formatted_lines from running_script.py:1127:

 ['Traceback (most recent call last):\n', ' File "INST2/procedures/utilities/clear.py", line 4, in clear\n x = 1/0\n ~^~\n', 'ZeroDivisionError: division by zero\n']

The only thing I can think is it has something to do with the exception_instrumentation and how we're using sys.exc_info. However, this is vastly improved and will avoid a lot of unnecessary stack trace output.

@ryanmelt
Copy link
Member

ryanmelt commented Sep 20, 2024

Fix suite playwright tests

Copy link

@jmthomas jmthomas merged commit 7f405dc into main Sep 22, 2024
26 of 27 checks passed
@jmthomas jmthomas deleted the python_sr_except branch September 22, 2024 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trim Python stack traces Python Exceptions in Script Runner Test Report Are Not Formatted Correctly
2 participants