Ensure we handle external processes that fail to start. Fixes #1679

This commit is contained in:
Murtuza Zabuawala 2016-10-21 15:35:06 +01:00 committed by Dave Page
parent 8e9108e0f3
commit e6d018c44f
2 changed files with 14 additions and 5 deletions

View File

@ -209,9 +209,17 @@ class BatchProcess(object):
)
self.ecode = p.poll()
if self.ecode is not None:
# TODO:: Couldn't start execution
pass
if self.ecode is not None and self.ecode != 0:
# TODO:// Find a way to read error from detached failed process
# Couldn't start execution
p = Process.query.filter_by(
pid=self.id, user_id=current_user.id
).first()
p.start_time = p.end_time = get_current_time()
if not p.exit_code:
p.exit_code = self.ecode
db.session.commit()
def status(self, out=0, err=0):
import codecs

View File

@ -220,8 +220,9 @@ function(_, S, $, pgBrowser, alertify, pgMessages) {
setTimeout(function() { self.update(res); }, 10);
},
error: function(res) {
// Try after some time
setTimeout(function() { self.update(res); }, 10000);
// Try after some time only if job id present
if (res.status != 410)
setTimeout(function() { self.update(res); }, 10000);
}
});
},