mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Make Jobs restartable when they are "complete"
This commit is contained in:
parent
f4233093c0
commit
f2a5fe3143
@ -47,8 +47,8 @@ def download_job_input(job_id, job_input_id):
|
|||||||
@admin_required
|
@admin_required
|
||||||
def restart(job_id):
|
def restart(job_id):
|
||||||
job = Job.query.get_or_404(job_id)
|
job = Job.query.get_or_404(job_id)
|
||||||
if job.status != 'failed':
|
if job.status not in ['complete', 'failed']:
|
||||||
flash('Can not restart job "{}": Status is not "failed"'.format(job.title), 'error') # noqa
|
flash('Can not restart job "{}": Status is not "complete/failed"'.format(job.title), 'error') # noqa
|
||||||
else:
|
else:
|
||||||
tasks.restart_job(job_id)
|
tasks.restart_job(job_id)
|
||||||
flash('Job "{}" has been marked to get restarted!'.format(job.title), 'job') # noqa
|
flash('Job "{}" has been marked to get restarted!'.format(job.title), 'job') # noqa
|
||||||
|
@ -410,11 +410,11 @@ class Job(db.Model):
|
|||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
'''
|
'''
|
||||||
Restart a job - only if the status is failed
|
Restart a job - only if the status is complete or failed
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if self.status != 'failed':
|
if self.status not in ['complete', 'failed']:
|
||||||
raise Exception('Could not restart job: status is not "failed"')
|
raise Exception('Could not restart job: status is not "complete/failed"') # noqa
|
||||||
shutil.rmtree(os.path.join(self.path, 'output'), ignore_errors=True)
|
shutil.rmtree(os.path.join(self.path, 'output'), ignore_errors=True)
|
||||||
shutil.rmtree(os.path.join(self.path, 'pyflow.data'), ignore_errors=True) # noqa
|
shutil.rmtree(os.path.join(self.path, 'pyflow.data'), ignore_errors=True) # noqa
|
||||||
self.end_date = None
|
self.end_date = None
|
||||||
|
Loading…
Reference in New Issue
Block a user