Skip to content

Conversation

samlurye
Copy link
Contributor

@samlurye samlurye commented Oct 9, 2025

Stack from ghstack (oldest at bottom):

Previously, both HostMesh and ProcMesh stored their underlying rust mesh in an asynchronous Shared[...] pytokio object, so any attempts to access the rust meshes from a tokio thread would need to be called from a coroutine. This is a problem for pickling, which needs to be synchronous, and would therefore have to call Shared[...].block_on() to get the underlying rust mesh.

This diff makes it so that when the internal Shared[...] task for HostMesh and ProcMesh completes, the result is stored so that it can be accessed without the use of block_on(). This enables pickling HostMesh and ProcMesh inside tokio threads, as long as their backing rust meshes have finished initializing -- this will always be the case inside actor endpoints, since the HostMesh and ProcMesh both need to be done initializing by the time the actor endpoint runs.

Differential Revision: D84195494

…ead in certain cases

Previously, both `HostMesh` and `ProcMesh` stored their underlying rust mesh in an asynchronous `Shared[...]` pytokio object, so any attempts to access the rust meshes from a tokio thread would need to be called from a coroutine. This is a problem for pickling, which needs to be synchronous, and would therefore have to call `Shared[...].block_on()` to get the underlying rust mesh.

This diff makes it so that when the internal `Shared[...]` task for `HostMesh` and `ProcMesh` completes, the result is stored so that it can be accessed without the use of `block_on()`. This enables pickling `HostMesh` and `ProcMesh` inside tokio threads, as long as their backing rust meshes have finished initializing -- this will always be the case inside actor endpoints, since the `HostMesh` and `ProcMesh` both need to be done initializing by the time the actor endpoint runs.

Differential Revision: [D84195494](https://our.internmc.facebook.com/intern/diff/D84195494/)

[ghstack-poisoned]
samlurye added a commit that referenced this pull request Oct 9, 2025
…ead in certain cases

Previously, both `HostMesh` and `ProcMesh` stored their underlying rust mesh in an asynchronous `Shared[...]` pytokio object, so any attempts to access the rust meshes from a tokio thread would need to be called from a coroutine. This is a problem for pickling, which needs to be synchronous, and would therefore have to call `Shared[...].block_on()` to get the underlying rust mesh.

This diff makes it so that when the internal `Shared[...]` task for `HostMesh` and `ProcMesh` completes, the result is stored so that it can be accessed without the use of `block_on()`. This enables pickling `HostMesh` and `ProcMesh` inside tokio threads, as long as their backing rust meshes have finished initializing -- this will always be the case inside actor endpoints, since the `HostMesh` and `ProcMesh` both need to be done initializing by the time the actor endpoint runs.

Differential Revision: [D84195494](https://our.internmc.facebook.com/intern/diff/D84195494/)

ghstack-source-id: 315055002
Pull Request resolved: #1473
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 9, 2025
…e tokio thread in certain cases"

Previously, both `HostMesh` and `ProcMesh` stored their underlying rust mesh in an asynchronous `Shared[...]` pytokio object, so any attempts to access the rust meshes from a tokio thread would need to be called from a coroutine. This is a problem for pickling, which needs to be synchronous, and would therefore have to call `Shared[...].block_on()` to get the underlying rust mesh.

This diff makes it so that when the internal `Shared[...]` task for `HostMesh` and `ProcMesh` completes, the result is stored so that it can be accessed without the use of `block_on()`. This enables pickling `HostMesh` and `ProcMesh` inside tokio threads, as long as their backing rust meshes have finished initializing -- this will always be the case inside actor endpoints, since the `HostMesh` and `ProcMesh` both need to be done initializing by the time the actor endpoint runs.

Differential Revision: [D84195494](https://our.internmc.facebook.com/intern/diff/D84195494/)

[ghstack-poisoned]
samlurye added a commit that referenced this pull request Oct 9, 2025
…ead in certain cases

Pull Request resolved: #1473

Previously, both `HostMesh` and `ProcMesh` stored their underlying rust mesh in an asynchronous `Shared[...]` pytokio object, so any attempts to access the rust meshes from a tokio thread would need to be called from a coroutine. This is a problem for pickling, which needs to be synchronous, and would therefore have to call `Shared[...].block_on()` to get the underlying rust mesh.

This diff makes it so that when the internal `Shared[...]` task for `HostMesh` and `ProcMesh` completes, the result is stored so that it can be accessed without the use of `block_on()`. This enables pickling `HostMesh` and `ProcMesh` inside tokio threads, as long as their backing rust meshes have finished initializing -- this will always be the case inside actor endpoints, since the `HostMesh` and `ProcMesh` both need to be done initializing by the time the actor endpoint runs.
ghstack-source-id: 315063514
@exported-using-ghexport

Differential Revision: [D84195494](https://our.internmc.facebook.com/intern/diff/D84195494/)
…e tokio thread in certain cases"

Previously, both `HostMesh` and `ProcMesh` stored their underlying rust mesh in an asynchronous `Shared[...]` pytokio object, so any attempts to access the rust meshes from a tokio thread would need to be called from a coroutine. This is a problem for pickling, which needs to be synchronous, and would therefore have to call `Shared[...].block_on()` to get the underlying rust mesh.

This diff makes it so that when the internal `Shared[...]` task for `HostMesh` and `ProcMesh` completes, the result is stored so that it can be accessed without the use of `block_on()`. This enables pickling `HostMesh` and `ProcMesh` inside tokio threads, as long as their backing rust meshes have finished initializing -- this will always be the case inside actor endpoints, since the `HostMesh` and `ProcMesh` both need to be done initializing by the time the actor endpoint runs.

Differential Revision: [D84195494](https://our.internmc.facebook.com/intern/diff/D84195494/)

[ghstack-poisoned]
samlurye added a commit that referenced this pull request Oct 9, 2025
…ead in certain cases

Pull Request resolved: #1473

Previously, both `HostMesh` and `ProcMesh` stored their underlying rust mesh in an asynchronous `Shared[...]` pytokio object, so any attempts to access the rust meshes from a tokio thread would need to be called from a coroutine. This is a problem for pickling, which needs to be synchronous, and would therefore have to call `Shared[...].block_on()` to get the underlying rust mesh.

This diff makes it so that when the internal `Shared[...]` task for `HostMesh` and `ProcMesh` completes, the result is stored so that it can be accessed without the use of `block_on()`. This enables pickling `HostMesh` and `ProcMesh` inside tokio threads, as long as their backing rust meshes have finished initializing -- this will always be the case inside actor endpoints, since the `HostMesh` and `ProcMesh` both need to be done initializing by the time the actor endpoint runs.
ghstack-source-id: 315174591
@exported-using-ghexport

Differential Revision: [D84195494](https://our.internmc.facebook.com/intern/diff/D84195494/)
@meta-codesync meta-codesync bot closed this in 1eb8853 Oct 9, 2025
Copy link

meta-codesync bot commented Oct 9, 2025

This pull request has been merged in 1eb8853.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants