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 issues related to rq job dependencies #7139

Merged
merged 13 commits into from
Dec 1, 2023
Merged

Fix issues related to rq job dependencies #7139

merged 13 commits into from
Dec 1, 2023

Conversation

Marishka17
Copy link
Contributor

@Marishka17 Marishka17 commented Nov 14, 2023

Motivation and context

This PR resolves 2 issues related to rq jobs:

  1. In some scenarios it is possible to reach a situation when X2 rq job depends on X1 -> running X1 job is moved to FailedJobRegistry and not deleted -> user creates one more X1 job that is enqueued after X2 execution. It was possible due to the second issue when a user tried to export annotations for task 1, then for task 2, and after restarting the worker container user tried again to export annotations for task 1. (cyclic dependence)
  2. Looks like in rq implementation rq jobs that depend on X job will never be enqueued when X is moved to FailedJobRegistry due to AbandonedJobError. I've submitted the issue to the rq repository.

How has this been tested?

Manually

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.


return job_ids

rq.registry.StartedJobRegistry.cleanup = custom_started_job_registry_cleanup
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment why we need override this method, and also add a link to the relevant issue

@Marishka17 Marishka17 changed the title [WIP] Fix issues related to rq job dependencies Fix issues related to rq job dependencies Nov 15, 2023
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Merging #7139 (b18226d) into develop (81da411) will increase coverage by 0.05%.
Report is 4 commits behind head on develop.
The diff coverage is 57.14%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7139      +/-   ##
===========================================
+ Coverage    81.48%   81.54%   +0.05%     
===========================================
  Files          364      365       +1     
  Lines        39883    39923      +40     
  Branches      3702     3703       +1     
===========================================
+ Hits         32499    32554      +55     
+ Misses        7384     7369      -15     
Components Coverage Δ
cvat-ui 75.62% <ø> (+0.11%) ⬆️
cvat-server 87.09% <57.14%> (-0.01%) ⬇️

@SpecLad
Copy link
Contributor

SpecLad commented Nov 22, 2023

Could you add a changelog entry?

cvat/apps/engine/utils.py Show resolved Hide resolved
cvat/apps/engine/utils.py Outdated Show resolved Hide resolved
cvat/apps/engine/utils.py Outdated Show resolved Hide resolved
cvat/apps/engine/utils.py Outdated Show resolved Hide resolved

# NOTE: we should patch implementation of original method because
# there is no enqueuing dependent jobs in original function
# https://github.com/rq/rq/issues/2006
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you already have a fix, maybe you could submit it upstream? That way we could potentially remove this hack later (or maybe not apply it in the first place, depending on how quickly the maintainers respond).

@SpecLad SpecLad merged commit 6e32868 into develop Dec 1, 2023
34 checks passed
@SpecLad SpecLad deleted the mk/fix_rq_issues branch December 1, 2023 12:05
@cvat-bot cvat-bot bot mentioned this pull request Dec 11, 2023
amjadsaadeh pushed a commit to amjadsaadeh/cvat that referenced this pull request Dec 14, 2023
This PR resolves 2 issues related to rq jobs:

1. In some scenarios it is possible to reach a situation when `X2` rq
   job depends on `X1` -> running `X1` job is moved to FailedJobRegistry
   and not deleted -> user creates one more `X1` job that is enqueued after
   `X2` execution. It was possible due to the second issue when a user
   tried to export annotations for task 1, then for task 2, and after
   restarting the worker container user tried again to export annotations
   for task 1. (cyclic dependence)

2. Looks like in rq implementation rq jobs that depend on `X` job will
   never be enqueued when `X` is moved to FailedJobRegistry due to
   AbandonedJobError. I've submitted the
   [issue](rq/rq#2006) to the rq repository.
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.

3 participants