Skip to content
Snippets Groups Projects
Commit 73e8791f authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Use default database for (Partial)UpdateWorkerRun

parent 09148176
No related branches found
No related tags found
1 merge request!2489Use default database for (Partial)UpdateWorkerRun
......@@ -1488,6 +1488,7 @@ class WorkerRunDetails(ProcessACLMixin, RetrieveUpdateDestroyAPIView):
)
queryset = WorkerRun.objects \
.using("default") \
.filter(run_filters) \
.select_related("process__corpus") \
.annotate(process_has_tasks=Exists(Task.objects.filter(process=OuterRef("process_id"))))
......
......@@ -210,7 +210,16 @@ class WorkerRunSerializer(serializers.ModelSerializer):
if worker_version.model_usage == FeatureUsage.Disabled:
errors["model_version_id"].append("This worker version does not support models.")
existing_worker_run = self._process.worker_runs.filter(version=worker_version, model_version_id=model_version, configuration=configuration)
existing_worker_run = (
self._process
.worker_runs
.using("default")
.filter(
version=worker_version,
model_version_id=model_version,
configuration=configuration,
)
)
if self.instance:
# The current worker run cannot be a duplicate of itself!
existing_worker_run = existing_worker_run.exclude(id=self.instance.id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment