-
Notifications
You must be signed in to change notification settings - Fork 42
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
Implement sync-layer that acts as a proxy for function calls and local/api mutations #100
Comments
Some thoughts / devils advocacy. ;-)
I'm +/-0 on this since I'm not sure what the benefits may be for what should be a very simple application and equally simple implementation. |
This is my proposed architecture for concurrency, shown using a subset of features of the app. SummaryIn very short, using actors with a bus. In less short, we have one major message bus where all the messages are dumped. Messages are directives that might call for an interaction with an external resource (API, DB, FS, Qubes) or a mutation of the UI. Messages are typed (Python objects subclassing
In the diagram above, we can see that the UI elements only have to maintain a reference to the AdvantagesThis simplifies the logic so that actors only have to be able to fire to the bus or their direct descendants. There is no deeply intertwined referencing. This also has the advantage of not splitting Actors is a simpler pattern than nested callbacks. This allows us to ensure strict ordering of replies (one actor per DisadvantagesWe have to make sure actor references are cleared on widget destruction to ensure that we don't leave dangling actors everywhere. We have to sort out something with like There is no clean stack for debugging (but also messages are self contained, so there's less external dependencies). RationaleThe arguments against this have been that the SDC is a small, simple app, but even pre-alpha we are already seeing a bunch of concurrency related issues, and I want to avoid the "oh jeez we actually need a mutex/lock here because...". Once we hit that point, we won't back things out and rearchitect, but we'll just wedge it in. Problems So Far
However, the biggest problem I see with the current architecture is the degree to which things are mocked for simple tests. I think this architecture will significantly decrease the amount of mocking we have to do. Example Workflo
|
Also as a note, @joshuathayer did some work setting up actors to use Qt's builtins so that it would a Qt-native actor system. |
As you'll see from #128, I'm totally sold on this. ;-) @heartsucker the example workflow makes sense to me. I took some time to take a quick look for PyQt / native Qt actor / message bus type implementations and turned up nothing useful, so it looks like we're doing this ourselves and @joshuathayer's initial spike would be a good place to start. For the rest of today (Thursday) and tomorrow I'm not on SD things, but I'll keep tabs on the discussion around this ticket. |
It seems that using actors in Qt is definitely "a thing", as noted here: https://github.com/actor-framework/actor-framework/tree/eb1cc7b1e911cffcd7ea196cc8d30553db239000/examples/qtsupport There are python bindings for it here: https://github.com/actor-framework/python However, there may be issues with the maintenance of the lib as noted here: actor-framework/actor-framework#775 |
there were definitely some very good ideas in here, but we ended up addressing many of the pain points that this is solving via:
So I'm going to close this. |
Add hash for 3.9 pyyaml wheel for bullseye support
I should have posted my notes last night after talking to @joshuathayer, but in short we are considering using an actor-model sync layer, possibly based off his prototype.
The idea would be to use the actors as publishers / subscribers to an internal message bus instead of using callbacks. Each actor would handle a specific message type such as
SendReplyRequst
andSendReplyResponse
. The calling function would push a message on to the bus and then listen for relevant responses. This would allow us to isolate each widget's state and allow a widget to control how it looks. It would also isolate the API/DB state away from the rest of the system, with this only being handled in the sync layer.The text was updated successfully, but these errors were encountered: