Skip to content
Open
20 changes: 20 additions & 0 deletions backend/app/celery/tasks/job_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,26 @@ def run_delete_collection_job(
)


@celery_app.task(bind=True, queue="low_priority", priority=1)
@gevent_timeout(settings.CELERY_TASK_SOFT_TIME_LIMIT, "run_evaluation_batch_submission")
def run_evaluation_batch_submission(
self, project_id: int, job_id: str, trace_id: str, **kwargs
):
from app.services.evaluations.batch_job import execute_evaluation_batch_submission

_set_trace(trace_id)
return _run_with_otel_parent(
self,
lambda: execute_evaluation_batch_submission(
project_id=project_id,
job_id=job_id,
task_id=current_task.request.id,
task_instance=self,
**kwargs,
),
)


@celery_app.task(bind=True, queue="low_priority", priority=1)
@gevent_timeout(settings.CELERY_TASK_SOFT_TIME_LIMIT, "run_stt_batch_submission")
def run_stt_batch_submission(
Expand Down
18 changes: 18 additions & 0 deletions backend/app/celery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,24 @@ def start_delete_collection_job(
return task_id


def start_evaluation_batch_submission(
project_id: int, job_id: str, trace_id: str = "N/A", **kwargs
) -> str:
from app.celery.tasks.job_execution import run_evaluation_batch_submission

task_id = _enqueue_with_trace_context(
run_evaluation_batch_submission,
project_id=project_id,
job_id=job_id,
trace_id=trace_id,
**kwargs,
)
logger.info(
f"[start_evaluation_batch_submission] Started job {job_id} with Celery task {task_id}"
)
return task_id


def start_stt_batch_submission(
project_id: int, job_id: str, trace_id: str = "N/A", **kwargs
) -> str:
Expand Down
2 changes: 1 addition & 1 deletion backend/app/core/batch/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def upload_file(self, content: str, purpose: str = "batch") -> str:
uploaded_file = self._upload_to_gemini(
content=content,
suffix=".jsonl",
mime_type="jsonl",
mime_type="application/jsonl",
display_name=f"batch-input-{int(time.time())}",
)

Expand Down
3 changes: 2 additions & 1 deletion backend/app/core/batch/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def start_batch_job(
logger.error(f"[start_batch_job] Failed | {e}", exc_info=True)

batch_job_update = BatchJobUpdate(
error_message=f"Batch creation failed: {str(e)}"
provider_status="failed",
error_message=f"Batch creation failed: {str(e)}",
)
update_batch_job(
session=session, batch_job=batch_job, batch_job_update=batch_job_update
Expand Down
Loading
Loading