Repository navigation
Replies: 1 comment 1 reply
|
It does look nicer than hardcoded strings, but I've already been using constants in the decorator to name the entrypoint and reference later, so wouldn't make that much difference 🤷 Wait, but also, why do you need to pass in |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Enhance the
entrypointdecorator to add anenqueuemethod to the decorated functions. This will allow developers to enqueue jobs directly from the entrypoint function, reducing repetitive code and simplifying job management. The new method should incorporate the existingenqueuelogic from thequeriesclass, allowing seamless integration and reuse of the current functionality. The new method should be implemented in a type-safe manner to maintain consistency and reliability. While this feature may not be suitable for all users, it could significantly simplify life for those who need to enqueue jobs within the same process.Feature Summary:
entrypointdecorator to automatically attach anenqueuemethod to decorated functions. This method will enable direct job enqueuing, simplifying job queue management by utilizing the currentenqueuelogic in thequeriesclass.enqueuemethod is type-safe using Python'sProtocolandcast()for proper type-checking support. This ensures compatibility with tools like MyPy and provides reliable type hints in IDEs.enqueuemethod will allow developers to enqueue jobs with minimal code, making job processing functions more self-contained.Usage Example:
With the updated decorator, the usage would look like this:
This update makes the decorated function more versatile, enabling both execution and enqueuing in a unified and type-safe manner.
Acceptance Criteria:
enqueuemethod is attached to decorated functions, allowing direct enqueuing with equivalent capabilities to the existingqueries.enqueue()method.__call__andenqueuemethods to ensure proper function signature representation.enqueuemethod are fully type-safe.All reactions