diff --git a/SprintLib/testers/BaseTester.py b/SprintLib/testers/BaseTester.py index fd040fd..6962651 100644 --- a/SprintLib/testers/BaseTester.py +++ b/SprintLib/testers/BaseTester.py @@ -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( diff --git a/daemons/management/commands/docker_cleaner.py b/daemons/management/commands/docker_cleaner.py index 0b19953..f08a677 100644 --- a/daemons/management/commands/docker_cleaner.py +++ b/daemons/management/commands/docker_cleaner.py @@ -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)