本文整理匯總了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)