Skip to content

Commit 0ba6eb2

Browse files
Revert "pass user to update_tasks_states and update_tasks_counters_and_task_states everywhere"
This reverts commit 8f92a5e.
1 parent 007ecb0 commit 0ba6eb2

File tree

6 files changed

+3
-29
lines changed

6 files changed

+3
-29
lines changed

label_studio/data_import/api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ def sync_import(self, request, project, preannotated_from_fields, commit_to_proj
321321
overlap_cohort_percentage_changed=False,
322322
tasks_number_changed=True,
323323
recalculate_stats_counts=recalculate_stats_counts,
324-
user=self.request.user,
325324
)
326325
logger.info('Tasks bulk_update finished (sync import)')
327326

@@ -658,7 +657,6 @@ def sync_reimport(self, project, file_upload_ids, files_as_tasks_list):
658657
'annotation_count': annotation_count,
659658
'prediction_count': prediction_count,
660659
},
661-
user=self.request.user,
662660
)
663661
logger.info('Tasks bulk_update finished (sync reimport)')
664662

label_studio/data_import/functions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ def async_import_background(
126126
overlap_cohort_percentage_changed=False,
127127
tasks_number_changed=True,
128128
recalculate_stats_counts=recalculate_stats_counts,
129-
user=user,
130129
)
131130
logger.info('Tasks bulk_update finished (async import)')
132131

@@ -373,7 +372,6 @@ def _async_reimport_background_streaming(reimport, project, organization_id, use
373372
overlap_cohort_percentage_changed=False,
374373
tasks_number_changed=True,
375374
recalculate_stats_counts=recalculate_stats_counts,
376-
user=user,
377375
)
378376
logger.info('Tasks bulk_update finished (async streaming reimport)')
379377

@@ -530,7 +528,6 @@ def _async_import_background_streaming(project_import, user):
530528
overlap_cohort_percentage_changed=False,
531529
tasks_number_changed=True,
532530
recalculate_stats_counts=recalculate_stats_counts,
533-
user=user,
534531
)
535532
logger.info('Tasks bulk_update finished (async streaming import)')
536533

@@ -614,7 +611,6 @@ def async_reimport_background(reimport_id, organization_id, user, **kwargs):
614611
overlap_cohort_percentage_changed=False,
615612
tasks_number_changed=True,
616613
recalculate_stats_counts=recalculate_stats_counts,
617-
user=user,
618614
)
619615
logger.info('Tasks bulk_update finished (async reimport)')
620616

label_studio/data_manager/actions/basic.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ def delete_tasks(project, queryset, **kwargs):
4141
count = len(tasks_ids)
4242
tasks_ids_list = [task['id'] for task in tasks_ids]
4343
project_count = project.tasks.count()
44-
45-
user = kwargs.get('request').user if 'request' in kwargs else None
46-
4744
# unlink tasks from project
4845
queryset = Task.objects.filter(id__in=tasks_ids_list)
4946
queryset.update(project=None)
@@ -59,10 +56,7 @@ def delete_tasks(project, queryset, **kwargs):
5956
start_job_async_or_sync(async_project_summary_recalculation, tasks_ids_list, project.id)
6057

6158
project.update_tasks_states(
62-
maximum_annotations_changed=False,
63-
overlap_cohort_percentage_changed=False,
64-
tasks_number_changed=True,
65-
user=user,
59+
maximum_annotations_changed=False, overlap_cohort_percentage_changed=False, tasks_number_changed=True
6660
)
6761
# emit webhooks for project
6862
emit_webhooks_for_instance(project.organization, project, WebhookAction.TASKS_DELETED, tasks_ids)

label_studio/data_manager/actions/remove_duplicates.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ def remove_duplicates(project, queryset, **kwargs):
2727
Duplicated tasks will be deleted and all annotations will be moved to the first of the duplicated tasks.
2828
Storage links will be restored for the first task.
2929
"""
30-
user = kwargs.get('request').user if 'request' in kwargs else None
3130
start_job_async_or_sync(
3231
remove_duplicates_job,
3332
project,
3433
queryset,
3534
organization_id=project.organization_id,
36-
user=user,
3735
)
3836
return {'response_code': 200}
3937

@@ -52,7 +50,6 @@ def remove_duplicates_job(project, queryset, **kwargs):
5250
overlap_cohort_percentage_changed=True,
5351
tasks_number_changed=False,
5452
from_scratch=True,
55-
user=kwargs.get('user', None),
5653
)
5754

5855

label_studio/io_storages/base_models.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import django_rq
1818
import rq
1919
import rq.exceptions
20-
from core.current_request import get_current_request
2120
from core.feature_flags import flag_set
2221
from core.redis import is_job_in_queue, is_job_on_worker, redis_connected, start_job_async_or_sync
2322
from core.utils.common import load_func
@@ -652,14 +651,8 @@ def _scan_and_create_links(self, link_class):
652651

653652
backfill_fsm_states_for_tasks(self.id, tasks_created, link_class)
654653

655-
request = get_current_request()
656-
user = request.user if request else None
657-
658654
self.project.update_tasks_states(
659-
maximum_annotations_changed=False,
660-
overlap_cohort_percentage_changed=False,
661-
tasks_number_changed=True,
662-
user=user,
655+
maximum_annotations_changed=False, overlap_cohort_percentage_changed=False, tasks_number_changed=True
663656
)
664657
if validation_errors:
665658
# sync is finished, set completed with errors status for storage info

label_studio/tasks/models.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,14 +1313,10 @@ def update_all_task_states_after_deleting_task(sender, instance, **kwargs):
13131313
but call only tasks_number_changed section
13141314
"""
13151315
try:
1316-
request = get_current_request()
1317-
user = request.user if request else None
1318-
instance.project.update_tasks_counters_and_task_states(
1319-
instance.project.tasks.all(),
1316+
instance.project.update_tasks_states(
13201317
maximum_annotations_changed=False,
13211318
overlap_cohort_percentage_changed=False,
13221319
tasks_number_changed=True,
1323-
user=user,
13241320
)
13251321
except Exception as exc:
13261322
logger.error('Error in update_all_task_states_after_deleting_task: ' + str(exc))

0 commit comments

Comments
 (0)