Skip to content

Commit

Permalink
Merge pull request #127 from oda-hub/no-sentry-backend-exception
Browse files Browse the repository at this point in the history
no sentry, just logging, if backend execution fails
  • Loading branch information
burnout87 authored Jan 10, 2025
2 parents 5efab90 + 1d183a5 commit 35b7b93
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions dispatcher_plugin_nb2workflow/dataserver_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def run_query(self,
task = None,
param_dict = None):

res = None
message = ''
debug_message = ''
query_out = QueryOutput()
Expand All @@ -208,16 +207,19 @@ def run_query(self,
if res.status_code == 200:
resroot = res.json()['data'] if run_asynch else res.json()

except_message = None
if resroot['exceptions']:
if resroot['exceptions']:
if isinstance(resroot['exceptions'][0], dict): # in async
except_message = resroot['exceptions'][0]['ename']+': '+res.json()['data']['exceptions'][0]['evalue']
else:
except_message = res.json()['exceptions'][0]

query_out.set_failed('Backend exception',
message='Backend failed. ' + except_message,
job_status='failed')

if resroot['exceptions'][0]['ename'] == 'AnalysisError':
query_out.set_status(1, message='Error in the backend', debug_message=except_message, job_status='failed')
else:
query_out.set_failed('Backend failed',
message='Backend failed. ' + except_message,
job_status='failed')

return res, query_out

comment_name = self.get_backend_comment(task.strip('/'))
Expand Down

0 comments on commit 35b7b93

Please sign in to comment.