mirror of https://github.com/skygpu/skynet.git
Need to add more cmd line params to be able to deploy
parent
0a88995cd5
commit
8427eaafd7
|
@ -17,7 +17,7 @@ if torch_enabled:
|
||||||
from .dgpu import open_dgpu_node
|
from .dgpu import open_dgpu_node
|
||||||
|
|
||||||
from .brain import run_skynet
|
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
|
from .frontend.telegram import run_skynet_telegram
|
||||||
|
|
||||||
|
@ -60,18 +60,26 @@ def run(*args, **kwargs):
|
||||||
@run.command()
|
@run.command()
|
||||||
@click.option('--loglevel', '-l', default='warning', help='Logging level')
|
@click.option('--loglevel', '-l', default='warning', help='Logging level')
|
||||||
@click.option(
|
@click.option(
|
||||||
'--host', '-h', default='localhost:5432')
|
'--host', '-H', default=DEFAULT_RPC_ADDR)
|
||||||
@click.option(
|
@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(
|
def brain(
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
host: str,
|
host: str,
|
||||||
passwd: str
|
host_dgpu: str,
|
||||||
|
db_host: str,
|
||||||
|
db_pass: str
|
||||||
):
|
):
|
||||||
async def _run_skynet():
|
async def _run_skynet():
|
||||||
async with run_skynet(
|
async with run_skynet(
|
||||||
db_host=host,
|
db_host=db_host,
|
||||||
db_pass=passwd
|
db_pass=db_pass,
|
||||||
|
rpc_address=host,
|
||||||
|
dgpu_address=host_dgpu
|
||||||
):
|
):
|
||||||
await trio.sleep_forever()
|
await trio.sleep_forever()
|
||||||
|
|
||||||
|
@ -88,12 +96,18 @@ def brain(
|
||||||
'--cert', '-c', default='whitelist/dgpu')
|
'--cert', '-c', default='whitelist/dgpu')
|
||||||
@click.option(
|
@click.option(
|
||||||
'--algos', '-a', default=json.dumps(['midj']))
|
'--algos', '-a', default=json.dumps(['midj']))
|
||||||
|
@click.option(
|
||||||
|
'--rpc', '-r', default=DEFAULT_RPC_ADDR)
|
||||||
|
@click.option(
|
||||||
|
'--dgpu', '-d', default=DEFAULT_DGPU_ADDR)
|
||||||
def dgpu(
|
def dgpu(
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
uid: str,
|
uid: str,
|
||||||
key: str,
|
key: str,
|
||||||
cert: str,
|
cert: str,
|
||||||
algos: str
|
algos: str,
|
||||||
|
rpc: str,
|
||||||
|
dgpu: str
|
||||||
):
|
):
|
||||||
trio.run(
|
trio.run(
|
||||||
partial(
|
partial(
|
||||||
|
@ -101,6 +115,8 @@ def dgpu(
|
||||||
cert,
|
cert,
|
||||||
uid,
|
uid,
|
||||||
key_name=key,
|
key_name=key,
|
||||||
|
rpc_address=rpc,
|
||||||
|
dgpu_address=dgpu,
|
||||||
initial_algos=json.loads(algos)
|
initial_algos=json.loads(algos)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -111,10 +127,13 @@ def dgpu(
|
||||||
'--key', '-k', default='telegram-frontend')
|
'--key', '-k', default='telegram-frontend')
|
||||||
@click.option(
|
@click.option(
|
||||||
'--cert', '-c', default='whitelist/telegram-frontend')
|
'--cert', '-c', default='whitelist/telegram-frontend')
|
||||||
|
@click.option(
|
||||||
|
'--rpc', '-r', default=DEFAULT_RPC_ADDR)
|
||||||
def telegram(
|
def telegram(
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
key: str,
|
key: str,
|
||||||
cert: str
|
cert: str,
|
||||||
|
rpc: str
|
||||||
):
|
):
|
||||||
assert 'TG_TOKEN' in os.environ
|
assert 'TG_TOKEN' in os.environ
|
||||||
trio_asyncio.run(
|
trio_asyncio.run(
|
||||||
|
@ -122,5 +141,6 @@ def telegram(
|
||||||
run_skynet_telegram,
|
run_skynet_telegram,
|
||||||
os.environ['TG_TOKEN'],
|
os.environ['TG_TOKEN'],
|
||||||
key_name=key,
|
key_name=key,
|
||||||
cert_name=cert
|
cert_name=cert,
|
||||||
|
rpc_address=rpc
|
||||||
))
|
))
|
||||||
|
|
|
@ -137,6 +137,7 @@ async def open_dgpu_node(
|
||||||
|
|
||||||
async with open_skynet_rpc(
|
async with open_skynet_rpc(
|
||||||
unique_id,
|
unique_id,
|
||||||
|
rpc_address=rpc_address,
|
||||||
security=security,
|
security=security,
|
||||||
cert_name=cert_name,
|
cert_name=cert_name,
|
||||||
key_name=key_name
|
key_name=key_name
|
||||||
|
|
|
@ -36,7 +36,8 @@ def prepare_metainfo_caption(meta: dict) -> str:
|
||||||
async def run_skynet_telegram(
|
async def run_skynet_telegram(
|
||||||
tg_token: str,
|
tg_token: str,
|
||||||
key_name: str = 'telegram-frontend',
|
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)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
@ -44,6 +45,7 @@ async def run_skynet_telegram(
|
||||||
|
|
||||||
async with open_skynet_rpc(
|
async with open_skynet_rpc(
|
||||||
'skynet-telegram-0',
|
'skynet-telegram-0',
|
||||||
|
rpc_address=rpc_address,
|
||||||
security=True,
|
security=True,
|
||||||
cert_name=cert_name,
|
cert_name=cert_name,
|
||||||
key_name=key_name
|
key_name=key_name
|
||||||
|
|
Loading…
Reference in New Issue