Diagnostics
geneva.runners.ray.compare_env.compare_ray_environments
compare_ray_environments(
env_prefix: str | None = None,
show_all: bool = False,
include_sys_path: bool = True,
auto_init: bool = False,
ray_address: str | None = "auto",
runtime_env: dict[str, Any] | None = None,
) -> ComparisonResult
Compare and print Ray worker environment vs local environment.
Prints a formatted report to console and returns the data. Use get_comparison_result() if you only want the data without printing.
By default, requires Ray to already be initialized. Use auto_init=True to allow automatic Ray initialization.
When called inside a Geneva context, the manifest's pip/conda dependencies are automatically applied to the remote snapshot task.
Parameters:
-
env_prefix(str | None, default:None) –Optional prefix to filter environment variables (e.g., 'PY').
-
show_all(bool, default:False) –If True, also print full snapshots as JSON.
-
include_sys_path(bool, default:True) –If True, include sys.path comparison.
-
auto_init(bool, default:False) –If True, initialize Ray automatically. If False (default), require Ray to already be initialized.
-
ray_address(str | None, default:'auto') –Ray address (only used when auto_init=True). Default 'auto' connects to existing cluster. Use None to start a new local cluster.
-
runtime_env(dict[str, Any] | None, default:None) –Optional Ray runtime_env dict to apply to the remote snapshot task. If not provided, auto-detected from the active Geneva context's manifest (if any).
Returns:
-
ComparisonResult–Comparison results (same as get_comparison_result).
Raises:
-
RuntimeError–If Ray is not initialized and auto_init=False
Examples:
In a Geneva context (Ray already initialized, manifest auto-detected):
result = compare_ray_environments()
With an explicit runtime_env override:
result = compare_ray_environments(runtime_env={"pip": ["emoji==2.14.1"]})
Auto-init and connect to existing cluster:
result = compare_ray_environments(auto_init=True)
Auto-init a new local cluster:
result = compare_ray_environments(auto_init=True, ray_address=None)
geneva.runners.ray.compare_env.ComparisonResult
Bases: TypedDict
Complete comparison result.