Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: RND-98: correct response schema for tasks.get() #6012

Merged
merged 15 commits into from
Jun 21, 2024
Merged

Conversation

niklub
Copy link
Collaborator

@niklub niklub commented Jun 18, 2024

Calling tasks.get() returns error due to incorrect Task schema

@github-actions github-actions bot added the fix label Jun 18, 2024
Copy link

netlify bot commented Jun 18, 2024

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit fcf37ee
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/667548f54b8ccf0008d3a4c7

Copy link

netlify bot commented Jun 18, 2024

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit fcf37ee
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/667548f5707cdc0008dd1e05

@niklub niklub requested review from makseq and triklozoid June 18, 2024 21:59
Copy link
Member

@makseq makseq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failed in LS and LSE

annotators = serializers.SerializerMethodField(required=False, read_only=True)
predictions = PredictionSerializer(required=False, many=True, default=[], read_only=True)
annotations = AnnotationsDMFieldSerializer(required=False, many=True, default=[], read_only=True)
drafts = AnnotationDraftDMFieldSerializer(required=False, many=True, default=[], read_only=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will break the call of DataManagerTaskSerializer::get_drafts() + LseTaskSerializer::get_drafts()

some-2024-06-19_00.20.54.mp4

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed for predictions and drafts - schemas were rewritten manually on top of serializers.SerializerMethodField

drafts = serializers.SerializerMethodField(required=False, read_only=True)
annotators = serializers.SerializerMethodField(required=False, read_only=True)
predictions = PredictionSerializer(required=False, many=True, default=[], read_only=True)
annotations = AnnotationsDMFieldSerializer(required=False, many=True, default=[], read_only=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might affect the calls of LseTaskSerializer::get_annotations() and LseTaskSerializerForAnnotators::get_annotations() from LSE

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

predictions = PredictionSerializer(required=False, many=True, default=[], read_only=True)
annotations = AnnotationsDMFieldSerializer(required=False, many=True, default=[], read_only=True)
drafts = AnnotationDraftDMFieldSerializer(required=False, many=True, default=[], read_only=True)
annotators = AnnotatorsDMField(required=False, read_only=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same problem as with get_drafts() + LseTaskSerializer::get_annotators()

@@ -222,7 +270,7 @@ class DataManagerTaskSerializer(TaskSerializer):
predictions_model_versions = serializers.SerializerMethodField(required=False)
avg_lead_time = serializers.FloatField(required=False)
draft_exists = serializers.BooleanField(required=False)
updated_by = serializers.SerializerMethodField(required=False, read_only=True)
updated_by = UpdatedByDMField(required=False, read_only=True)
Copy link
Member

@makseq makseq Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same problem as with get_drafts()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure the problem does appear for this field as well? As it is just as shallow override over serializers.SerializerMethodField

@@ -34,8 +34,8 @@
'comment_count': 0,
'unresolved_comment_count': 0,
'last_comment_updated_at': '2024-01-15T09:30:00Z',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should be like this:
2024-06-18T23:45:46.048490Z

pls, fix created_at and updated_at too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe it's better to use the full version of api/tasks response:

{
  "id": 13,
  "predictions": [],
  "annotations": [],
  "drafts": [],
  "annotators": [],
  "inner_id": 2,
  "cancelled_annotations": 0,
  "total_annotations": 0,
  "total_predictions": 0,
  "completed_at": null,
  "annotations_results": "",
  "predictions_results": "",
  "predictions_score": null,
  "file_upload": "6b25fc23-some_3.mp4",
  "storage_filename": null,
  "annotations_ids": "",
  "predictions_model_versions": "",
  "avg_lead_time": null,
  "draft_exists": false,
  "updated_by": [],
  "data": {
    "image": "/data/upload/1/6b25fc23-some_3.mp4"
  },
  "meta": {},
  "created_at": "2024-06-18T23:45:46.048490Z",
  "updated_at": "2024-06-18T23:45:46.048538Z",
  "is_labeled": false,
  "overlap": 1,
  "comment_count": 0,
  "unresolved_comment_count": 0,
  "last_comment_updated_at": null,
  "project": 1,
  "comment_authors": []
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

nik and others added 2 commits June 19, 2024 12:57
Hi @niklub!

This PR was
[created](https://github.com/HumanSignal/label-studio/actions/runs/9580652200)
in a response to PRs in upstream repos:
- HumanSignal/label-studio-sdk#252

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: bmartel <brandonmartel@gmail.com>
Co-authored-by: robot-ci-heartex <robot-ci-heartex@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: niklub <nikolai@heartex.com>
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.76%. Comparing base (dbeba0f) to head (fcf37ee).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6012      +/-   ##
===========================================
+ Coverage    76.71%   76.76%   +0.05%     
===========================================
  Files          168      168              
  Lines        13582    13602      +20     
===========================================
+ Hits         10419    10442      +23     
+ Misses        3163     3160       -3     
Flag Coverage Δ
pytests 76.76% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@niklub
Copy link
Collaborator Author

niklub commented Jun 21, 2024

/git merge develop

Workflow run
Successfully merged: 19 files changed, 242 insertions(+), 181 deletions(-)

@niklub niklub merged commit 19afc18 into develop Jun 21, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants