Skip to content

Commit a2c3de2

Browse files
committed
Merge branch 'develop' into fb-bros-189/collapse-default-state
2 parents 6be670b + b7fc7f7 commit a2c3de2

File tree

35 files changed

+1686
-112
lines changed

35 files changed

+1686
-112
lines changed

docs/source/guide/custom_metric.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Set up a custom agreement metric for a specific project in Label Studio Enterpri
107107

108108
1. Within a project on the Label Studio UI, click **Settings**.
109109
2. Click **Quality**.
110-
3. Under **Annotation Agreement**:
110+
3. Under **Task agreement**:
111111
- **Metric name**: Use the drop-down menu to select **Custom agreement metric**.
112112
- **Lambda Tags**: Add tags to AWS Lambda function using the syntax `tag_name tag_value`.
113113
- **Lambda Prefix**: Select a Prefix.
@@ -140,13 +140,11 @@ Using your preferred method, create an AWS IAM role.
140140
"Version": "2012-10-17",
141141
"Statement": [
142142
{
143-
"Sid": "VisualEditor0",
144143
"Effect": "Allow",
145144
"Action": "logs:CreateLogGroup",
146145
"Resource": "arn:aws:logs:*:YOUR_AWS_ACCOUNT:*"
147146
},
148147
{
149-
"Sid": "VisualEditor1",
150148
"Effect": "Allow",
151149
"Action": [
152150
"logs:CreateLogStream",
@@ -155,6 +153,16 @@ Using your preferred method, create an AWS IAM role.
155153
"Resource": [
156154
"arn:aws:logs:*:YOUR_AWS_ACCOUNT:log-group:/aws/lambda/custom-metric-*"
157155
]
156+
},
157+
{
158+
"Effect": "Allow",
159+
"Action": [
160+
"logs:CreateLogGroup",
161+
"logs:PutRetentionPolicy"
162+
],
163+
"Resource": [
164+
"arn:aws:logs:*:YOUR_AWS_ACCOUNT:log-group:/aws/lambda/custom-metric-*"
165+
]
158166
}
159167
]
160168
}

label_studio/data_manager/managers.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,30 +708,39 @@ def update_annotation_map(obj):
708708

709709
class PreparedTaskManager(models.Manager):
710710
@staticmethod
711-
def annotate_queryset(queryset, fields_for_evaluation=None, all_fields=False, request=None):
711+
def annotate_queryset(
712+
queryset, fields_for_evaluation=None, all_fields=False, excluded_fields_for_evaluation=None, request=None
713+
):
712714
annotations_map = get_annotations_map()
713715

714716
if fields_for_evaluation is None:
715717
fields_for_evaluation = []
716718

719+
if excluded_fields_for_evaluation is None:
720+
excluded_fields_for_evaluation = []
721+
717722
first_task = queryset.first()
718723
project = None if first_task is None else first_task.project
719724

720725
# db annotations applied only if we need them in ordering or filters
721726
for field in annotations_map.keys():
722-
if field in fields_for_evaluation or all_fields:
727+
# Include field if it's explicitly requested or all_fields=True, but exclude if it's in the exclusion list
728+
if (field in fields_for_evaluation or all_fields) and field not in excluded_fields_for_evaluation:
723729
queryset.project = project
724730
queryset.request = request
725731
function = annotations_map[field]
726732
queryset = function(queryset)
727733

728734
return queryset
729735

730-
def get_queryset(self, fields_for_evaluation=None, prepare_params=None, all_fields=False):
736+
def get_queryset(
737+
self, fields_for_evaluation=None, prepare_params=None, all_fields=False, excluded_fields_for_evaluation=None
738+
):
731739
"""
732740
:param fields_for_evaluation: list of annotated fields in task
733741
:param prepare_params: filters, ordering, selected items
734742
:param all_fields: evaluate all fields for task
743+
:param excluded_fields_for_evaluation: list of fields to exclude even when all_fields=True
735744
:param request: request for user extraction
736745
:return: task queryset with annotated fields
737746
"""
@@ -740,6 +749,7 @@ def get_queryset(self, fields_for_evaluation=None, prepare_params=None, all_fiel
740749
queryset,
741750
fields_for_evaluation=fields_for_evaluation,
742751
all_fields=all_fields,
752+
excluded_fields_for_evaluation=excluded_fields_for_evaluation,
743753
request=prepare_params.request,
744754
)
745755

0 commit comments

Comments
 (0)