Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 7ae60fa6 authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

Feature #729 ok

parent e65fb6e1
......@@ -73,7 +73,8 @@ function del_tag() {
// delete products
function del_prod(segid) {
lst = document.getElementByName('checkbox_p') ;
var lst = document.getElementsByName('checkbox_p') ;
var url="del_lst_prod?segid="+segid+"&taskid=";
for (var i=0;i<lst.length;i++){
if(lst[i].checked){
......
......@@ -364,7 +364,7 @@ class Web:
def _get_children(self, segid):
""" Append dowmstream pipeline instance paths to the current path.
""" Return the list of pipeline instance paths which depend on seg
Return a list which contains all downstream segment instances
id for a given segment instance. This is used to delete all dependencies.
......@@ -389,6 +389,32 @@ class Web:
lstid += self._get_children(l[0])
return lstid
def _get_children_task(self, taskid):
""" Return the list of tasks which depend on task.
Return a list which contains all downstream task instances
id for a given task instance. This is used to delete all dependencies.
Parameters
----------
taskid: id of the task
Returns
-------
list of taskid, for the downstream task instances.
"""
lstid = [int(taskid)]
conn = sqlite3.connect(self.db_file,check_same_thread=True)
with conn:
fids = conn.execute(
'select child_id from task_relations where father_id = ?'
,(taskid,)).fetchall()
conn.close()
if fids:
for l in fids:
lstid += self._get_children_task(l[0])
return lstid
@cherrypy.expose
@read_access
......@@ -424,7 +450,7 @@ class Web:
Parameters
----------
segid: string, list of pipe id '-' separated
lst_seg: integer list
"""
## remove everyboby
conn = sqlite3.connect(self.db_file,check_same_thread=True)
......@@ -452,6 +478,34 @@ class Web:
if lst_seg:
self._delseg(lst_seg)
def _deltask(self, lst_task):
""" Delete a tasks instances.
Delete all products directories of a tasks instance.
Parameters
----------
lst_tag: string, list of pipe id '-' separated
"""
## remove everyboby
conn = sqlite3.connect(self.db_file,check_same_thread=True)
taskid = lst_task[0]
with conn:
str_input = conn.execute('select str_input from tasks where task_id = ?',(int(taskid),)).fetchone()[0]
lst_task.remove(taskid)
## delete from tasks_relations
l = conn.execute('delete from task_relations where child_id = ? ',(int(taskid),))
## delete from tasks
l = conn.execute('delete from tasks where task_id = ?',(int(taskid),))
conn.close()
try:
shutil.rmtree(str_input)
except:
pass
if lst_task:
self._deltask(lst_task)
@cherrypy.expose
@write_access
......@@ -493,17 +547,16 @@ class Web:
taskid: string, list of task id '-' separated
"""
cherrypy.log.error_log.warning('called ONCE')
tasklist = tasklist.split("-")
tasklist = taskid.split("-")
## build list including dependencies
final_list = []
for taskid in tasklist:
if taskid:
pass
#final_list= final_list+self._get_children_task(segid, taskid)
final_list= final_list+self._get_children_task(taskid)
## empty the list
#self._deltask(final_list)
self._deltask(final_list)
raise cherrypy.HTTPRedirect('/'+self.name+'/',303)
@cherrypy.expose
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment