Skip to content

Commit

Permalink
put a couple calls back to async
Browse files Browse the repository at this point in the history
  • Loading branch information
jombooth committed Dec 8, 2023
1 parent b4dc4fa commit 4fcf856
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion label_studio/data_import/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def create(self, request, *args, **kwargs):
)
)
predictions_obj = Prediction.objects.bulk_create(predictions, batch_size=settings.BATCH_SIZE)
update_tasks_counters(Task.objects.filter(id__in=tasks_ids))
start_job_async_or_sync(update_tasks_counters, Task.objects.filter(id__in=tasks_ids))
return Response({'created': len(predictions_obj)}, status=status.HTTP_201_CREATED)


Expand Down
2 changes: 1 addition & 1 deletion label_studio/data_manager/actions/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def delete_tasks_predictions(project, queryset, **kwargs):
real_task_ids = set(list(predictions.values_list('task__id', flat=True)))
count = predictions.count()
predictions.delete()
update_tasks_counters(Task.objects.filter(id__in=real_task_ids))
start_job_async_or_sync(update_tasks_counters, Task.objects.filter(id__in=real_task_ids))
return {'processed_items': count, 'detail': 'Deleted ' + str(count) + ' predictions'}


Expand Down

0 comments on commit 4fcf856

Please sign in to comment.