From 60937420924999abe6c18279665413116254bcec Mon Sep 17 00:00:00 2001 From: snsd0805 Date: Fri, 31 May 2024 21:52:52 +0800 Subject: [PATCH] feat: ctrc+C to stop listening. & move print --- src/node_manager.py | 16 +++++++++------- src/scheduler.py | 1 - 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/node_manager.py b/src/node_manager.py index 3178135..530a039 100644 --- a/src/node_manager.py +++ b/src/node_manager.py @@ -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.") diff --git a/src/scheduler.py b/src/scheduler.py index 551b57d..b2fab07 100644 --- a/src/scheduler.py +++ b/src/scheduler.py @@ -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({