This commit is contained in:
Egor Matveev 2022-05-25 08:36:52 +03:00
parent 05d6fdf034
commit 3734ad0354

View File

@ -117,15 +117,14 @@ class BaseTester:
}) })
def cleanup(self): def cleanup(self):
self.solution.save() self.save_solution()
send_to_queue("redis", {"action": "docker", "key": "containers", "value": f"solution_{self.solution.id}"}) self.call(f"docker rm --force solution_{self.solution.id}")
if self.checker_code: self.call(f"docker rm --force solution_{self.solution.id}_checker")
send_to_queue("redis", {"action": "docker", "key": "containers", "value": f"solution_{self.solution.id}_checker"})
for file in self.solution.task.dockerfiles: for file in self.solution.task.dockerfiles:
add_name = file.filename[11:] add_name = file.filename[11:]
send_to_queue("redis", {"action": "docker", "key": "containers", "value": f"solution_container_{self.solution.id}_{add_name}"}) self.call(f"docker rm --force solution_container_{self.solution.id}_{add_name}")
send_to_queue("redis", {"action": "docker", "key": "images", "value": f"solution_image_{self.solution.id}_{add_name}"}) self.call(f"docker image rm 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 network rm solution_network_{self.solution.id}")
def save_progress(self): def save_progress(self):
progress = Progress.objects.get( progress = Progress.objects.get(