mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +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)
|
db.session.refresh(job)
|
||||||
if job.status == 'deleted':
|
if job.status == 'deleted':
|
||||||
logger.warning('Job status is deleted.')
|
logger.warning('Job status is deleted.')
|
||||||
time.sleep(5)
|
time.sleep(5) # Wait 5 seconds before deleteing job and job files
|
||||||
job.delete_job()
|
job.delete_job() # See delete_job() method for further explanation
|
||||||
deleted = True
|
deleted = True
|
||||||
return redirect(url_for('main.dashboard'))
|
return redirect(url_for('main.dashboard'))
|
||||||
|
@ -8,6 +8,7 @@ from datetime import datetime
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
class Permission:
|
class Permission:
|
||||||
@ -299,7 +300,11 @@ class Job(db.Model):
|
|||||||
def delete_job(self):
|
def delete_job(self):
|
||||||
"""
|
"""
|
||||||
Delete job with given job id from database. Also delete associated job
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
delete_path = os.path.join('/mnt/opaque/', str(self.user_id), 'jobs',
|
delete_path = os.path.join('/mnt/opaque/', str(self.user_id), 'jobs',
|
||||||
|
@ -104,14 +104,15 @@
|
|||||||
<p id="description"></p>
|
<p id="description"></p>
|
||||||
<a class="waves-effect waves-light btn" id="status"></a>
|
<a class="waves-effect waves-light btn" id="status"></a>
|
||||||
<h2>Actions:</h2>
|
<h2>Actions:</h2>
|
||||||
<!-- Confirm deletion of selected user with modal dialogue
|
<!-- Confirm deletion of job with modal dialogue
|
||||||
Modal Trigger-->
|
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>
|
<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 -->
|
<!-- Modal Strucutre -->
|
||||||
<div id="modal-confirm-delete" class="modal">
|
<div id="modal-confirm-delete" class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<h4>Confirm deletion</h4>
|
<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>
|
||||||
<div class="modal-footer">
|
<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>
|
<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