diff --git a/server/portal/apps/webhooks/views.py b/server/portal/apps/webhooks/views.py index 702045b27..c3cdac2cf 100644 --- a/server/portal/apps/webhooks/views.py +++ b/server/portal/apps/webhooks/views.py @@ -54,6 +54,14 @@ def validate_tapis_job(job_uuid, job_owner, disallowed_states=[]): if job_data.status in disallowed_states: return None + if hasattr(job_data, 'notes') and job_data.status == 'FAILED': + notes = json.loads(job_data.notes) + + # checks to see if an interactive job ended with tapis timeout code of 0:0 + if notes.get('isInteractive', False) and job_data.remoteResultInfo == '0:0': + job_data.status = 'FINISHED' + job_data.remoteOutcome = 'FINISHED' + return job_data @@ -122,6 +130,7 @@ def post(self, request, *args, **kwargs): job_details = validate_tapis_job(job_uuid, username, disallowed_states=non_terminal_states) if job_details: event_data[Notification.EXTRA]['remoteOutcome'] = job_details.remoteOutcome + event_data[Notification.EXTRA]['status'] = job_details.status try: logger.info('Indexing job output for job={}'.format(job_uuid)) diff --git a/server/portal/apps/workspace/api/views.py b/server/portal/apps/workspace/api/views.py index b79716428..74fa93aac 100644 --- a/server/portal/apps/workspace/api/views.py +++ b/server/portal/apps/workspace/api/views.py @@ -138,6 +138,19 @@ def get(self, request, *args, **kwargs): @method_decorator(login_required, name='dispatch') class JobsView(BaseApiView): + + @staticmethod + def check_job_for_timeout(job): + if hasattr(job, 'notes') and job.status == 'FAILED': + notes = json.loads(job.notes) + + # checks to see if an interactive job ended with tapis timeout code of 0:0 + if notes.get('isInteractive', False) and job.remoteResultInfo == '0:0': + job.status = 'FINISHED' + job.remoteOutcome = 'FINISHED' + + return job + def get(self, request, operation=None): allowed_actions = ['listing', 'search', 'select'] @@ -150,6 +163,12 @@ def get(self, request, operation=None): op = getattr(self, operation) data = op(tapis, request) + if (isinstance(data, list)): + for index, job in enumerate(data): + data[index] = self.check_job_for_timeout(job) + else: + data = self.check_job_for_timeout(data) + return JsonResponse( { 'status': 200,