mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Remove unnecessary job status
This commit is contained in:
parent
0ea03983d6
commit
0cb51a34c4
@ -322,9 +322,14 @@ class Job(db.Model):
|
|||||||
"""
|
"""
|
||||||
Delete the job and its inputs and outputs from database and filesystem.
|
Delete the job and its inputs and outputs from database and filesystem.
|
||||||
"""
|
"""
|
||||||
self.status = 'stopping'
|
if self.status != 'complete' and self.status != 'failed':
|
||||||
|
self.status = 'canceling'
|
||||||
|
db.session.commit()
|
||||||
|
while self.status != 'canceled':
|
||||||
|
# In case the daemon started a submitted job meanwhile
|
||||||
|
if self.status == 'running':
|
||||||
|
self.status = 'canceling'
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
while self.status != 'deleted':
|
|
||||||
sleep(1)
|
sleep(1)
|
||||||
db.session.refresh(self)
|
db.session.refresh(self)
|
||||||
path = os.path.join(current_app.config['NOPAQUE_STORAGE'],
|
path = os.path.join(current_app.config['NOPAQUE_STORAGE'],
|
||||||
|
@ -51,15 +51,15 @@ def service(service):
|
|||||||
db.session.add(job)
|
db.session.add(job)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
relative_dir = os.path.join(str(job.user_id), 'jobs', str(job.id))
|
relative_dir = os.path.join(str(job.user_id), 'jobs', str(job.id))
|
||||||
absolut_dir = os.path.join(
|
absolut_dir = os.path.join(current_app.config['NOPAQUE_STORAGE'],
|
||||||
current_app.config['NOPAQUE_STORAGE'], relative_dir)
|
relative_dir)
|
||||||
try:
|
try:
|
||||||
os.makedirs(absolut_dir)
|
os.makedirs(absolut_dir)
|
||||||
except OSError:
|
except OSError:
|
||||||
job.delete()
|
job.delete()
|
||||||
flash('Internal Server Error')
|
flash('Internal Server Error')
|
||||||
return make_response(
|
return make_response({'redirect_url': url_for('services.service',
|
||||||
{'redirect_url': url_for('services.service', service=service)},
|
service=service)},
|
||||||
500)
|
500)
|
||||||
else:
|
else:
|
||||||
for file in add_job_form.files.data:
|
for file in add_job_form.files.data:
|
||||||
|
Loading…
Reference in New Issue
Block a user