Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
Fix bug that prevented inclusion of tool results
Browse files Browse the repository at this point in the history
  • Loading branch information
HACKERMD committed Nov 14, 2016
1 parent 9992c65 commit f2ec795
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/app/src/core/Viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,25 @@ class Viewer {
var monitor = () => {
this._$http.get('/api/experiments/' + this.experiment.id + '/tools/status?submission_id=' + submissionId)
.then((resp: any) => {
var st = resp.data.data;
var didJobEnd = st.state === 'TERMINATING' || st.state === 'TERMINATED';
var jobSuccessful = didJobEnd && st.exitcode === 0;
var jobFailed = st.state === didJobEnd && st.exitcode == 1;
if (didJobEnd) {
this._$interval.cancel(subscription);
}
if (jobSuccessful) {
this._getAndHandleToolResult(st.submission_id);
}
if (jobFailed) {
// TODO: Handle error
var results = resp.data.data;
if (results.length === 0) {
console.log('ERROR: No result found with submission_id ' + submissionId);
} else if (results.length > 1) {
console.log('ERROR: Multiple results founds for submission_id ' + submissionId);
} else {
var st = results[0];
var didJobEnd = st.state === 'TERMINATING' || st.state === 'TERMINATED';
var jobSuccessful = didJobEnd && st.exitcode === 0;
var jobFailed = st.state === didJobEnd && st.exitcode == 1;
if (didJobEnd) {
this._$interval.cancel(subscription);
}
if (jobSuccessful) {
this._getAndHandleToolResult(st.submission_id);
}
if (jobFailed) {
// TODO: Handle error
}
}
});
};
Expand Down

0 comments on commit f2ec795

Please sign in to comment.