docker cleaner fix
This commit is contained in:
parent
93640aa1ae
commit
ced9d12914
@ -26,12 +26,26 @@ class Command(LoopWorker):
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
line = [i for i in line.split() if i]
|
line = [i for i in line.split() if i]
|
||||||
if line and line[0].startswith('solution_'):
|
if line and line[0].startswith('solution_'):
|
||||||
|
for el in line[-1].split('_'):
|
||||||
|
if el.isnumeric():
|
||||||
|
solution_id = int(el)
|
||||||
|
break
|
||||||
|
solution = Solution.objects.filter(id=solution_id).first()
|
||||||
|
if solution is not None and (solution.result == 'In queue' or solution.result == 'Testing'):
|
||||||
|
continue
|
||||||
call("docker image rm " + line[0], shell=True)
|
call("docker image rm " + line[0], shell=True)
|
||||||
result = run("docker network ls", universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
|
result = run("docker network ls", universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
|
||||||
lines = result.stdout.split('\n')[1:]
|
lines = result.stdout.split('\n')[1:]
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = [i for i in line.split() if i]
|
line = [i for i in line.split() if i]
|
||||||
if line and line[1].startswith('solution_'):
|
if line and line[1].startswith('solution_'):
|
||||||
|
for el in line[-1].split('_'):
|
||||||
|
if el.isnumeric():
|
||||||
|
solution_id = int(el)
|
||||||
|
break
|
||||||
|
solution = Solution.objects.filter(id=solution_id).first()
|
||||||
|
if solution is not None and (solution.result == 'In queue' or solution.result == 'Testing'):
|
||||||
|
continue
|
||||||
call("docker network rm " + line[0], shell=True)
|
call("docker network rm " + line[0], shell=True)
|
||||||
a = 5
|
a = 5
|
||||||
a += 1
|
a += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user