Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii committed Feb 26, 2024
1 parent 05304bf commit 9e06d8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions prediction_market_agent_tooling/deploy/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class MonitorConfig(BaseModel):
LABEL_PREFIX: t.ClassVar[str] = "monitor_config_"

start_time: datetime
end_time: t.Optional[
datetime
] = None # TODO: If we want end time, we need to store agents somewhere, not just query them from functions.
end_time: t.Optional[datetime] = (
None # TODO: If we want end time, we need to store agents somewhere, not just query them from functions.
)
manifold_user_id: str | None = None
omen_public_key: str | None = None

Expand Down Expand Up @@ -110,16 +110,19 @@ def {entrypoint_function_name}(request) -> str:

gcp_fname = gcp_fname or self.get_gcloud_fname(market_type)

# For labels, only hyphens (-), underscores (_), lowercase characters, and numbers are allowed in values.
labels = (labels or {}) | {
"market_type": market_type.value,
}
env_vars = (env_vars or {}) | {
"repository": repository,
"commit": git.Repo(search_parent_directories=True).head.object.hexsha,
"market_type": market_type.value,
"agent_class": self.__class__.__name__,
}

if monitor_config is not None:
monitor_config.validate_monitor_config(market_type)
env_vars = (env_vars or {}) | {
env_vars |= {
f"{MonitorConfig.LABEL_PREFIX}{k}": v
for k, v in monitor_config.model_dump().items()
if v is not None
Expand Down
2 changes: 1 addition & 1 deletion prediction_market_agent_tooling/monitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_all_deployed_agents_gcp() -> t.Sequence["DeployedAgent"]:
agents.append(
DeployedAgent(
name=function.name,
agent_class=function.labels["agent_class"],
agent_class=function.environment_variables["agent_class"],
market_type=MarketType(function.labels["market_type"]),
monitor_config=MonitorConfig.model_validate(
{
Expand Down

0 comments on commit 9e06d8b

Please sign in to comment.