mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-22 23:17:09 +00:00
<type>(scope): <description>
[body] [footer(s)]
This commit is contained in:
@@ -4,6 +4,7 @@ import httpx
|
|||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from apps.task.models import CompetitionTaskSubmission
|
from apps.task.models import CompetitionTaskSubmission
|
||||||
|
|
||||||
@@ -12,10 +13,16 @@ from apps.task.models import CompetitionTaskSubmission
|
|||||||
def analyze_data_task(self, submission_id):
|
def analyze_data_task(self, submission_id):
|
||||||
submission = CompetitionTaskSubmission.objects.get(id=submission_id)
|
submission = CompetitionTaskSubmission.objects.get(id=submission_id)
|
||||||
try:
|
try:
|
||||||
code_url = f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}{submission.content.path}"
|
code_url = (
|
||||||
|
f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}/"
|
||||||
|
f"{urlparse(submission.content.file.url).path}"
|
||||||
|
)
|
||||||
files = [
|
files = [
|
||||||
{
|
{
|
||||||
"url": f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}{attachment.path}",
|
"url": (
|
||||||
|
f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}/"
|
||||||
|
f"{urlparse(submission.content.file.url).path}"
|
||||||
|
),
|
||||||
"bind_path": attachment.bind_at,
|
"bind_path": attachment.bind_at,
|
||||||
}
|
}
|
||||||
for attachment in submission.task.attachments.filter(
|
for attachment in submission.task.attachments.filter(
|
||||||
@@ -40,7 +47,7 @@ def analyze_data_task(self, submission_id):
|
|||||||
|
|
||||||
submission.stdout.save("output.txt", ContentFile(result["output"]))
|
submission.stdout.save("output.txt", ContentFile(result["output"]))
|
||||||
submission.result = {
|
submission.result = {
|
||||||
"correct": result["hash_match"],
|
"correct": result["correct"],
|
||||||
"hash_match": result["hash_match"],
|
"hash_match": result["hash_match"],
|
||||||
"error": result.get("error"),
|
"error": result.get("error"),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user