Create toy workers, actions, and messages to experiment with async#3601
Closed
karlhigley wants to merge 5 commits intoOpenMined:masterfrom
Closed
Create toy workers, actions, and messages to experiment with async#3601karlhigley wants to merge 5 commits intoOpenMined:masterfrom
karlhigley wants to merge 5 commits intoOpenMined:masterfrom
Conversation
6555ceb to
9630d9f
Compare
iamtrask
reviewed
May 25, 2020
| alice._execute_action(action) | ||
|
|
||
|
|
||
| # The global action counter should be incremented every time any worker executes an action. |
Member
There was a problem hiding this comment.
I'm interested in this counter - what is its main function?
Contributor
Author
There was a problem hiding this comment.
It provides "sequential-ness" to actions by supplying a unique "id" for compute/send actions, which allows other actions to depend on their results.
Contributor
Author
There was a problem hiding this comment.
(In other words, it's a hack, but it works for a quick and dirty simulation. If they were random, it would be harder to write a series of actions with inter-dependencies, because I'd need to write some mechanism for transmitting the ids. Here the ids can be known ahead of time, because they're assigned sequentially.)
iamtrask
reviewed
May 25, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This experimental code demonstrates running multiple workers simultaneously in a single thread with
asyncio, and shows how remote execution primitives (along the lines ofPlans/Protocols) necessarily becomeasync-aware if they containasynccross-worker communication methods.Checklist: