pymoose.runtime module#

class pymoose.runtime.GrpcMooseRuntime(identities: Dict)[source]#

Bases: GrpcRuntime

Moose runtime backed by gRPC choreography.

Creates a Moose runtime backed by a fixed set of gRPC servers.

Example

runtime = GrpcMooseRuntime(
    identities={
        "alice": "172.16.254.1:50001",
        "bob": "172.16.254.2:50002",
        "carole": "172.16.254.3:50003",
    },
)
Parameters

identities – Mapping of identities (e.g. host placement identifiers) to gRPC host addresses.

evaluate_computation(computation, arguments=None)[source]#
set_default()[source]#
class pymoose.runtime.LocalMooseRuntime(identities: List[str], storage_mapping: Optional[Dict[str, Dict]] = None)[source]#

Bases: LocalRuntime

Locally-simulated Moose runtime.

Creates a local runtime with several virtual hosts and optional storage for each.

Example

runtime = LocalMooseRuntime(
    ["alice", "bob", "carole"],
    storage_mapping={
        "alice": {
            "alice_array": np.ones((3, 3)),
            "alice_string": "hello i'm alice",
            "alice_number": 42,
        },
    },
)
Parameters
  • identities – A list of names of identities for virtual hosts.

  • storage_mapping – A dictionary mapping Identities to storage dictionaries. Storage dictionaries are dicts/named tuples of Python objects that correspond to valid PyMoose Values (e.g. native Python numbers, ndarrays, strings, etc.).

evaluate_compiled(comp_bin, arguments=None)[source]#
evaluate_computation(computation, arguments=None, compiler_passes=None)[source]#
read_value_from_storage(identity, key)[source]#
set_default()[source]#
write_value_to_storage(identity, key, value)[source]#