From fc6b3ca106c8013eff618a7f5551d13cd38bd6fe Mon Sep 17 00:00:00 2001 From: angrybayblade Date: Fri, 31 May 2024 14:30:12 +0530 Subject: [PATCH] fix: mech pricing patch --- operate/services/service.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/operate/services/service.py b/operate/services/service.py index 0d7ea5a43..05411d6dc 100644 --- a/operate/services/service.py +++ b/operate/services/service.py @@ -593,6 +593,16 @@ def _build_docker( for node in deployment["services"]: if "abci" in node: deployment["services"][node]["volumes"].extend(_volumes) + if ( + "SKILL_TRADER_ABCI_MODELS_PARAMS_ARGS_MECH_REQUEST_PRICE=0" + in deployment["services"][node]["environment"] + ): + deployment["services"][node]["environment"].remove( + "SKILL_TRADER_ABCI_MODELS_PARAMS_ARGS_MECH_REQUEST_PRICE=0" + ) + deployment["services"][node]["environment"].append( + "SKILL_TRADER_ABCI_MODELS_PARAMS_ARGS_MECH_REQUEST_PRICE=10000000000000000" + ) with (build / DOCKER_COMPOSE_YAML).open("w", encoding="utf-8") as stream: yaml_dump(data=deployment, stream=stream) @@ -663,6 +673,17 @@ def _build_host(self, force: bool = True) -> None: shutil.rmtree(build) raise e + # Mech price patch. + agent_vars = json.loads(Path(build, "agent.json").read_text(encoding="utf-8")) + if "SKILL_TRADER_ABCI_MODELS_PARAMS_ARGS_MECH_REQUEST_PRICE" in agent_vars: + agent_vars[ + "SKILL_TRADER_ABCI_MODELS_PARAMS_ARGS_MECH_REQUEST_PRICE" + ] = 10000000000000000 + Path(build, "agent.json").write_text( + json.dumps(agent_vars, indent=4), + encoding="utf-8", + ) + self.status = DeploymentStatus.BUILT self.store()