From 8427eaafd7646dae928f76b36a8656a99f65990a Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Date: Sat, 24 Dec 2022 11:10:49 -0300 Subject: [PATCH] Need to add more cmd line params to be able to deploy --- skynet/cli.py | 38 ++++++++++++++++++++++++++++--------- skynet/dgpu.py | 1 + skynet/frontend/telegram.py | 4 +++- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/skynet/cli.py b/skynet/cli.py index 4082a34..1d7b501 100644 --- a/skynet/cli.py +++ b/skynet/cli.py @@ -17,7 +17,7 @@ if torch_enabled: from .dgpu import open_dgpu_node from .brain import run_skynet -from .constants import ALGOS +from .constants import ALGOS, DEFAULT_RPC_ADDR, DEFAULT_DGPU_ADDR from .frontend.telegram import run_skynet_telegram @@ -60,18 +60,26 @@ def run(*args, **kwargs): @run.command() @click.option('--loglevel', '-l', default='warning', help='Logging level') @click.option( - '--host', '-h', default='localhost:5432') + '--host', '-H', default=DEFAULT_RPC_ADDR) @click.option( - '--passwd', '-p', default='password') + '--host-dgpu', '-D', default=DEFAULT_DGPU_ADDR) +@click.option( + '--db-host', '-h', default='localhost:5432') +@click.option( + '--db-pass', '-p', default='password') def brain( loglevel: str, host: str, - passwd: str + host_dgpu: str, + db_host: str, + db_pass: str ): async def _run_skynet(): async with run_skynet( - db_host=host, - db_pass=passwd + db_host=db_host, + db_pass=db_pass, + rpc_address=host, + dgpu_address=host_dgpu ): await trio.sleep_forever() @@ -88,12 +96,18 @@ def brain( '--cert', '-c', default='whitelist/dgpu') @click.option( '--algos', '-a', default=json.dumps(['midj'])) +@click.option( + '--rpc', '-r', default=DEFAULT_RPC_ADDR) +@click.option( + '--dgpu', '-d', default=DEFAULT_DGPU_ADDR) def dgpu( loglevel: str, uid: str, key: str, cert: str, - algos: str + algos: str, + rpc: str, + dgpu: str ): trio.run( partial( @@ -101,6 +115,8 @@ def dgpu( cert, uid, key_name=key, + rpc_address=rpc, + dgpu_address=dgpu, initial_algos=json.loads(algos) )) @@ -111,10 +127,13 @@ def dgpu( '--key', '-k', default='telegram-frontend') @click.option( '--cert', '-c', default='whitelist/telegram-frontend') +@click.option( + '--rpc', '-r', default=DEFAULT_RPC_ADDR) def telegram( loglevel: str, key: str, - cert: str + cert: str, + rpc: str ): assert 'TG_TOKEN' in os.environ trio_asyncio.run( @@ -122,5 +141,6 @@ def telegram( run_skynet_telegram, os.environ['TG_TOKEN'], key_name=key, - cert_name=cert + cert_name=cert, + rpc_address=rpc )) diff --git a/skynet/dgpu.py b/skynet/dgpu.py index 1a04367..d002d59 100644 --- a/skynet/dgpu.py +++ b/skynet/dgpu.py @@ -137,6 +137,7 @@ async def open_dgpu_node( async with open_skynet_rpc( unique_id, + rpc_address=rpc_address, security=security, cert_name=cert_name, key_name=key_name diff --git a/skynet/frontend/telegram.py b/skynet/frontend/telegram.py index e3d073b..3edb729 100644 --- a/skynet/frontend/telegram.py +++ b/skynet/frontend/telegram.py @@ -36,7 +36,8 @@ def prepare_metainfo_caption(meta: dict) -> str: async def run_skynet_telegram( tg_token: str, key_name: str = 'telegram-frontend', - cert_name: str = 'whitelist/telegram-frontend' + cert_name: str = 'whitelist/telegram-frontend', + rpc_address: str = DEFAULT_RPC_ADDR ): logging.basicConfig(level=logging.INFO) @@ -44,6 +45,7 @@ async def run_skynet_telegram( async with open_skynet_rpc( 'skynet-telegram-0', + rpc_address=rpc_address, security=True, cert_name=cert_name, key_name=key_name