Skip to content

Added non-string labels in tasks.#243

Merged
s3rius merged 3 commits intodevelopfrom
feature/non-string-labels
Feb 5, 2024
Merged

Added non-string labels in tasks.#243
s3rius merged 3 commits intodevelopfrom
feature/non-string-labels

Conversation

@s3rius
Copy link
Member

@s3rius s3rius commented Nov 26, 2023

This problem was highlighted by @asvetlov in the taskiq-python/taskiq-pipelines#14.

I was thinking about possible APIs for implementation this functionality and came up with this one. Now, along with dict of labels we store dict of labels types. To minimize amount of space for this information I've chosen to use ints over anything else. This solution is not perfect, but it's the most elegant solution I could come up with.

Possible improvements for the future:

  • Add ability to add custom label types to not parse them manually.
  • Remove parse_labels method from TaskiqMessage and move it somewhere else (possibly in formatters)

This request should be backward compatible, but might brake some custom middlewares.

Signed-off-by: Pavel Kirilin <win10@list.ru>
@s3rius s3rius requested a review from chandr-andr November 26, 2023 23:57
@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (11bebcc) 77.20% compared to head (9d0326a) 77.75%.

Files Patch % Lines
taskiq/labels.py 88.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #243      +/-   ##
===========================================
+ Coverage    77.20%   77.75%   +0.55%     
===========================================
  Files           60       61       +1     
  Lines         1750     1789      +39     
===========================================
+ Hits          1351     1391      +40     
+ Misses         399      398       -1     

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

@s3rius
Copy link
Member Author

s3rius commented Nov 27, 2023

@asvetlov, mind taking a look at the request? I'd be very grateful, since this functionality affects your PR as well.

Thanks in advance.

@s3rius s3rius merged commit 00c7082 into develop Feb 5, 2024
@s3rius s3rius deleted the feature/non-string-labels branch February 5, 2024 21:36
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.

2 participants