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