feat: ctrc+C to stop listening. & move print

This commit is contained in:
snsd0805 2024-05-31 21:52:52 +08:00
parent 8e9f6b47cf
commit 6093742092
Signed by: snsd0805
GPG Key ID: 569349933C77A854
2 changed files with 9 additions and 8 deletions

View File

@ -94,16 +94,18 @@ class NodeManager():
print(f"\nWe will register this cluster({self.GPU} * {gpu_num})...")
receipt = self.scheduler.register_cluster(self.wallet, gpu_id, gpu_num)
event = self.scheduler.get_cluster_event(receipt)
print(f"\nOK. this is our cluster event on the blockchain {event[0]['args']}")
for cluster in self.scheduler.get_clusters():
print(cluster)
print("\nOK. this is our cluster event on the blockchain")
print(f" {event[0]['args']}")
# start waiting
print("\nWaiting for the new task from Sepolia testnet...")
self.cluster_communication_module.start_listen_task()
next_task = self.scheduler.listen_task(self.wallet.address)
print(next_task)
print("\nWaiting for the new task from Sepolia testnet...")
print("Ctrl+C to stop the waiting...")
try:
next_task = self.scheduler.listen_task(self.wallet.address)
print(next_task)
except:
print("[STOP] stop the waiting")
else:
print("[ERROR] Connected Failed.")

View File

@ -6,7 +6,6 @@ class Scheduler():
self.w3 = w3
abi = load_abi(abi_file)
self.contract = self.w3.eth.contract(address=address, abi=abi)
print(self.contract.functions)
def signed_and_send_transaction(self, account, function):
tx = function.build_transaction({