Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| from typing import Any | |
| from openenv.core import EnvClient | |
| from openenv.core.client_types import StepResult | |
| from models import GPUSchedulerAction, GPUSchedulerObservation, GPUSchedulerState | |
| class GPUSchedulerEnvClient(EnvClient[GPUSchedulerAction, GPUSchedulerObservation]): | |
| def _step_payload(self, action: GPUSchedulerAction) -> dict[str, Any]: | |
| return action.model_dump(mode="json") | |
| def _parse_result(self, payload: dict[str, Any]) -> StepResult[GPUSchedulerObservation]: | |
| observation = GPUSchedulerObservation.model_validate(payload["observation"]) | |
| return StepResult( | |
| observation=observation, | |
| reward=payload.get("reward"), | |
| done=payload.get("done", False), | |
| ) | |
| def _parse_state(self, payload: dict[str, Any]) -> GPUSchedulerState: | |
| return GPUSchedulerState.model_validate(payload) | |