def do_status(self, line):
"""
Display process pool status.
"""
self.clean_tasks()
# this prevents from re-displaying the same status table once ENTER is pressed
# (marker 'restart' is handled in emptyline() hereafter
if line == 'restart' and self.__last_tasklist is not None and \
hash(repr(self.tasklist)) == self.__last_tasklist:
return
self.__last_tasklist = hash(repr(copy(self.tasklist)))
if len(self.tasklist) == 0:
data = [['No task currently running']]
else:
data = [['Task', 'Status', 'Result']]
for task, info in sorted(self.tasklist.items(), key=lambda x: str(x[0])):
data.append([str(task).ljust(15), info['status'].ljust(10), str(info['result']).ljust(40)])
table = SingleTable(data, 'Status of opened tasks')
table.justify_columns = {0: 'center', 1: 'center', 2: 'center'}
print(table.table)
评论列表
文章目录