pycityagent 2.0.0a89__cp39-cp39-macosx_11_0_arm64.whl → 2.0.0a91__cp39-cp39-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,9 @@ from ..utils import encode_to_base64, find_free_port
13
13
  __all__ = ["ControlSimEnv"]
14
14
 
15
15
 
16
- def _generate_yaml_config(map_file: str, max_day: int, start_step: int, total_step: int) -> str:
16
+ def _generate_yaml_config(
17
+ map_file: str, max_day: int, start_step: int, total_step: int
18
+ ) -> str:
17
19
  map_file = os.path.abspath(map_file)
18
20
  return f"""
19
21
  input:
@@ -48,6 +50,7 @@ class ControlSimEnv:
48
50
  start_step: int,
49
51
  total_step: int,
50
52
  log_dir: str,
53
+ primary_node_ip: str,
51
54
  min_step_time: int = 1000,
52
55
  timeout: int = 5,
53
56
  max_process: int = 32,
@@ -68,9 +71,12 @@ class ControlSimEnv:
68
71
  self._log_dir = log_dir
69
72
  self._min_step_time = min_step_time
70
73
  self._timeout = timeout
74
+ self._primary_node_ip = primary_node_ip
71
75
  self._max_procs = max_process
72
76
 
73
- self._sim_config = _generate_yaml_config(map_file, max_day, start_step, total_step)
77
+ self._sim_config = _generate_yaml_config(
78
+ map_file, max_day, start_step, total_step
79
+ )
74
80
  # sim
75
81
  self.sim_port = None
76
82
  self._sim_proc = None
@@ -102,6 +108,7 @@ class ControlSimEnv:
102
108
  self.sim_port = find_free_port()
103
109
  config_base64 = encode_to_base64(self._sim_config)
104
110
  os.environ["GOMAXPROCS"] = str(self._max_procs)
111
+ sim_addr = self._primary_node_ip.rstrip("/") + f":{self.sim_port}"
105
112
  self._sim_proc = Popen(
106
113
  [
107
114
  "pycityagent-sim",
@@ -110,7 +117,7 @@ class ControlSimEnv:
110
117
  "-job",
111
118
  self._task_name,
112
119
  "-listen",
113
- f":{self.sim_port}",
120
+ sim_addr,
114
121
  "-run.min_step_time",
115
122
  f"{self._min_step_time}",
116
123
  "-run.pause_after_one_day",
@@ -125,9 +132,8 @@ class ControlSimEnv:
125
132
  # stdout=DEVNULL,
126
133
  )
127
134
  logging.info(
128
- f"start pycityagent-sim at localhost:{self.sim_port}, PID={self._sim_proc.pid}"
135
+ f"start pycityagent-sim at {sim_addr}, PID={self._sim_proc.pid}"
129
136
  )
130
- sim_addr = f"http://localhost:{self.sim_port}"
131
137
  atexit.register(self.close)
132
138
  time.sleep(0.3)
133
139
  else:
@@ -126,10 +126,10 @@ class Simulator:
126
126
  ),
127
127
  log_dir=config["simulator"].get("log_dir", "./log"),
128
128
  min_step_time=config["simulator"].get("min_step_time", 1000),
129
+ primary_node_ip=config["simulator"].get("primary_node_ip", "localhost"),
129
130
  sim_addr=config["simulator"].get("server", None),
130
131
  )
131
- primary_node_ip = config["simulator"].get("ad", "http://localhost")
132
- self.server_addr = primary_node_ip.rstrip("/")+f":{sim_env.sim_port}"
132
+ self.server_addr = sim_env.sim_addr
133
133
  config["simulator"]["server"] = self.server_addr
134
134
  config["simulator"]["_server_activated"] = True
135
135
  # using local client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pycityagent
3
- Version: 2.0.0a89
3
+ Version: 2.0.0a91
4
4
  Summary: LLM-based city environment agent building library
5
5
  Author-email: Yuwei Yan <pinkgranite86@gmail.com>, Junbo Yan <yanjb20thu@gmali.com>, Jun Zhang <zhangjun990222@gmali.com>
6
6
  License: MIT License
@@ -1,3 +1,9 @@
1
+ pycityagent-2.0.0a91.dist-info/RECORD,,
2
+ pycityagent-2.0.0a91.dist-info/LICENSE,sha256=n2HPXiupinpyHMnIkbCf3OTYd3KMqbmldu1e7av0CAU,1084
3
+ pycityagent-2.0.0a91.dist-info/WHEEL,sha256=md3JO_ifs5j508p3TDNMgtQVtnQblpGEt_Wo4W56l8Y,107
4
+ pycityagent-2.0.0a91.dist-info/entry_points.txt,sha256=BZcne49AAIFv-hawxGnPbblea7X3MtAtoPyDX8L4OC4,132
5
+ pycityagent-2.0.0a91.dist-info/top_level.txt,sha256=yOmeu6cSXmiUtScu53a3s0p7BGtLMaV0aff83EHCTic,43
6
+ pycityagent-2.0.0a91.dist-info/METADATA,sha256=p0o_OmiXN5jeCeFL-Yp9qt5TVb0nj2bmu-HSkagl9r8,9110
1
7
  pycityagent/pycityagent-sim,sha256=Ax6cjHjT8VcT5t07VboL_Ruor2eXSdSEml4Jvv-L5dQ,36972594
2
8
  pycityagent/__init__.py,sha256=PUKWTXc-xdMG7px8oTNclodsILUgypANj2Z647sY63k,808
3
9
  pycityagent/pycityagent-ui,sha256=Ur95yZygIaZ5l_CDqP9394M5GQ66iV5PkcNPYFWqzvk,41225346
@@ -46,7 +52,7 @@ pycityagent/workflow/prompt.py,sha256=rzenP4EFGxbWE1aq-x2036b6umKvi5cQx2xtWULwgI
46
52
  pycityagent/workflow/block.py,sha256=WJfCeL8e117GzkVPJCRNsQZZinccMnVyEubkwrf-17U,12295
47
53
  pycityagent/workflow/trigger.py,sha256=4nzAwywGQsFabgo6gzp-vD2EV4wII7Z0LHGEAsflSEY,7608
48
54
  pycityagent/environment/__init__.py,sha256=fFIth2jxxgZ92cXm-aoM2igHgaSqsYGwtBhyb7opjzk,166
49
- pycityagent/environment/simulator.py,sha256=ubOsoeyo81LZKfOSeS4eGrpn-7lC-hrdCBbcLH9NbK8,23324
55
+ pycityagent/environment/simulator.py,sha256=4QVwi40I9AwJ9YIDK3-fqmlz2Q5ykkWBHpz78xAo22c,23299
50
56
  pycityagent/environment/utils/port.py,sha256=3OM6kSUt3PxvDUOlgyiendBtETaWU8Mzk_8H0TzTmYg,295
51
57
  pycityagent/environment/utils/grpc.py,sha256=_lB4-k4dTKuNvApaDiYgFxiLTPtYG42DVQtG9yOj9pQ,2022
52
58
  pycityagent/environment/utils/base64.py,sha256=hoREzQo3FXMN79pqQLO2jgsDEvudciomyKii7MWljAM,374
@@ -58,7 +64,7 @@ pycityagent/environment/utils/const.py,sha256=1LqxnYJ8FSmq37fN5kIFlWLwycEDzFa8SF
58
64
  pycityagent/environment/sim/pause_service.py,sha256=UUTa4pTBOX_MGKki9QDgKId7scch0waAWF9xRVmNlAs,1701
59
65
  pycityagent/environment/sim/person_service.py,sha256=T1pRi5jDcivSInX7iGZoHKYZmgO7_t5MYtLhU12_LC4,10793
60
66
  pycityagent/environment/sim/aoi_service.py,sha256=bYVJDrOfDn8hgOORDU7PxMaT-fpqXA5Z0A080l2EPBc,1242
61
- pycityagent/environment/sim/sim_env.py,sha256=4CW9lv9CyRUFsa0mwZ3AQsBps3i1Qh1KIRSgHdZWy0U,4658
67
+ pycityagent/environment/sim/sim_env.py,sha256=iXdM2fQo-StbB55WcRDlY4Y4MbZ7ApZp7fAv58Cg9Rk,4758
62
68
  pycityagent/environment/sim/lane_service.py,sha256=bmf0zOWkxDzMEDlhTdHNRJRiTFGgzjbeqmex387gHZs,3964
63
69
  pycityagent/environment/sim/client.py,sha256=x4REWPRFG_C2s0-CWz8MnYalD_esfu2pPHf_vpsCG78,2852
64
70
  pycityagent/environment/sim/__init__.py,sha256=CyJc5Tey9MgzomZv0ynAcV0yaUlSE3bPbegYXar8wJc,601
@@ -89,9 +95,3 @@ pycityagent/cityagent/blocks/mobility_block.py,sha256=OZoA-swFdX0Ezpzkyp8jJMNPQ5
89
95
  pycityagent/survey/models.py,sha256=g3xni4GcA1Py3vlGt6z4ltutjgQ4G0uINYAM8vKRJAw,5225
90
96
  pycityagent/survey/__init__.py,sha256=rxwou8U9KeFSP7rMzXtmtp2fVFZxK4Trzi-psx9LPIs,153
91
97
  pycityagent/survey/manager.py,sha256=tHkdeq4lTfAHwvgf4-udsXri0z2l6E00rEbvwl7SqRs,3439
92
- pycityagent-2.0.0a89.dist-info/RECORD,,
93
- pycityagent-2.0.0a89.dist-info/LICENSE,sha256=n2HPXiupinpyHMnIkbCf3OTYd3KMqbmldu1e7av0CAU,1084
94
- pycityagent-2.0.0a89.dist-info/WHEEL,sha256=md3JO_ifs5j508p3TDNMgtQVtnQblpGEt_Wo4W56l8Y,107
95
- pycityagent-2.0.0a89.dist-info/entry_points.txt,sha256=BZcne49AAIFv-hawxGnPbblea7X3MtAtoPyDX8L4OC4,132
96
- pycityagent-2.0.0a89.dist-info/top_level.txt,sha256=yOmeu6cSXmiUtScu53a3s0p7BGtLMaV0aff83EHCTic,43
97
- pycityagent-2.0.0a89.dist-info/METADATA,sha256=ePWFzp7BbUYZs_AtmsewHwFGrmPbUyMwamMc1KJQfno,9110