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

Fixed updating job/task status after changing job state #7901

Merged
merged 6 commits into from
May 20, 2024

Conversation

bsekachev
Copy link
Member

@bsekachev bsekachev commented May 16, 2024

Motivation and context

Resolved #7900

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the update process for job/task status to ensure accurate handling when a job's state changes to completed and the stage is already acceptance.

Copy link
Contributor

coderabbitai bot commented May 16, 2024

Warning

Rate Limit Exceeded

@bsekachev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 59 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 0a4e360 and 63789cd.

Walkthrough

The changes in the cvat/apps/engine/serializers.py file refine the handling of stage and state attributes during updates to ensure the correct status is reflected in the task API. This addresses the issue where the task status was not always set to 'completed' when the job's state changed to 'completed' and the stage was 'acceptance'.

Changes

Files/Paths Change Summary
cvat/apps/engine/serializers.py Modified the update method to handle stage and state attributes more accurately.
changelog.d/20240516_144912_boris_fixed_job_status.md Added a changelog entry describing the fix for job/task status updates.

Assessment against linked issues

Objective Addressed Explanation
Ensure task status is 'completed' when job's state changes to 'completed' and stage is 'acceptance' (#7900)

In the fields where code does bloom,
A change was made to clear the gloom.
Now tasks completed, you'll see it right,
In the API, shining bright.
With stage and state, no longer a plight,
The status now reflects the light.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 49ef2a3 and 6e3129b.
Files selected for processing (1)
  • cvat/apps/engine/serializers.py (1 hunks)
Additional Context Used
Ruff (2)
cvat/apps/engine/serializers.py (2)

703-703: f-string without any placeholders


1138-1138: f-string without any placeholders

Additional comments not posted (1)
cvat/apps/engine/serializers.py (1)

Line range hint 739-748: Ensure the logic for updating status is correct.

The logic for updating the status based on stage and state seems correct, but please verify that all possible combinations of stage and state are handled appropriately.

cvat/apps/engine/serializers.py Outdated Show resolved Hide resolved
cvat/apps/engine/serializers.py Show resolved Hide resolved
@bsekachev bsekachev changed the title [WIP] Fixed updating job/task status after changing job state Fixed updating job/task status after changing job state May 16, 2024
@bsekachev bsekachev requested a review from nmanovic as a code owner May 16, 2024 11:52
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Out of diff range and nitpick comments (2)
cvat/apps/engine/serializers.py (2)

Line range hint 703-703: Remove unnecessary f-string.

The f-string does not contain any placeholders and can be replaced with a regular string.

- f"Unexpected job type '{validated_data['type']}'"
+ "Unexpected job type '{}'".format(validated_data['type'])

Line range hint 1141-1141: Remove unnecessary f-string.

The f-string does not contain any placeholders and can be replaced with a regular string.

- f'label:create Skeleton id:{db_skeleton.id} for label_id:{db_label.id}'
+ "label:create Skeleton id:{} for label_id:{}".format(db_skeleton.id, db_label.id)
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6e3129b and 7e2ec85.
Files selected for processing (2)
  • changelog.d/20240516_144912_boris_fixed_job_status.md (1 hunks)
  • cvat/apps/engine/serializers.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • changelog.d/20240516_144912_boris_fixed_job_status.md
Additional Context Used
Ruff (2)
cvat/apps/engine/serializers.py (2)

703-703: f-string without any placeholders


1141-1141: f-string without any placeholders

Additional comments not posted (1)
cvat/apps/engine/serializers.py (1)

739-742: Ensure stage and state are correctly handled.

The logic for handling stage and state attributes looks correct. The status is set based on the combination of stage and state.

@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.34%. Comparing base (5be2246) to head (63789cd).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7901      +/-   ##
===========================================
- Coverage    83.34%   83.34%   -0.01%     
===========================================
  Files          380      380              
  Lines        40024    40023       -1     
  Branches      3766     3766              
===========================================
- Hits         33357    33356       -1     
  Misses        6667     6667              
Components Coverage Δ
cvat-ui 79.22% <ø> (+<0.01%) ⬆️
cvat-server 87.13% <100.00%> (-0.01%) ⬇️

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7e2ec85 and 3c649ac.
Files selected for processing (1)
  • cvat/apps/engine/serializers.py (1 hunks)
Additional Context Used
Ruff (2)
cvat/apps/engine/serializers.py (2)

703-703: f-string without any placeholders


1139-1139: f-string without any placeholders

Additional comments not posted (1)
cvat/apps/engine/serializers.py (1)

737-738: Ensure correct handling of stage and state attributes.

Please verify that the logic for handling stage and state attributes is correct and consistent with the intended behavior.

cvat/apps/engine/serializers.py Outdated Show resolved Hide resolved
cvat/apps/engine/serializers.py Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 3c649ac and 0a4e360.
Files selected for processing (1)
  • cvat/apps/engine/serializers.py (1 hunks)
Additional Context Used
Ruff (2)
cvat/apps/engine/serializers.py (2)

703-703: f-string without any placeholders


1138-1138: f-string without any placeholders

Additional comments not posted (3)
cvat/apps/engine/serializers.py (3)

737-739: LGTM! The logic for setting state based on stage is correct.


740-746: LGTM! The logic for setting status based on stage and state is correct.


748-749: LGTM! The logic for updating the state if it has changed is correct.

@bsekachev bsekachev merged commit 436fb19 into develop May 20, 2024
32 checks passed
@bsekachev bsekachev deleted the bs/fixed_job_status branch May 20, 2024 12:42
@cvat-bot cvat-bot bot mentioned this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong task status in task_api
2 participants