Skip to content

unienv_interface.remote.protocol

Protocol constants shared by client and server.

Request: [id, target, method, args, kwargs] (target == "" for protocol calls) Response: [id, OK, value] or [id, OK, value, updates]; [id, ERROR, [type, message, traceback]] Event: [subscription, EVENT, [kind, sequence, value]]

Attributes:

Name Type Description
PROTOCOL_VERSION int
METHODS Dict[str, FrozenSet[str]]
OPTIONAL_METHODS FrozenSet[str]
RESET_METHODS FrozenSet[str]
PUBLISHED_METHODS FrozenSet[str]
SPACES Tuple[str, ...]
ATTRIBUTES Tuple[str, ...]
PRIORITIES Tuple[str, ...]

PROTOCOL_VERSION module-attribute

PROTOCOL_VERSION: int = 2

METHODS module-attribute

METHODS: Dict[str, FrozenSet[str]] = {
    "env": frozenset({"reset", "reload", "step", "render"}),
    "world": frozenset({"step", "reset", "reload", "after_reset", "after_reload"}),
    "node": frozenset(
        {
            "reset",
            "reload",
            "after_reset",
            "after_reload",
            "pre_environment_step",
            "post_environment_step",
            "set_next_action",
            "get_context",
            "get_observation",
            "get_reward",
            "get_termination",
            "get_truncation",
            "get_info",
            "render",
        }
    ),
    "transformation": frozenset({"transform", "get_target_space_from_source"}),
}

OPTIONAL_METHODS module-attribute

OPTIONAL_METHODS: FrozenSet[str] = frozenset({'reload'})

RESET_METHODS module-attribute

RESET_METHODS: FrozenSet[str] = frozenset(
    {"reset", "reload", "after_reset", "after_reload"}
)

PUBLISHED_METHODS module-attribute

PUBLISHED_METHODS: FrozenSet[str] = frozenset({'reset', 'reload', 'step'})

SPACES module-attribute

SPACES: Tuple[str, ...] = ('observation_space', 'action_space', 'context_space')

ATTRIBUTES module-attribute

ATTRIBUTES: Tuple[str, ...] = (
    "name",
    "batch_size",
    "world_timestep",
    "world_subtimestep",
    "control_timestep",
    "update_timestep",
    "render_mode",
    "render_fps",
    "supported_render_modes",
    "has_reward",
    "has_termination_signal",
    "has_truncation_signal",
    "metadata",
)

PRIORITIES module-attribute

PRIORITIES: Tuple[str, ...] = tuple(
    f"{phase}_priorities"
    for phase in (
        "reset",
        "reload",
        "after_reset",
        "after_reload",
        "pre_environment_step",
        "post_environment_step",
    )
)