pycityagent 2.0.0a29__tar.gz → 2.0.0a30__tar.gz
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.
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/PKG-INFO +1 -1
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/simulation/storage/pg.py +20 -21
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pyproject.toml +1 -1
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/README.md +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/agent.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/economy/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/economy/econ_client.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/interact/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/interact/interact.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/message/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sence/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sence/static.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sidecar/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sidecar/sidecarv2.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/aoi_service.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/client.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/clock_service.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/economy_services.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/lane_service.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/light_service.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/person_service.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/road_service.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/sim_env.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/social_service.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/simulator.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/base64.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/const.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/geojson.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/grpc.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/map_utils.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/port.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/utils/protobuf.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/llm/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/llm/embeddings.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/llm/llm.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/llm/llmconfig.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/llm/utils.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/const.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/faiss_query.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/memory.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/memory_base.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/profile.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/self_define.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/state.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/memory/utils.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/message/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/message/messager.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/metrics/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/metrics/mlflow_client.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/metrics/utils/const.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/simulation/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/simulation/agentgroup.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/simulation/simulation.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/survey/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/survey/manager.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/survey/models.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/avro_schema.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/decorators.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/parsers/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/parsers/code_block_parser.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/parsers/json_parser.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/parsers/parser_base.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/pg_query.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/survey_util.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/workflow/__init__.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/workflow/block.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/workflow/prompt.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/workflow/tool.py +0 -0
- {pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/workflow/trigger.py +0 -0
@@ -13,7 +13,10 @@ from ...utils.pg_query import PGSQL_DICT
|
|
13
13
|
|
14
14
|
def create_pg_tables(exp_id: str, dsn: str):
|
15
15
|
for table_type, exec_strs in PGSQL_DICT.items():
|
16
|
-
|
16
|
+
if not table_type == "experiment":
|
17
|
+
table_name = f"socialcity_{exp_id.replace('-', '_')}_{table_type}"
|
18
|
+
else:
|
19
|
+
table_name = f"socialcity_{table_type}"
|
17
20
|
# # debug str
|
18
21
|
# for _str in [f"DROP TABLE IF EXISTS {table_name}"] + [
|
19
22
|
# _exec_str.format(table_name=table_name) for _exec_str in exec_strs
|
@@ -21,9 +24,10 @@ def create_pg_tables(exp_id: str, dsn: str):
|
|
21
24
|
# print(_str)
|
22
25
|
with psycopg.connect(dsn) as conn:
|
23
26
|
with conn.cursor() as cur:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
if not table_type == "experiment":
|
28
|
+
# delete table
|
29
|
+
cur.execute(f"DROP TABLE IF EXISTS {table_name}") # type:ignore
|
30
|
+
conn.commit()
|
27
31
|
# create table
|
28
32
|
for _exec_str in exec_strs:
|
29
33
|
cur.execute(_exec_str.format(table_name=table_name))
|
@@ -106,10 +110,11 @@ class PgWriter:
|
|
106
110
|
]
|
107
111
|
await copy.write_row(_row)
|
108
112
|
|
113
|
+
# @lock_decorator
|
109
114
|
async def async_update_exp_info(self, exp_info: dict[str, Any]):
|
110
115
|
# timestamp不做类型转换
|
111
116
|
TO_UPDATE_EXP_INFO_KEYS_AND_TYPES = [
|
112
|
-
("id",
|
117
|
+
("id", None),
|
113
118
|
("name", str),
|
114
119
|
("num_day", int),
|
115
120
|
("status", int),
|
@@ -120,37 +125,31 @@ class PgWriter:
|
|
120
125
|
("created_at", None),
|
121
126
|
("updated_at", None),
|
122
127
|
]
|
123
|
-
table_name = f"
|
128
|
+
table_name = f"socialcity_experiment"
|
124
129
|
async with await psycopg.AsyncConnection.connect(self._dsn) as aconn:
|
125
|
-
async with aconn.cursor(row_factory=dict_row) as cur:
|
126
|
-
await cur.execute(
|
127
|
-
|
128
|
-
)
|
129
|
-
record_exists = await cur.fetchall()
|
130
|
-
|
130
|
+
async with aconn.cursor(row_factory=dict_row) as cur:
|
131
|
+
await cur.execute("SELECT * FROM {table_name} WHERE id=%s".format(table_name = table_name),(self.exp_id,))# type:ignore
|
132
|
+
record_exists = await cur.fetchall()
|
133
|
+
print("record_exists",record_exists)
|
131
134
|
if record_exists:
|
132
135
|
# UPDATE
|
133
136
|
columns = ", ".join(
|
134
137
|
f"{key} = %s" for key, _ in TO_UPDATE_EXP_INFO_KEYS_AND_TYPES
|
135
138
|
)
|
136
139
|
update_sql = psycopg.sql.SQL(
|
137
|
-
f"UPDATE {{}} SET {columns}"
|
140
|
+
f"UPDATE {{}} SET {columns} WHERE id='{self.exp_id}'" # type:ignore
|
138
141
|
).format(psycopg.sql.Identifier(table_name))
|
139
142
|
params = [
|
140
143
|
_type(exp_info[key]) if _type is not None else exp_info[key]
|
141
144
|
for key, _type in TO_UPDATE_EXP_INFO_KEYS_AND_TYPES
|
142
|
-
]
|
145
|
+
]# + [self.exp_id]
|
143
146
|
await cur.execute(update_sql, params)
|
144
147
|
else:
|
145
148
|
# INSERT
|
146
|
-
keys = ", ".join(
|
147
|
-
|
148
|
-
)
|
149
|
-
placeholders = ", ".join(
|
150
|
-
["%s"] * len(TO_UPDATE_EXP_INFO_KEYS_AND_TYPES)
|
151
|
-
)
|
149
|
+
keys = ", ".join(key for key, _ in TO_UPDATE_EXP_INFO_KEYS_AND_TYPES)
|
150
|
+
placeholders = ", ".join(["%s"] * len(TO_UPDATE_EXP_INFO_KEYS_AND_TYPES))
|
152
151
|
insert_sql = psycopg.sql.SQL(
|
153
|
-
f"INSERT INTO {{}} ({keys}) VALUES ({placeholders})"
|
152
|
+
f"INSERT INTO {{}} ({keys}) VALUES ({placeholders})" # type:ignore
|
154
153
|
).format(psycopg.sql.Identifier(table_name))
|
155
154
|
params = [
|
156
155
|
_type(exp_info[key]) if _type is not None else exp_info[key]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/environment/sim/economy_services.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pycityagent-2.0.0a29 → pycityagent-2.0.0a30}/pycityagent/utils/parsers/code_block_parser.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|