Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some excessively large info logs #15

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ repos:
rev: v0.1.13
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
Expand Down
2 changes: 0 additions & 2 deletions cogment_lab/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,13 @@ async def impl(self, actor_session: ActorSession):
observation = self.session_helper.get_observation(event)
if observation is None:
continue
logging.info(f"Got observation: {observation}")

if not observation.active:
action = None
elif not observation.alive:
action = None
else:
action = await self.act(observation.value, observation.rendered_frame) # type: ignore
logging.info(f"Got action: {action} with action_space: {self.action_space.gym_space}")
cog_action = self.action_space.create_serialize(action)
actor_session.do_action(cog_action)
if event.rewards:
Expand Down
2 changes: 1 addition & 1 deletion cogment_lab/envs/gymnasium.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ async def step(self, state: State, action):
logging.info("Stepping environment")

obs, reward, terminated, truncated, info = state.env.step(action)
logging.info(f"Step returned {obs=}, {reward=}, {terminated=}, {truncated=}, {info=}")
logging.info("Stepping the environment")

observation = state.observation_space.create_serialize(
value=obs,
Expand Down
4 changes: 1 addition & 3 deletions cogment_lab/envs/pettingzoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ async def reset(self, state: State):
state.actor_name = agent

frame = state.env.render() if state.session_cfg.render else None
logging.info(f"Creating observation from {obs=}")
observation = state.observation_spaces[agent].create_serialize(
value=obs, rendered_frame=frame, active=True, alive=True
)
Expand Down Expand Up @@ -300,7 +299,7 @@ def __init__(
sub_dry: bool = True,
):
"""
Initialize the AECEnvironment.
Initialize the ParallelEnvironment.

Args:
env_path: Path to the PettingZoo environment class.
Expand Down Expand Up @@ -398,7 +397,6 @@ async def reset(self, state: State):
obs, info = state.env.reset(seed=state.session_cfg.seed)

frame = state.env.render() if state.session_cfg.render else None
logging.info(f"Creating observation from {obs=}")

if frame is not None:
logging.info(f"Frame shape at reset: {frame.shape}")
Expand Down
1 change: 0 additions & 1 deletion cogment_lab/humans/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ async def get():
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
logging.info("Waiting for socket connection")
logging.info("Setting last_action_data")
last_action_data = "no-op"
logging.info(f"Set {last_action_data=}")
await websocket.accept()
Expand Down
Loading