Skip to content

Commit

Permalink
add error for simulation server address passing
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchenplus committed Jan 16, 2025
1 parent 36bd3cd commit 33a7802
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pycityagent/environment/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def __init__(self, config: dict, secure: bool = False) -> None:
- grpc client of simulator
"""
else:
raise ValueError(
f"Passing Traffic Simulation address is not supported!"
)
self._client = CityClient(config["simulator"]["server"], secure=False)
else:
logger.warning(
Expand Down Expand Up @@ -173,6 +176,7 @@ async def get_time(
return formatted_time
else:
return int(now["t"])

async def pause(self):
await self._client.pause_service.pause()

Expand Down
9 changes: 7 additions & 2 deletions pycityagent/simulation/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ def __init__(
self._simulator = Simulator(config["simulator_request"])
if enable_economy:
self._economy_env = self._simulator._sim_env
_req_dict = self.config["simulator_request"]
_req_dict: dict = self.config["simulator_request"]
if "economy" in _req_dict:
_req_dict["economy"]["server"] = self._economy_env.sim_addr
if "server" in _req_dict["economy"]:
raise ValueError(
f"Passing Economy Simulation address is not supported!"
)
else:
_req_dict["economy"]["server"] = self._economy_env.sim_addr
else:
_req_dict["economy"] = {
"server": self._economy_env.sim_addr,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pycityagent"
version = "2.0.0a55" # change it for each release
version = "2.0.0a56" # change it for each release
description = "LLM-based city environment agent building library"
authors = [
{ name = "Yuwei Yan", email = "[email protected]" },
Expand Down

0 comments on commit 33a7802

Please sign in to comment.