Update nodeos genesis init

add-txt2txt-models
Guillermo Rodriguez 2023-06-01 19:02:59 -03:00
parent e6e3dc2e63
commit 320f13260c
No known key found for this signature in database
GPG Key ID: EC3AB66D5D83B392
4 changed files with 22 additions and 51 deletions

View File

@ -1,3 +1,4 @@
pytz
trio
asks
numpy

View File

@ -334,32 +334,15 @@ def dgpu(
key, account, permission = load_account_info(
key, account, permission)
vtestnet = None
try:
dclient = docker.from_env()
vtestnet = get_container(
dclient,
default_nodeos_image(),
force_unique=True,
detach=True,
network='host',
remove=True)
cleos = CLEOS(dclient, vtestnet, url=node_url, remote=node_url)
trio.run(
partial(
open_dgpu_node,
account, permission,
cleos,
ipfs_url,
auto_withdraw=auto_withdraw,
key=key, initial_algos=json.loads(algos)
))
finally:
if vtestnet:
vtestnet.stop()
trio.run(
partial(
open_dgpu_node,
account, permission,
CLEOS(None, None, url=node_url, remote=node_url),
ipfs_url,
auto_withdraw=auto_withdraw,
key=key, initial_algos=json.loads(algos)
))
@run.command()

View File

@ -15,8 +15,8 @@ import asks
import docker
from PIL import Image
from leap.cleos import CLEOS, default_nodeos_image
from leap.sugar import get_container, collect_stdout
from leap.cleos import CLEOS
from leap.sugar import *
from leap.hyperion import HyperionAPI
from trio_asyncio import aio_as_trio
from telebot.types import (
@ -131,6 +131,7 @@ async def work_request(
message, user, chat,
account: str,
permission: str,
private_key: str,
params: dict,
file_id: str | None = None,
binary_data: str = ''
@ -152,7 +153,7 @@ async def work_request(
request_time = datetime.now().isoformat()
reward = '20.0000 GPU'
res = await cleos.s_push_action(
res = await cleos.a_push_action(
'telos.gpu',
'enqueue',
{
@ -161,7 +162,7 @@ async def work_request(
'binary_data': binary_data,
'reward': asset_from_str(reward)
},
account, key, permission=permission
account, private_key, permission=permission
)
if 'code' in res:
@ -210,7 +211,7 @@ async def work_request(
return
# attempt to get the image and send it
ipfs_link = f'http://test1.us.telos.net:8080/ipfs/{ipfs_hash}/image.png'
ipfs_link = f'https://ipfs.ancap.tech/ipfs/{ipfs_hash}/image.png'
resp = await get_ipfs_file(ipfs_link)
caption = generate_reply_caption(
@ -262,23 +263,11 @@ async def run_skynet_telegram(
remote_ipfs_node: str,
key: str = None
):
dclient = docker.from_env()
vtestnet = get_container(
dclient,
default_nodeos_image(),
force_unique=True,
detach=True,
network='host',
remove=True)
cleos = CLEOS(dclient, vtestnet, url=node_url, remote=node_url)
cleos = CLEOS(None, None, url=node_url, remote=node_url)
hyperion = HyperionAPI(hyperion_url)
logging.basicConfig(level=logging.INFO)
if key:
cleos.setup_wallet(key)
bot = AsyncTeleBot(tg_token, exception_handler=SKYExceptionHandler)
logging.info(f'tg_token: {tg_token}')
@ -346,7 +335,7 @@ async def run_skynet_telegram(
ec = await work_request(
bot, cleos, hyperion,
message, user, chat,
account, permission, params
account, permission, key, params
)
if ec == 0:
@ -423,7 +412,7 @@ async def run_skynet_telegram(
ec = await work_request(
bot, cleos, hyperion,
message, user, chat,
account, permission, params,
account, permission, key, params,
file_id=file_id,
binary_data=ipfs_hash
)
@ -488,7 +477,7 @@ async def run_skynet_telegram(
await work_request(
bot, cleos, hyperion,
message, user, chat,
account, permission, params,
account, permission, key, params,
file_id=file_id,
binary_data=binary
)
@ -575,6 +564,3 @@ async def run_skynet_telegram(
except KeyboardInterrupt:
...
finally:
vtestnet.stop()

View File

@ -9,6 +9,7 @@ from contextlib import contextmanager as cm
import docker
from pytz import timezone
from leap.cleos import CLEOS, default_nodeos_image
from leap.sugar import get_container, Symbol, random_string
@ -69,7 +70,7 @@ def open_nodeos(cleanup: bool = True):
cleos.setup_wallet(priv)
genesis = json.dumps({
"initial_timestamp": datetime.now().isoformat(),
"initial_timestamp": '2017-08-29T02:14:00.000',
"initial_key": pub,
"initial_configuration": {
"max_block_net_usage": 1048576,