From 3734ad03546ce69a1e1d41178e30ad7d85d5ff85 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Wed, 25 May 2022 08:36:52 +0300 Subject: [PATCH] cleanup --- SprintLib/testers/BaseTester.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/SprintLib/testers/BaseTester.py b/SprintLib/testers/BaseTester.py index baf3b66..9450319 100644 --- a/SprintLib/testers/BaseTester.py +++ b/SprintLib/testers/BaseTester.py @@ -117,15 +117,14 @@ class BaseTester: }) def cleanup(self): - self.solution.save() - send_to_queue("redis", {"action": "docker", "key": "containers", "value": f"solution_{self.solution.id}"}) - if self.checker_code: - send_to_queue("redis", {"action": "docker", "key": "containers", "value": f"solution_{self.solution.id}_checker"}) + self.save_solution() + self.call(f"docker rm --force solution_{self.solution.id}") + self.call(f"docker rm --force solution_{self.solution.id}_checker") for file in self.solution.task.dockerfiles: add_name = file.filename[11:] - send_to_queue("redis", {"action": "docker", "key": "containers", "value": f"solution_container_{self.solution.id}_{add_name}"}) - send_to_queue("redis", {"action": "docker", "key": "images", "value": f"solution_image_{self.solution.id}_{add_name}"}) - send_to_queue("redis", {"action": "docker", "key": "networks", "value": f"solution_network_{self.solution.id}"}) + self.call(f"docker rm --force solution_container_{self.solution.id}_{add_name}") + self.call(f"docker image rm solution_image_{self.solution.id}_{add_name}") + self.call(f"docker network rm solution_network_{self.solution.id}") def save_progress(self): progress = Progress.objects.get(