memory limit

This commit is contained in:
Egor Matveev
2022-05-09 19:51:11 +03:00
parent 512bca4024
commit 1a6bf13b96
7 changed files with 70 additions and 3 deletions

View File

@@ -37,7 +37,9 @@ class BaseTester:
f"< {filename} {self.command} > output.txt",
timeout=self.solution.task.time_limit / 1000,
)
if code != 0:
if code == 1:
raise TestException("ML")
elif code != 0:
raise TestException("RE")
result = (
open(join(self.path, "output.txt"), "r")
@@ -157,7 +159,7 @@ class BaseTester:
fs.write(bts)
print("Files copied")
self._setup_networking()
docker_command = f"docker run --network solution_network_{self.solution.id} --name solution_{self.solution.id} --volume={self.path}:/{self.working_directory} -t -d {self.solution.language.image}"
docker_command = f"docker run --network solution_network_{self.solution.id} --name solution_{self.solution.id} --memory=\"{self.solution.task.memory_limit}k\" --volume={self.path}:/{self.working_directory} -t -d {self.solution.language.image}"
print(docker_command)
call(docker_command, shell=True)
checker = self.solution.task.checkerfile