Skip to content
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

Process Commands #198

Merged
merged 17 commits into from
Jun 15, 2022
Merged

Process Commands #198

merged 17 commits into from
Jun 15, 2022

Conversation

U8NWXD
Copy link
Member

@U8NWXD U8NWXD commented May 27, 2022

Introduce process commands to support more interactions with parallel processes. Now all Process methods of a parallelized process can be queried from the parent OS process. Users can also add support for custom methods of their processes.

This change also simplifies the way Engine handles parallel processes warns users when serializers are not being found efficiently.

TODO:

  • Add safety checks to make sure users don't send commands or get command results out of order
  • Make sending commands private?
    • Decided not to make this private because since we want users to be able to use commands for subclass methods, commands need to be part of the public API
  • Thoroughly test parallelization and process commands
  • Change Engine to put ParallelProcess instances in the store hierarchy
  • Eliminate invoke_process function that doesn't do anything

By creating this pull request, I agree to the Contributor License
Agreement, which is available in CLA.md at the top level of this
repository.

@U8NWXD U8NWXD changed the title Add functions to support processes commands Process Commands May 27, 2022
U8NWXD added 3 commits May 28, 2022 17:15
We don't expect users to be changing public Process attributes like
Process.parameters. This commit introduces public getters to communicate
that these are read-only attributes.
vivarium/core/engine.py Outdated Show resolved Hide resolved
U8NWXD added 7 commits June 3, 2022 10:21
Instead of holding ParallelProcess objects in a separate Engine.parallel
dictionary, put them in place of their associated Process objects in
Engine.processes, Engine.process_paths, and Engine.state. This also
involves removing InvokeProcess and the `invoke` keyword from the Engine
constructor. While these are public, the `invoke` keyword was not
documented, and use of InvokeProcess is not discussed in our
documentation. Therefore, neither are part of our supported API, so
removing them does not constitute a breaking change.
@U8NWXD U8NWXD marked this pull request as ready for review June 13, 2022 02:58
@U8NWXD U8NWXD requested a review from a team as a code owner June 13, 2022 02:58
U8NWXD added a commit to CovertLab/vEcoli that referenced this pull request Jun 13, 2022
Requires PR vivarium-collective/vivarium-core#198, which introduces
process commands. The process commands interface lets us retrieve
internal state from parallelized EngineProcess instances.
Copy link
Member

@eagmon eagmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really good! I have no improvements. Engine is actually simpler now in many ways. Process is a bit more complicated, but I think it all makes sense and is required.

@prismofeverything -- Can you give this a look, since it is a major design decision?

vivarium/core/engine.py Show resolved Hide resolved
vivarium/core/engine.py Show resolved Hide resolved
vivarium/core/engine.py Show resolved Hide resolved
@U8NWXD U8NWXD requested a review from prismofeverything June 14, 2022 00:40
Copy link
Contributor

@prismofeverything prismofeverything left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Chris, this is an excellent feature! I think we should keep it, and treat our processes as "services" essentially in this way, which sets the groundwork for a fully distributed implementation. Some minor comments but really it's good to go.

doc/guides/processes.rst Show resolved Hide resolved
vivarium/core/engine.py Show resolved Hide resolved
vivarium/core/engine.py Show resolved Hide resolved
vivarium/core/engine.py Show resolved Hide resolved
vivarium/core/process.py Show resolved Hide resolved
vivarium/core/process.py Show resolved Hide resolved
vivarium/core/process.py Outdated Show resolved Hide resolved
vivarium/core/process.py Show resolved Hide resolved
vivarium/core/process.py Show resolved Hide resolved
vivarium/library/dict_utils.py Show resolved Hide resolved
U8NWXD added 5 commits June 14, 2022 17:57
With the move to Process Commands, we stopped parallelizing processes in
`Engine._invoke_process` and instead performed parallelization in the
constructor. This had the unintended effect of not parallelizing
processes with the `parallel` attribute if they were produced by
division. This commit ensures that these processes are parallelized as
well.
@U8NWXD U8NWXD merged commit 65a3257 into master Jun 15, 2022
@U8NWXD U8NWXD deleted the process-commands branch June 15, 2022 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants