def find_tasks(self): self.publish(channels.list_tasks, "None") self.all_tasks = widgets.VBox([ widgets.HBox( [widgets.Label('TASK NAME'), widgets.Label('ADDRESS')]) ]) self.listen_to_channel(channels.list_tasks_callback(self.id), self.found_task) return self.all_tasks
def work(self): print('\n\n') if args.tree: print(strings.tree) self.listen_to_channel(channels.list_tasks, self.list_tasks) self.listen_to_channel(channels.add_task, self.discovered_tasks) self.listen_to_channel(channels.list_tasks_callback(self.id), self.discovered_tasks) self.listen_to_channel(channels.list_models, self.list_models) self.publish(channels.list_tasks, commands.list_all) else: print(strings.compute) self.listen_to_channel(channels.openmined, self.fit_worker)
def list_tasks(self, message): fr = base58.encode(message['from']) if not os.path.exists(f"{Path.home()}/.openmined/tasks.json"): return with open(f"{Path.home()}/.openmined/tasks.json", "r") as task_list: string_list = task_list.read() tasks = json.loads(string_list) # for t in tasks: # self.listen_for_models(t['name']) callback_channel = channels.list_tasks_callback(fr) print(f'?!?!?!?!?! {callback_channel} {string_list}') self.publish(callback_channel, string_list)