Conversation
|
Addresses #31 |
|
|
||
| 2. Resolve long-standing design bugs in our implementation. | ||
|
|
||
| 3. Modernize the code to support Python3+. |
There was a problem hiding this comment.
We don't know yet but it's likely to be 3.7+ or even 3.10+ (in case we want to use pattern matching).
There was a problem hiding this comment.
3.10+ may also have some niceities with async libraries although I don't think exception groups is landing in 3.10 (https://www.python.org/dev/peps/pep-0654/)
There was a problem hiding this comment.
That will probably hit 3.11 or higher and it will take time for Trio and AnyIO to adapt.
There was a problem hiding this comment.
Another nice thing about 3.10 in my opinion is that it makes:
from __future__ import annotation completely optional, and 3.10 has a number of type-hinting improvements.
How important do you think being able to have a nicely type-hinted codebase is, vs. supporting 3.7/3.8/3.9+? We could do the typing_extensions workaround. But I've really loved seeing @thedrow's jumpstarter code with the very modern type hints, including | usage, self-referential annotations, etc. I feel like 3.10 is a pretty big milestone with that.
All of that being said though, this can all be emulated with the __future__ import and typing_extensions I think.
There was a problem hiding this comment.
this is a futuristic framework so i dont see problem using 3.10+ as problem. i would rather suggest going 3.10 straight O:) .
| Actors) communicate with each other and pass messages (referencing the Actor | ||
| model). | ||
|
|
||
| 3. Can enable the development of a future version of Celery where it can be run |
There was a problem hiding this comment.
That should be goal 1 in my opinion.
| 3. Given the complexity of the mentioned issues, it's not easy to get to the | ||
| root cause of what's happening in the first place. Because Celery is very | ||
| *asynchronous* by nature, many of the tests are wrapped with a ``flaky`` | ||
| decorator which means, sometimes (depending on the arrival of messages, speed | ||
| of IPC, speed of the network, and many other factors), maybe the test won't | ||
| pass in an expected amount of time or might not always succeed. Testing and | ||
| modeling asynchronous processes is definitely not easy, but the python | ||
| language, tooling, and libraries have evolved considerably in the last | ||
| *decade*, and Celery is well positioned for a large restructuring that allows | ||
| it both internally take advantage of the latest Python features, and also | ||
| provide external integration with them as well. |
There was a problem hiding this comment.
Perfect. 2 & 3 are exactly what I had in mind.
Co-authored-by: Omer Katz <omer.drow@gmail.com>
Co-authored-by: Omer Katz <omer.drow@gmail.com>
Co-authored-by: Omer Katz <omer.drow@gmail.com>
|
Second draft. I have not filled in the specification yet. That I'm planning to do next, and getting feedback on the higher-level direction of the CEP has been really helpful so far. This one aimed to reduce the scope a bit, and I temporarily have stored the previous draft in a different document for comparison and so that I could pull things back in as needed. I wanted to see a more simplified CEP, both in response to @thedrow's suggestion, but also to see how it would feel overall. I'm really happy about the Rationale section. I feel like it was important to review the current landscape and give clear reasons as to why we'd roll our own library than use something else out there. Also, last thought for now is that I have some formatting issues with RST/Sphinx that will need to be resolved at some point. I didn't find a quick solution to a couple, so I'll need to get more familiar with that, but I was running out of time for the day. I felt like getting another draft out was more important than fixing those for now, so ideally I'd try to get those resolved once I have a more polished/final draft out. |
|
One other thought. There may be sections from the previous draft to merge back into the current draft and/or future drafts. However, I wanted to remove them for this second draft to see what it might look like with a trimmed down scope. I liked @thedrow's comment about reducing to scope to |
thedrow
left a comment
There was a problem hiding this comment.
Glad to see some progress here.
|
|
||
| TODO: Insert Jumpstarter State Machine Diagram Here: https://user-images.githubusercontent.com/48936/107506089-43225a00-6ba6-11eb-810e-0ac14bf0e1e9.png | ||
|
|
||
| Also, in that diagram you can also see the ``Restart`` state. We propose a separate state machine which we'll call *Actor Restart State Machine* that models the Actor's state as it relates to restarts: |
There was a problem hiding this comment.
This should be a parallel state in our state machine but transitions doesn't support arbitrary parallel states, only initial parallel states.
This is an open item in our implementation to resolve.
Currently, the draft implementation nests state machines in the parent state machine and we model transitions using conditions on the transition itself.
|
@thedrow at this point, I'd say that I have an "initial draft", complete from the perspective of taking the material you had across the Jumpstarter issues (and code), trying to scope it a bit, and getting something out there. I haven't tried to come up with anything on my own at this point (minus the example at the end of the specification), but rather just tried to solidify and summarize what you've already done. The Specification feels bare/basic and mostly copy pasted (with some edits and changes as I felt would be helpful) from the various work you had around the issues. I know they were rough guidelines, but there are certain things I don't fully understand, so it was hard to write about them besides just trying to put down what you already had and clarify things a bit. Now that I've had plenty of time to really dig into your specifications, dig into the
I may add some other questions and comments if I think of more, but I'd like to have a discussion around these things at least. |
|
|
||
| Instead of returning an already existing *instance* of an ``AccountBalanceActor`` in ``@depends_on``, you can also: | ||
| 1. Use a factory method to initialize a brand new ``AccountBalanceActor`` instance (since every actor must inherit from ``Actor`` we'll define some helpful factory methods in ``Actor`` which can be used by all subclasses/instances). | ||
| 2. Return a subclass of ``Actor`` and it will be initialized for you, proiding all the arguments are available for that actor. This uses the `Inversion of Control`_ pattern. How this works will be left as an implementation detail, but Jumpstarter, given that it knows each ``Actor``'s dependencies and has them all in a graph should be able to satisfy dependencies and inject arguments as long as it's able to find them in an accessible way. |
At the time of writing (2021-05-09), very WIP initial draft. I only filled out an abstract which I think is probably too long, but I wanted to get my thoughts out there and hopefully at least start discussing things.
The motivation I also started to fill out. I'm not entirely sure where I want to go with that exactly yet, but wanted to get things going. I think it's important to me to show how the actor model and actor system can be a really great foundation for next-gen Celery, and also clearly explain why it's a win vs. other trade-offs.
I'm not familiar enough, at this point, with the internal details of a lot of the Celery components enough, in my opinion, to make authoritative claims about certain things, etc., but I do really think that composable tasks and messages via an actor system is the way to go, and I want to argue that case well, etc.