Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
solarw committed Jul 26, 2024
1 parent 545ac31 commit 451d54a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions operate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"""Operate app CLI module."""

import asyncio
from concurrent.futures import ThreadPoolExecutor
import logging
import os
import signal
import traceback
import typing as t
import uuid
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path

from aea.helpers.logging import setup_logger
Expand Down Expand Up @@ -156,7 +156,7 @@ def create_app( # pylint: disable=too-many-locals, unused-argument, too-many-st

thread_pool_executor = ThreadPoolExecutor()

async def run_in_executor(fn, *args):
async def run_in_executor(fn: t.Callable, *args: t.Any) -> t.Any:
loop = asyncio.get_event_loop()
future = loop.run_in_executor(thread_pool_executor, fn, *args)
res = await future
Expand Down Expand Up @@ -540,11 +540,15 @@ async def _create_services(request: Request) -> JSONResponse:
)

if template.get("deploy", False):
def _fn():
manager.deploy_service_onchain_from_safe(hash=service.hash, update=update)

def _fn() -> None:
manager.deploy_service_onchain_from_safe(
hash=service.hash, update=update
)
manager.stake_service_on_chain_from_safe(hash=service.hash)
manager.fund_service(hash=service.hash)
manager.deploy_service_locally(hash=service.hash)

await run_in_executor(_fn)
schedule_funding_job(service=service.hash)
schedule_healthcheck_job(service=service.hash)
Expand Down Expand Up @@ -666,7 +670,7 @@ async def _build_service_locally(request: Request) -> JSONResponse:
.deployment
)

def _fn():
def _fn() -> None:
deployment.build(force=True)

await run_in_executor(_fn)
Expand All @@ -681,7 +685,7 @@ async def _start_service_locally(request: Request) -> JSONResponse:
service = request.path_params["service"]
manager = operate.service_manager()

def _fn():
def _fn() -> None:
manager.deploy_service_onchain(hash=service)
manager.stake_service_on_chain(hash=service)
manager.fund_service(hash=service)
Expand Down

0 comments on commit 451d54a

Please sign in to comment.