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

Refactor way of working with RQ meta #9082

Merged
merged 39 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2a2dc86
Add new API && remove deprecated && refactor working with rq meta
Marishka17 Feb 7, 2025
e3d6da9
Remove outdated tests
Marishka17 Feb 7, 2025
a01a8a8
Resolve conflicts
Marishka17 Feb 7, 2025
0f71c08
Rename method
Marishka17 Feb 7, 2025
a22e10f
Split RQMeta into several classes && small fixes
Marishka17 Feb 9, 2025
19a322a
Black code
Marishka17 Feb 9, 2025
f535d32
f
Marishka17 Feb 9, 2025
3c9895b
Fix typo
Marishka17 Feb 9, 2025
1762178
Revert some changes
Marishka17 Feb 10, 2025
472763c
Sort imports
Marishka17 Feb 10, 2025
d9eeecb
Remove commented code
Marishka17 Feb 10, 2025
b8f8a88
Fix var usage
Marishka17 Feb 10, 2025
6208de4
Small fixes
Marishka17 Feb 10, 2025
c9bbe48
Fix types
Marishka17 Feb 10, 2025
3b9aefc
Fix meta update
Marishka17 Feb 12, 2025
7ea0523
Resolve conflicts
Marishka17 Feb 14, 2025
0253b4e
apply comments
Marishka17 Feb 17, 2025
d15ae47
rename module && move define_dependent_job into rq.py
Marishka17 Feb 17, 2025
a16f179
Fix imports sorting
Marishka17 Feb 17, 2025
2d8fd91
Fix exception class used
Marishka17 Feb 17, 2025
f8908cb
Merge branch 'develop' into mk/refactor_working_with_rq_meta
Marishka17 Feb 17, 2025
583c09a
Resolve conflicts
Marishka17 Feb 20, 2025
78cf972
Use descriptors
Marishka17 Feb 20, 2025
0ac2010
Merge branch 'develop' into mk/refactor_working_with_rq_meta
Marishka17 Feb 20, 2025
eedf1b5
black
Marishka17 Feb 20, 2025
8ca66ff
Fix merge
Marishka17 Feb 21, 2025
9ce85ac
Small improvments
Marishka17 Feb 21, 2025
06e81a3
refactor a bit
Marishka17 Feb 21, 2025
a0b7a74
fix typos
Marishka17 Feb 21, 2025
80a9705
Apply some comments
Marishka17 Feb 24, 2025
aa58f13
Merge develop
Marishka17 Feb 24, 2025
97368ef
Update consensus app
Marishka17 Feb 24, 2025
6edd66c
sort imports
Marishka17 Feb 24, 2025
dc6780d
Fix merge
Marishka17 Feb 24, 2025
3663015
Simplify the code
Marishka17 Feb 24, 2025
976871c
Raise AttributeError when trying to set immutable attribute
Marishka17 Feb 24, 2025
227c877
Make lambda attr optional
Marishka17 Feb 24, 2025
83fc87a
Merge branch 'develop' into mk/refactor_working_with_rq_meta
Marishka17 Feb 24, 2025
9b83548
Fix exception catching
Marishka17 Feb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix typos
  • Loading branch information
Marishka17 committed Feb 21, 2025
commit a0b7a74f3f710b0368d1d1c7fcafc67a83df113d
2 changes: 1 addition & 1 deletion cvat/apps/engine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,7 @@ def get_message(self, rq_job: RQJob) -> str:
message = ''

if RQJobStatus.STARTED == rq_job_status:
message = self._base_rq_job_meta.status
message = self._base_rq_job_meta.status or message
elif RQJobStatus.FAILED == rq_job_status:
message = self._base_rq_job_meta.formatted_exception or parse_exception_message(str(rq_job.exc_info or "Unknown error"))

Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def _get_rq_response(queue, job_id):
response = { "state": "Failed", "message": job.exc_info }
else:
response = { "state": "Started" }
response['message'] = rq_job_meta.status
response['message'] = rq_job_meta.status or ""
response['progress'] = rq_job_meta.progress or 0.

return response
Expand Down
6 changes: 3 additions & 3 deletions cvat/apps/lambda_manager/rq.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LambdaRQMeta(BaseRQMeta):
)
# FUTURE-FIXME: progress should be in [0, 1] range
progress: int | None = MutableRQMetaAttribute(
RQJobMetaField.FUNCTION_ID, validator=lambda x: isinstance(x, int), optional=True
RQJobMetaField.PROGRESS, validator=lambda x: isinstance(x, int), optional=True
)

@classmethod
Expand All @@ -37,8 +37,8 @@ def build_for(
function_id: str,
):
base_meta = BaseRQMeta.build(request=request, db_obj=db_obj)
return cls(
data={
return cls.for_meta(
{
**base_meta,
RQJobMetaField.FUNCTION_ID: function_id,
RQJobMetaField.LAMBDA: True,
Expand Down
Loading