-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created a central utility function, added logic to determine timeout
- Loading branch information
1 parent
8a39f95
commit d9f665e
Showing
3 changed files
with
47 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import json | ||
|
||
|
||
def get_tapis_timeout_error_messages(job_id): | ||
return [ | ||
'JOBS_EARLY_TERMINATION Job terminated by Tapis because: TIME_EXPIRED', | ||
f'JOBS_USER_APP_FAILURE The user application ({job_id}) ended with remote status "TIMEOUT" and returned exit code: 0:0.' | ||
] | ||
|
||
|
||
def check_job_for_timeout(job): | ||
if (hasattr(job, 'notes')): | ||
notes = json.loads(job.notes) | ||
|
||
is_failed = job.status == 'FAILED' | ||
is_interactive = notes.get('isInteractive', False) | ||
has_timeout_message = job.lastMessage in get_tapis_timeout_error_messages(job.remoteJobId) | ||
|
||
if is_failed and is_interactive and has_timeout_message: | ||
job.status = 'FINISHED' | ||
job.remoteOutcome = 'FINISHED' | ||
|
||
return job |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters