-
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.
Merge branch 'main' into task/wp-209-fix-deprecated-warnings-II
- Loading branch information
Showing
8 changed files
with
75 additions
and
26 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,19 @@ | ||
/** | ||
* Checks that the field is a non-empty string | ||
* @param {Object} props - | ||
* @param {String} propName - name of the property | ||
* @param {String} componentName - name of the component | ||
* @returns {String} Message if error, otherwise null | ||
*/ | ||
|
||
export default function emptyStringValidator(props, propName, componentName) { | ||
if ( | ||
!props[propName] || | ||
typeof props[propName] !== 'string' || | ||
props[propName].replace(/ /g, '') === '' | ||
) { | ||
return new Error( | ||
`No text passed to <${componentName}> prop "${propName}". Validation failed.` | ||
); | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
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): | ||
""" | ||
Check an interactive job for timeout status and mark it as finished | ||
since Tapis does not have native support for interactive jobs yet | ||
""" | ||
|
||
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
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