rusty-celery
rusty-celery copied to clipboard
Implement Redis backend
I would like to take this, do you have any thoughts, suggestions, guideline that I should consider before jumping into it?
Hey @morenol! That would be great. I think the steps to tackle this are as follows:
- Start by designing a
Backendtrait, and show how theCeleryapp would interact with it. You could submit this as a PR or even just post a code-block in this thread with some explanation. - Figure out how Python's Celery implements the Redis backend under the hood. In particular, we need to know the serialization format and which Redis functionality is used so that we can be compatible with the Python implementation. This might be the hardest part since the internals of Python Celery are not well documented.
- Implement the
RedisBackendbased on what we've found in Step 2. - Add unit tests and integration tests.
- Bonus points: add an integration test that checks cross compatibility with the Python implementation.
That sounds like a good plan!
I have been working on this somewhat as I would personally find it useful. AsyncResult still needs altering to work with backends, AsyncBackend and ResultConsumer are also not finished. The parallel to Message/Delivery for backends still needs to be settled. And lastly, none of the actual hooking up of backends in the main app has been finished nor have tests been written.
Despite the work remaining, a code review would be very helpful at this point as well as some architectural discussion. If anyone is willing to engage I will drop a PR. As of now it compiles and all of the previous functionality works despite any changes. Test cases are also giving same results as before.
If there is interest, I will compose a more detailed write up of the work alongside the PR. Otherwise I will just keep hacking along on my own. 👍
Hi folks! For anyone interested, I implemented a very quick and dirty persistence backend for the project I'm working on. The code is under this task_records module:
- types – The
TaskRecordtype, which records a task execution result. - redis_impl –
RedisTaskRecords, which implements saving and retrievingTaskRecordvalues, and provides a helper to send tasks and retrieve their results as one action. - callbacks – Task
on_success/on_failurecallbacks to save results usingRedisTaskRecords.
This implementation only covers our project's most immediate needs, so it has a lot of limitations and cautions, but it might provide a useful reference point for further work on this issue.
This PR is awesome. Any way we can complete the review and merge it?