Need to add more cmd line params to be able to deploy

pull/2/head
Guillermo Rodriguez 2022-12-24 11:10:49 -03:00
parent 0a88995cd5
commit 8427eaafd7
No known key found for this signature in database
GPG Key ID: EC3AB66D5D83B392
3 changed files with 33 additions and 10 deletions

View File

@ -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
))

View File

@ -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

View File

@ -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