apply languages
This commit is contained in:
parent
cdcdff6651
commit
bcc1bff6d8
@ -15,5 +15,3 @@ RUN pip install requests
|
||||
COPY . /usr/src/app/
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
|
||||
docker run --name runner --volume=/var/run/docker.sock:/var/run/docker.sock --privileged -e TOKEN=1DGan0xqx51N^wN@i7aqcF@npzrZJr runner
|
@ -1,6 +1,7 @@
|
||||
from multiprocessing import Process
|
||||
from os import getenv
|
||||
from os.path import join
|
||||
from os import getenv, mkdir
|
||||
from os.path import join, exists
|
||||
from shutil import rmtree
|
||||
from tempfile import TemporaryDirectory
|
||||
from time import sleep
|
||||
from zipfile import ZipFile
|
||||
@ -51,7 +52,9 @@ def main():
|
||||
sleep(2)
|
||||
continue
|
||||
elif data.status_code == 201:
|
||||
with TemporaryDirectory() as tempdir:
|
||||
tempdir = "/var/tmp/solution/"
|
||||
try:
|
||||
mkdir(tempdir)
|
||||
result = process_solution(
|
||||
tempdir,
|
||||
data.content,
|
||||
@ -64,6 +67,9 @@ def main():
|
||||
"solution_id": data.headers['solution_id'],
|
||||
"result": result
|
||||
})
|
||||
finally:
|
||||
if exists(tempdir):
|
||||
rmtree(tempdir)
|
||||
elif data.status_code == 403:
|
||||
print("token removed")
|
||||
exit(1)
|
||||
|
@ -34,6 +34,7 @@ class BaseTester:
|
||||
raise TestException("CE")
|
||||
|
||||
def test(self, filename):
|
||||
print('testing ' + filename)
|
||||
code = self.exec_command(
|
||||
f"< {filename} {self.command} > output.txt",
|
||||
timeout=self.timeout / 1000,
|
||||
|
@ -26,7 +26,7 @@ class SolutionsTableView(BaseView):
|
||||
|
||||
def filter_set(self, queryset: QuerySet):
|
||||
if 'set_id' in self.request.GET:
|
||||
return queryset.filter(task__settasks__set_id=self.request.GET['set_id']).distinct()
|
||||
return queryset.filter(set_id=self.request.GET['set_id']).distinct()
|
||||
return queryset
|
||||
|
||||
def pre_handle(self):
|
||||
|
Loading…
Reference in New Issue
Block a user