Python progressbar.AdaptiveETA() Examples

The following are 2 code examples of progressbar.AdaptiveETA(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module progressbar , or try the search function .
Example #1
Source File: optimization.py    From angler with MIT License 6 votes vote down vote up
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 
Example #2
Source File: thread_pool.py    From Typo3Scan with GNU General Public License v2.0 6 votes vote down vote up
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)