Skip to content

Conversation

@shayne-fletcher
Copy link
Contributor

Summary: this diff adds end-to-end tests for LoggingMeshClient::spawn, set_mode, and flush, covering both values of MESH_ENABLE_LOG_FORWARDING. with forwarding disabled we assert that spawn() returns a client with forwarder_mesh == None, that set_mode() refuses to enable streaming (and rejects aggregate_window_sec unless streaming is true), and that flush() returns Ok(()) as a no-op. with forwarding enabled we assert that forwarder_mesh.is_some(), that set_mode() can enable streaming and set an aggregate window, and that flush() runs the sync flush barrier and returns Ok(()). the diff also adds await_unit() to AwaitPyExt so tests can await PyPythonTasks that conceptually return None, and tightens the rust-side docs for LoggingMeshClient, its drop semantics, and the flush protocol.

Differential Revision: D85969320

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 31, 2025
@meta-codesync
Copy link

meta-codesync bot commented Oct 31, 2025

@shayne-fletcher has exported this pull request. If you are a Meta employee, you can view the originating Diff in D85969320.

shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Oct 31, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Oct 31, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
@shayne-fletcher shayne-fletcher force-pushed the export-D85969320 branch 2 times, most recently from a10efa1 to c3592a2 Compare November 2, 2025 15:06
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
@shayne-fletcher shayne-fletcher force-pushed the export-D85969320 branch 2 times, most recently from 2359aed to 1f89b92 Compare November 2, 2025 18:20
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
Summary:

yesterday's fix D86025607 is flaky. today's observed behavior shows the torch API still suffers from caching / runner variability. this fix is more authoritative: pin torch to 2.9.0 (stable):
replace `pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu126` with `pip install torch==2.9.0+cu126 --index-url https://download.pytorch.org/whl/cu126`

pulling "nightly" exposes us to non-determinism. relying on a published version restores hermeticity. anyone can stamp/land and we should expect to recover green actions.

Differential Revision: D86052365
…eta-pytorch#1722)

Summary:

this diff changes `LoggingMeshClient::spawn` so that log forwarding is no longer unconditional. previously we always spawned a `LogForwardActor` mesh across the `ProcMesh` and stored it in the client. now we read `MESH_ENABLE_LOG_FORWARDING` and only create that mesh if the flag is set. when forwarding is disabled we don’t spawn any `LogForwardActor` actors at all and we record `forwarder_mesh` as `None`. `logger_mesh` (the per-proc `LoggerRuntimeActor` that manages python logging state) is still always spawned. `client_actor` is still spawned locally in the caller's process.

because `forwarder_mesh` is now an `Option`, the rest of the API is updated to match the new contract. `set_mode` now either propagates `stream_to_client` to the forwarders when they exist, silently accepts"don’t stream" when they don’t, or returns an error if the caller tries to enable streaming in a configuration where we never created forwarders. `flush` now no-ops successfully in the case where there is no forwarding mesh instead of assuming that those actors are always present.

the diff also adds the minimal test harness needed to exercise this logic end-to-end. there is a dedicated bootstrap binary in `monarch_hyperactor` (`monarch_hyperactor_test_bootstrap`) which initializes python and then runs the mesh bootstrap protocol, so remote procs can safely construct `LoggerRuntimeActor `without panicking on `Python::with_gil`. we also add `HostMesh::local_with_bootstrap`, which lets tests stand up a single-host mesh using an explicit `BootstrapCommand` instead of relying on the implicit "current process" path. we also add `ensure_python` and `AwaitPyExt `on the rust side so the tokio tests can stand up a `ProcMesh`, call the python-facing `spawn()`, await the returned `PyPythonTask`, and inspect the resulting `LoggingMeshClient`. finally, there is a test that brings up a tiny mesh, forces the forwarding flag off and on, and in each case asserts that `forwarder_mesh` is `None` or `Some(..)` accordingly. follow-up diffs will extend coverage to `set_mode`, `flush`, and shutdown semantics, now that the plumbing exists.

Differential Revision: D85919326
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
shayne-fletcher added a commit to shayne-fletcher/monarch-1 that referenced this pull request Nov 2, 2025
Summary:

this diff adds end-to-end tests for `LoggingMeshClient::spawn,` `set_mode`, and `flush`, covering both values of `MESH_ENABLE_LOG_FORWARDING`. with forwarding disabled we assert that `spawn()` returns a client with `forwarder_mesh == None`, that `set_mode()` refuses to enable streaming (and rejects `aggregate_window_sec` unless streaming is true), and that `flush()` returns `Ok(())` as a no-op. with forwarding enabled we assert that `forwarder_mesh.is_some()`, that `set_mode()` can enable streaming and set an aggregate window, and that `flush()` runs the sync flush barrier and returns `Ok(())`. the diff also adds `await_unit()` to `AwaitPyExt` so tests can await `PyPythonTask`s that conceptually return `None`, and tightens the rust-side docs for `LoggingMeshClient`, its `drop` semantics, and the `flush` protocol.

Differential Revision: D85969320
@shayne-fletcher shayne-fletcher force-pushed the export-D85969320 branch 2 times, most recently from 1264a80 to 0b1fa16 Compare November 2, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant