mirror of https://github.com/skygpu/skynet.git
address pr comments, remove commented code
parent
de59e3aa1d
commit
619ffe71cc
|
@ -122,21 +122,13 @@ def enqueue(
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
key, account, permission = load_account_info(
|
key, account, permission = load_account_info(
|
||||||
'dgpu', key, account, permission)
|
'user', key, account, permission)
|
||||||
|
|
||||||
node_url, _, _ = load_endpoint_info(
|
node_url, _, _ = load_endpoint_info(
|
||||||
'dgpu', node_url, None, None)
|
'user', node_url, None, None)
|
||||||
|
|
||||||
with open_cleos(node_url, key=key) as cleos:
|
with open_cleos(node_url, key=key) as cleos:
|
||||||
# if not kwargs['seed']:
|
async def enqueue_n_jobs():
|
||||||
# kwargs['seed'] = random.randint(0, 10e9)
|
|
||||||
#
|
|
||||||
# req = json.dumps({
|
|
||||||
# 'method': 'diffuse',
|
|
||||||
# 'params': kwargs
|
|
||||||
# })
|
|
||||||
# binary = ''
|
|
||||||
|
|
||||||
for i in range(jobs):
|
for i in range(jobs):
|
||||||
if not kwargs['seed']:
|
if not kwargs['seed']:
|
||||||
kwargs['seed'] = random.randint(0, 10e9)
|
kwargs['seed'] = random.randint(0, 10e9)
|
||||||
|
@ -147,7 +139,7 @@ def enqueue(
|
||||||
})
|
})
|
||||||
binary = kwargs['binary_data']
|
binary = kwargs['binary_data']
|
||||||
|
|
||||||
res = trio.run(cleos.a_push_action,
|
res = await cleos.a_push_action(
|
||||||
'telos.gpu',
|
'telos.gpu',
|
||||||
'enqueue',
|
'enqueue',
|
||||||
{
|
{
|
||||||
|
@ -157,14 +149,11 @@ def enqueue(
|
||||||
'reward': asset_from_str(reward),
|
'reward': asset_from_str(reward),
|
||||||
'min_verification': 1
|
'min_verification': 1
|
||||||
},
|
},
|
||||||
# [account, req, binary, reward],
|
|
||||||
# [account, req, binary, reward, kwargs['min_verification']],
|
|
||||||
account, key, permission,
|
account, key, permission,
|
||||||
#f'{account}@{permission}'
|
|
||||||
)
|
)
|
||||||
print(res)
|
print(res)
|
||||||
# print(collect_stdout(out))
|
trio.run(enqueue_n_jobs)
|
||||||
# assert ec == 0
|
|
||||||
|
|
||||||
@skynet.command()
|
@skynet.command()
|
||||||
@click.option('--loglevel', '-l', default='INFO', help='Logging level')
|
@click.option('--loglevel', '-l', default='INFO', help='Logging level')
|
||||||
|
@ -268,11 +257,8 @@ def dequeue(
|
||||||
'request_id': int(request_id),
|
'request_id': int(request_id),
|
||||||
},
|
},
|
||||||
account, key, permission,
|
account, key, permission,
|
||||||
# [account, request_id], f'{account}@{permission}'
|
|
||||||
)
|
)
|
||||||
print(res)
|
print(res)
|
||||||
# print(collect_stdout(out))
|
|
||||||
# assert ec == 0
|
|
||||||
|
|
||||||
|
|
||||||
@skynet.command()
|
@skynet.command()
|
||||||
|
@ -310,12 +296,9 @@ def config(
|
||||||
'token_symbol': token_symbol,
|
'token_symbol': token_symbol,
|
||||||
},
|
},
|
||||||
account, key, permission,
|
account, key, permission,
|
||||||
# [token_contract, token_symbol],
|
|
||||||
# f'{account}@{permission}'
|
|
||||||
)
|
)
|
||||||
print(res)
|
print(res)
|
||||||
# print(collect_stdout(out))
|
|
||||||
# assert ec == 0
|
|
||||||
|
|
||||||
@skynet.command()
|
@skynet.command()
|
||||||
@click.option(
|
@click.option(
|
||||||
|
@ -324,12 +307,6 @@ def config(
|
||||||
'--permission', '-p', default='active')
|
'--permission', '-p', default='active')
|
||||||
@click.option(
|
@click.option(
|
||||||
'--key', '-k', default=None)
|
'--key', '-k', default=None)
|
||||||
@click.option(
|
|
||||||
'--sender', '-s', default=None)
|
|
||||||
@click.option(
|
|
||||||
'--recipient', '-r', default=None)
|
|
||||||
@click.option(
|
|
||||||
'--memo', '-m', default="")
|
|
||||||
@click.option(
|
@click.option(
|
||||||
'--node-url', '-n', default='https://skynet.ancap.tech')
|
'--node-url', '-n', default='https://skynet.ancap.tech')
|
||||||
@click.argument('quantity')
|
@click.argument('quantity')
|
||||||
|
@ -337,30 +314,26 @@ def deposit(
|
||||||
account: str,
|
account: str,
|
||||||
permission: str,
|
permission: str,
|
||||||
key: str | None,
|
key: str | None,
|
||||||
sender: str,
|
|
||||||
recipient: str,
|
|
||||||
memo: str,
|
|
||||||
node_url: str,
|
node_url: str,
|
||||||
quantity: str
|
quantity: str
|
||||||
):
|
):
|
||||||
key, account, permission = load_account_info(
|
key, account, permission = load_account_info(
|
||||||
'dgpu', key, account, permission)
|
'user', key, account, permission)
|
||||||
|
|
||||||
node_url, _, _ = load_endpoint_info(
|
node_url, _, _ = load_endpoint_info(
|
||||||
'dgpu', node_url, None, None)
|
'user', node_url, None, None)
|
||||||
|
|
||||||
with open_cleos(node_url, key=key) as cleos:
|
with open_cleos(node_url, key=key) as cleos:
|
||||||
res = trio.run(cleos.a_push_action,
|
res = trio.run(cleos.a_push_action,
|
||||||
'eosio.token',
|
'eosio.token',
|
||||||
'transfer',
|
'transfer',
|
||||||
{
|
{
|
||||||
'sender': Name(sender),
|
'sender': Name(account),
|
||||||
'recipient': Name(recipient),
|
'recipient': Name('telos.gpu'),
|
||||||
'amount': asset_from_str(quantity),
|
'amount': asset_from_str(quantity),
|
||||||
'memo': memo
|
'memo': f'{account} transferred {quantity} to telos.gpu'
|
||||||
},
|
},
|
||||||
# [sender, recipient, quantity, memo],
|
|
||||||
account, key, permission,
|
account, key, permission,
|
||||||
# f"{account}@{permission}",
|
|
||||||
)
|
)
|
||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue