cleaner fix final
This commit is contained in:
parent
03e5531268
commit
fb318ea59a
@ -5,7 +5,7 @@ from tempfile import TemporaryDirectory
|
||||
|
||||
from Main.models.progress import Progress
|
||||
from Sprint.settings import CONSTS
|
||||
from SprintLib.queue import notify, send_to_queue
|
||||
from SprintLib.queue import notify
|
||||
from SprintLib.utils import Timer
|
||||
|
||||
|
||||
@ -120,34 +120,6 @@ class BaseTester:
|
||||
|
||||
def cleanup(self):
|
||||
self.solution.save()
|
||||
send_to_queue(
|
||||
"cleaner", {"type": "container", "name": f"solution_{self.solution.id}"}
|
||||
)
|
||||
if self.checker_code:
|
||||
send_to_queue(
|
||||
"cleaner",
|
||||
{"type": "container", "name": f"solution_{self.solution.id}_checker"},
|
||||
)
|
||||
for file in self.solution.task.dockerfiles:
|
||||
add_name = file.filename[11:]
|
||||
send_to_queue(
|
||||
"cleaner",
|
||||
{
|
||||
"type": "container",
|
||||
"name": f"solution_container_{self.solution.id}_{add_name}",
|
||||
},
|
||||
)
|
||||
send_to_queue(
|
||||
"cleaner",
|
||||
{
|
||||
"type": "image",
|
||||
"name": f"solution_image_{self.solution.id}_{add_name}",
|
||||
},
|
||||
)
|
||||
send_to_queue(
|
||||
"cleaner",
|
||||
{"type": "network", "name": f"solution_network_{self.solution.id}"},
|
||||
)
|
||||
|
||||
def save_progress(self):
|
||||
progress = Progress.objects.get(
|
||||
|
@ -20,7 +20,7 @@ class Command(LoopWorker):
|
||||
break
|
||||
if solution_id:
|
||||
solution = Solution.objects.filter(id=solution_id).first()
|
||||
if solution is not None and (solution.result == 'In queue' or solution.result == 'Testing'):
|
||||
if solution is not None and (solution.result == 'In queue' or solution.result.startswith('Testing')):
|
||||
continue
|
||||
call(f"docker rm --force {line[-1]}", shell=True)
|
||||
solution_id = None
|
||||
@ -35,7 +35,7 @@ class Command(LoopWorker):
|
||||
break
|
||||
if solution_id:
|
||||
solution = Solution.objects.filter(id=solution_id).first()
|
||||
if solution is not None and (solution.result == 'In queue' or solution.result == 'Testing'):
|
||||
if solution is not None and (solution.result == 'In queue' or solution.result.startswith('Testing')):
|
||||
continue
|
||||
call("docker image rm " + line[0], shell=True)
|
||||
solution_id = None
|
||||
@ -50,11 +50,9 @@ class Command(LoopWorker):
|
||||
break
|
||||
if solution_id:
|
||||
solution = Solution.objects.filter(id=solution_id).first()
|
||||
if solution is not None and (solution.result == 'In queue' or solution.result == 'Testing'):
|
||||
if solution is not None and (solution.result == 'In queue' or solution.result.startswith('Testing')):
|
||||
continue
|
||||
call("docker network rm " + line[0], shell=True)
|
||||
a = 5
|
||||
a += 1
|
||||
|
||||
def handle(self, *args, **options):
|
||||
call('docker image rm $(docker images -q mathwave/sprint-repo)', shell=True)
|
||||
|
Loading…
Reference in New Issue
Block a user