Skip to content

Commit

Permalink
Merge pull request #607 from sartography/dev
Browse files Browse the repository at this point in the history
Removed with app.app_context from process_erroring_workflows
  • Loading branch information
jpitts-uva authored Mar 13, 2024
2 parents 199008c + 7994f0e commit 465adb6
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions crc/services/workflow_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,31 +139,30 @@ def get_workflow_url(workflow):
return workflow_url

def process_erroring_workflows(self):
with app.app_context():
workflows = self.get_erroring_workflows()
if len(workflows) > 0:
workflow_urls = []
if len(workflows) == 1:
workflow = workflows[0]
workflows = self.get_erroring_workflows()
if len(workflows) > 0:
workflow_urls = []
if len(workflows) == 1:
workflow = workflows[0]
workflow_url_link = self.get_workflow_url(workflow)
workflow_urls.append(workflow_url_link)
message = 'There is one workflow in an error state.'
message += f'\n You can restart the workflow at {workflow_url_link}.'
else:
message = f'There are {len(workflows)} workflows in an error state.'
message += '\nYou can restart the workflows at these URLs:'
for workflow in workflows:
workflow_url_link = self.get_workflow_url(workflow)
workflow_urls.append(workflow_url_link)
message = 'There is one workflow in an error state.'
message += f'\n You can restart the workflow at {workflow_url_link}.'
else:
message = f'There are {len(workflows)} workflows in an error state.'
message += '\nYou can restart the workflows at these URLs:'
for workflow in workflows:
workflow_url_link = self.get_workflow_url(workflow)
workflow_urls.append(workflow_url_link)
message += f'\n{workflow_url_link}'

with push_scope() as scope:
scope.user = {"urls": workflow_urls}
scope.set_extra("workflow_urls", workflow_urls)
# this sends a message through sentry
capture_message(message)
# We return message so we can use it in a test
return message
message += f'\n{workflow_url_link}'

with push_scope() as scope:
scope.user = {"urls": workflow_urls}
scope.set_extra("workflow_urls", workflow_urls)
# this sends a message through sentry
capture_message(message)
# We return message so we can use it in a test
return message

@staticmethod
def test_spec(spec_id, validate_study_id=None, test_until=None, required_only=False):
Expand Down

0 comments on commit 465adb6

Please sign in to comment.