http
This commit is contained in:
parent
8b772f25bb
commit
cc3d9b409f
@ -1,6 +1,5 @@
|
|||||||
from os import listdir, mkdir
|
from os import listdir, mkdir
|
||||||
from os.path import join, exists
|
from os.path import join, exists
|
||||||
from shutil import copyfile, rmtree
|
|
||||||
from subprocess import call, TimeoutExpired
|
from subprocess import call, TimeoutExpired
|
||||||
|
|
||||||
from Main.management.commands.bot import bot
|
from Main.management.commands.bot import bot
|
||||||
@ -62,10 +61,10 @@ class BaseTester:
|
|||||||
for file in SolutionFile.objects.filter(solution=self.solution):
|
for file in SolutionFile.objects.filter(solution=self.solution):
|
||||||
dirs = file.path.split('/')
|
dirs = file.path.split('/')
|
||||||
for i in range(len(dirs) - 1):
|
for i in range(len(dirs) - 1):
|
||||||
name = join(str(self.solution.id), '/'.join(dirs[:i + 1]))
|
name = join(str("solutions/" + self.solution.id), '/'.join(dirs[:i + 1]))
|
||||||
if not exists(name):
|
if not exists(name):
|
||||||
mkdir(name)
|
mkdir(name)
|
||||||
with open(join(str(self.solution.id), file.path), 'wb') as fs:
|
with open(join("solutions/" + str(self.solution.id), file.path), 'wb') as fs:
|
||||||
fs.write(get_bytes(file.fs_id))
|
fs.write(get_bytes(file.fs_id))
|
||||||
self.solution.result = CONSTS["testing_status"]
|
self.solution.result = CONSTS["testing_status"]
|
||||||
self.solution.save()
|
self.solution.save()
|
||||||
@ -74,7 +73,7 @@ class BaseTester:
|
|||||||
call(docker_command, shell=True)
|
call(docker_command, shell=True)
|
||||||
print("Container created")
|
print("Container created")
|
||||||
for file in ExtraFile.objects.filter(task=self.solution.task):
|
for file in ExtraFile.objects.filter(task=self.solution.task):
|
||||||
with open(join(str(self.solution.id), file.filename), 'wb') as fs:
|
with open(join("solutions/" + str(self.solution.id), file.filename), 'wb') as fs:
|
||||||
fs.write(get_bytes(file.fs_id))
|
fs.write(get_bytes(file.fs_id))
|
||||||
print("Files copied")
|
print("Files copied")
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user