mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Enhance delete_job method.
This commit is contained in:
parent
9005c583ca
commit
ba838eaf1f
@ -155,7 +155,7 @@ def delete_job(job_id):
|
||||
db.session.refresh(job)
|
||||
if job.status == 'deleted':
|
||||
logger.warning('Job status is deleted.')
|
||||
time.sleep(5)
|
||||
job.delete_job()
|
||||
time.sleep(5) # Wait 5 seconds before deleteing job and job files
|
||||
job.delete_job() # See delete_job() method for further explanation
|
||||
deleted = True
|
||||
return redirect(url_for('main.dashboard'))
|
||||
|
@ -8,6 +8,7 @@ from datetime import datetime
|
||||
import os
|
||||
import shutil
|
||||
import logging
|
||||
import time
|
||||
|
||||
|
||||
class Permission:
|
||||
@ -299,7 +300,11 @@ class Job(db.Model):
|
||||
def delete_job(self):
|
||||
"""
|
||||
Delete job with given job id from database. Also delete associated job
|
||||
files
|
||||
files. Wait 5 seconds after service has been flaged for stopping and
|
||||
deleted. This method can only be used if the containers have been
|
||||
totally stopped. Contianers are still running for a few seconds after
|
||||
the associated service has been removed.
|
||||
See: https://docs.docker.com/engine/swarm/swarm-tutorial/delete-service/
|
||||
"""
|
||||
logger = logging.getLogger(__name__)
|
||||
delete_path = os.path.join('/mnt/opaque/', str(self.user_id), 'jobs',
|
||||
|
@ -104,14 +104,15 @@
|
||||
<p id="description"></p>
|
||||
<a class="waves-effect waves-light btn" id="status"></a>
|
||||
<h2>Actions:</h2>
|
||||
<!-- Confirm deletion of selected user with modal dialogue
|
||||
<!-- Confirm deletion of job with modal dialogue
|
||||
Modal Trigger-->
|
||||
<a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Job</a>
|
||||
<!-- Modal Strucutre -->
|
||||
<div id="modal-confirm-delete" class="modal">
|
||||
<div class="modal-content">
|
||||
<h4>Confirm deletion</h4>
|
||||
<p>Do you really want to delete the job {{job.title}}?</p>
|
||||
<p>Do you really want to delete the job {{job.title}}?
|
||||
All iput and output files will be permanently deleted.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="{{ url_for('main.delete_job', job_id=job.id) }}" class="modal-close waves-effect waves-green btn red"><i class="material-icons left">delete</i>Delete Job</a></a>
|
||||
|
Loading…
Reference in New Issue
Block a user