Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
solarw committed Aug 30, 2024
1 parent b398318 commit 11140da
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
7 changes: 4 additions & 3 deletions operate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,22 @@ def json(self) -> dict:
"home": str(self._path),
}


def create_app( # pylint: disable=too-many-locals, unused-argument, too-many-statements
home: t.Optional[Path] = None,
) -> FastAPI:
"""Create FastAPI object."""
HEALTH_CHECKER_OFF = os.environ.get("HEALTH_CHECKER_OFF", "0") == "1"
number_of_fails = int(os.environ.get("HEALTH_CHECKER_TRIES", "5"))


logger = setup_logger(name="operate")
if HEALTH_CHECKER_OFF:
logger.warning("healthchecker is off!!!")
operate = OperateApp(home=home, logger=logger)
funding_jobs: t.Dict[str, asyncio.Task] = {}
health_checker = HealthChecker(operate.service_manager(), number_of_fails=number_of_fails)
health_checker = HealthChecker(
operate.service_manager(), number_of_fails=number_of_fails
)
# Create shutdown endpoint
shutdown_endpoint = uuid.uuid4().hex
(operate._path / "operate.kill").write_text( # pylint: disable=protected-access
Expand Down
1 change: 1 addition & 0 deletions operate/services/deployment_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from pathlib import Path
from typing import Any
from venv import main as venv_cli

import psutil
from aea.__version__ import __version__ as aea_version
from autonomy.__version__ import __version__ as autonomy_version
Expand Down
4 changes: 3 additions & 1 deletion operate/services/health_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ async def _wait_for_port(sleep_period: int = 15) -> None:
self.logger.info("[HEALTH_CHECKER]: port is UP")
return
except aiohttp.ClientConnectionError:
self.logger.error("[HEALTH_CHECKER]: error connecting http port")
self.logger.error(
"[HEALTH_CHECKER]: error connecting http port"
)
await asyncio.sleep(sleep_period)

async def _check_port_ready(
Expand Down
12 changes: 7 additions & 5 deletions operate/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import json
import os
import platform
import sys
import shutil
import subprocess # nosec
import sys
import typing as t
from copy import copy, deepcopy
from dataclasses import dataclass
Expand Down Expand Up @@ -279,7 +279,9 @@ def generate_config_tendermint(self) -> "HostDeploymentGenerator":
)
# TODO: move all platform related things to a dedicated file
if platform.system() == "Windows":
tendermint_executable = Path(os.path.dirname(sys.executable)) / "tendermint.exe"
tendermint_executable = (
Path(os.path.dirname(sys.executable)) / "tendermint.exe"
)
print(11111111111111111, tendermint_executable)
subprocess.run( # pylint: disable=subprocess-run-check # nosec
args=[
Expand Down Expand Up @@ -569,9 +571,9 @@ def _build_host(self, force: bool = True, chain_id: str = "100") -> None:
# 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"
)
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",
Expand Down

0 comments on commit 11140da

Please sign in to comment.