Skip to content

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",
) -> 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.

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.

Returns:

Raises:

  • RuntimeError

    If Ray is not initialized and auto_init=False

Examples:

In a Geneva context (Ray already initialized):

result = compare_ray_environments()

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.

local

local: EnvSnapshot

remote

remote: EnvSnapshot

env_diffs

env_diffs: EnvDiffs

pkg_diffs

pkg_diffs: PackageDiffs

sys_path_diffs

sys_path_diffs: SysPathDiffs

geneva.runners.ray.compare_env.EnvSnapshot

Bases: TypedDict

Complete environment snapshot.

python

python: PythonInfo

platform

platform: PlatformInfo

cwd

cwd: str

env

env: dict[str, str]

sys_path

sys_path: list[str]

packages

packages: dict[str, str]

geneva.runners.ray.compare_env.EnvDiffs

Bases: TypedDict

Environment variable differences.

only_local

only_local: list[str]

only_remote

only_remote: list[str]

diffs

diffs: list[EnvVarDiff]

geneva.runners.ray.compare_env.PackageDiffs

Bases: TypedDict

Package version differences.

only_local

only_local: list[str]

only_remote

only_remote: list[str]

version_mismatch

version_mismatch: list[tuple[str, str, str]]

geneva.runners.ray.compare_env.SysPathDiffs

Bases: TypedDict

sys.path differences.

only_local

only_local: list[str]

only_remote

only_remote: list[str]

intersection_count

intersection_count: int

local_count

local_count: int

remote_count

remote_count: int