This commit is contained in:
Egor Matveev 2022-02-07 22:41:18 +03:00
parent cbd4c7987f
commit b0fab1cc25
2 changed files with 9 additions and 6 deletions

View File

@ -30,10 +30,10 @@ class Command(BaseCommand):
print(e) print(e)
solution.result = "TE" solution.result = "TE"
solution.save() solution.save()
# finally: finally:
# path = join("solutions", str(id)) path = join("solutions", str(id))
# if exists(path): if exists(path):
# rmtree(path) rmtree(path)
channel.basic_consume(queue="test", on_message_callback=callback, auto_ack=True) channel.basic_consume(queue="test", on_message_callback=callback, auto_ack=True)
channel.start_consuming() channel.start_consuming()

View File

@ -42,8 +42,11 @@ class BaseTester:
if exists(join(self.path, "checker.py")): if exists(join(self.path, "checker.py")):
with open(join(self.path, 'expected.txt'), 'w') as fs: with open(join(self.path, 'expected.txt'), 'w') as fs:
fs.write(self.predicted) fs.write(self.predicted)
call(f"docker run --name solution_{self.solution.id}_checker --volume=/sprint-data/solutions/{self.solution.id}:/app -t -d python:3.6", shell=True) try:
code = call(f'docker exec -i solution_{self.solution.id}_checker sh -c "cd app && python checker.py"', shell=True, timeout=1) call(f"docker run --name solution_{self.solution.id}_checker --volume=/sprint-data/solutions/{self.solution.id}:/app -t -d python:3.6", shell=True)
code = call(f'docker exec -i solution_{self.solution.id}_checker sh -c "cd app && python checker.py"', shell=True, timeout=1)
finally:
call(f"docker rm --force solution_{self.solution.id}_checker", shell=True)
if code != 0: if code != 0:
raise TestException("WA") raise TestException("WA")
else: else: