本文整理汇总了Python中progressbar.AdaptiveETA方法的典型用法代码示例。如果您正苦于以下问题:Python progressbar.AdaptiveETA方法的具体用法?Python progressbar.AdaptiveETA怎么用?Python progressbar.AdaptiveETA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类progressbar
的用法示例。
在下文中一共展示了progressbar.AdaptiveETA方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_progressbar
# 需要导入模块: import progressbar [as 别名]
# 或者: from progressbar import AdaptiveETA [as 别名]
def _make_progressbar(self, N):
""" Returns a progressbar to use during optimization"""
if self.max_ind_shift is not None:
bar = progressbar.ProgressBar(widgets=[
' ', progressbar.DynamicMessage('ObjectiveFn'),
' ', progressbar.DynamicMessage('ObjectiveFn_Normalized'),
' Iteration: ',
' ', progressbar.Counter(), '/%d' % N,
' ', progressbar.AdaptiveETA(),
], max_value=N)
else:
bar = progressbar.ProgressBar(widgets=[
' ', progressbar.DynamicMessage('ObjectiveFn'),
' Iteration: ',
' ', progressbar.Counter(), '/%d' % N,
' ', progressbar.AdaptiveETA(),
], max_value=N)
return bar
示例2: start
# 需要导入模块: import progressbar [as 别名]
# 或者: from progressbar import AdaptiveETA [as 别名]
def start(self, threads, version_search=False):
global bar
toolbar_width = (self.__work_queue).qsize()
widgets = [' \u251c Processed: ', Percentage(),' ', Bar(),' ', AdaptiveETA()]
bar = ProgressBar(widgets=widgets, maxval=toolbar_width).start()
if self.__active_threads:
raise Exception('Threads already started.')
try:
# Create thread pool
for _ in range(threads):
worker = threading.Thread(
target=_work_function,
args=(self.__work_queue, self.__result_queue, version_search))
worker.daemon = True
worker.start()
self.__thread_list.append(worker)
self.__active_threads += 1
# Put sentinels to let the threads know when there's no more jobs
[self.__work_queue.put(ThreadPoolSentinel()) for worker in self.__thread_list]
except KeyboardInterrupt:
print('\nReceived keyboard interrupt.\nQuitting...')
exit(-1)