tightening display, showing target for threads, and cleaning up finished builds from crashed run
This commit is contained in:
parent
96f7352a62
commit
1fb0ac84be
|
@ -128,25 +128,36 @@ class CompileThread(threading.Thread):
|
|||
self.rosmakeall.printer.print_verbose("[ Build Terminated Thread Exiting ]", thread_name=self.name)
|
||||
break # no more packages must be done
|
||||
|
||||
# update status after accepting build
|
||||
self.rosmakeall.update_status(self.argument ,
|
||||
self.build_queue.get_started_threads(),
|
||||
self.build_queue.progress_str())
|
||||
|
||||
if self.argument:
|
||||
self.rosmakeall.printer.print_all ("Starting >>> %s [ make %s ]"%(pkg, self.argument), thread_name=self.name)
|
||||
else:
|
||||
self.rosmakeall.printer.print_all ("Starting >>> %s [ make ] "%pkg, thread_name=self.name)
|
||||
self.rosmakeall.update_status("Thread Status:" , #TODO add build command/make argument here
|
||||
self.build_queue.get_started_threads(),
|
||||
self.build_queue.progress_str())
|
||||
(result, result_string) = self.rosmakeall.build(pkg, self.argument, self.build_queue.robust_build)
|
||||
self.rosmakeall.printer.print_all("Finished <<< %s %s"%(pkg, result_string), thread_name= self.name)
|
||||
if result or self.build_queue.robust_build:
|
||||
self.build_queue.return_built(pkg)
|
||||
self.build_queue.return_built(pkg, result)
|
||||
if result_string.find("[Interrupted]") != -1:
|
||||
self.rosmakeall.printer.print_all("Caught Interruption", thread_name=self.name)
|
||||
self.build_queue.stop()
|
||||
self.build_queue.stop() #todo move this logic into BuildQueue itself
|
||||
break # unnecessary since build_queue is done now while will quit
|
||||
else:
|
||||
self.rosmakeall.printer.print_all("Halting due to failure in package %s. \n[ rosmake ] Waiting for other threads to complete."%pkg)
|
||||
self.build_queue.stop()
|
||||
break # unnecessary since build_queue is done now, while will quit
|
||||
# update status after at end of build
|
||||
self.rosmakeall.update_status(self.argument ,
|
||||
self.build_queue.get_started_threads(),
|
||||
self.build_queue.progress_str())
|
||||
|
||||
# update status before ending thread
|
||||
self.rosmakeall.update_status(self.argument ,
|
||||
self.build_queue.get_started_threads(),
|
||||
self.build_queue.progress_str())
|
||||
|
||||
class BuildQueue:
|
||||
""" This class provides a thread safe build queue. Which will do
|
||||
|
@ -162,7 +173,7 @@ class BuildQueue:
|
|||
self._started = {}
|
||||
|
||||
def progress_str(self):
|
||||
return "[ %d Active, %d of %d Complete ]"%(len(self._started), len(self.built), self._total_pkgs)
|
||||
return "[ %d Active %d/%d Complete ]"%(len(self._started), len(self.built), self._total_pkgs)
|
||||
|
||||
def get_started_threads(self): #TODO sort this other than hash order
|
||||
return self._started.copy()
|
||||
|
@ -182,11 +193,12 @@ class BuildQueue:
|
|||
with self.condition:
|
||||
self.condition.notifyAll() # wake any blocking threads
|
||||
|
||||
def return_built(self, package): # mark that a package is built
|
||||
def return_built(self, package, successful=True): # mark that a package is built
|
||||
""" The thread which completes a package marks it as done with
|
||||
this method."""
|
||||
with self.condition:
|
||||
self.built.append(package)
|
||||
if successful:
|
||||
self.built.append(package)
|
||||
if package in self._started.keys():
|
||||
self._started.pop(package)
|
||||
else:
|
||||
|
|
|
@ -75,7 +75,7 @@ class Printer(threading.Thread):
|
|||
self.full_verbose = False
|
||||
|
||||
# Rosmake specific data
|
||||
self.cache_left = ''
|
||||
self.cache_argument = None
|
||||
self.cache_right = ''
|
||||
self.pkg_start_times = {}
|
||||
|
||||
|
@ -99,8 +99,8 @@ class Printer(threading.Thread):
|
|||
self._print_status("%s"%status)
|
||||
time.sleep(1.0/60.) # update status at 60Hz
|
||||
|
||||
def rosmake_cache_info(self, left, start_times, right):
|
||||
self.cache_left = left
|
||||
def rosmake_cache_info(self, argument, start_times, right):
|
||||
self.cache_argument = argument
|
||||
self.pkg_start_times = start_times
|
||||
self.cache_right = right
|
||||
|
||||
|
@ -112,7 +112,10 @@ class Printer(threading.Thread):
|
|||
return " ".join(threads)
|
||||
|
||||
def set_status_from_cache(self):
|
||||
self.set_status(self.cache_left + self.rosmake_pkg_times_to_string(self.pkg_start_times), self.cache_right)
|
||||
if self.cache_argument:
|
||||
self.set_status("[ make %s ] "%self.cache_argument + self.rosmake_pkg_times_to_string(self.pkg_start_times), self.cache_right)
|
||||
else:
|
||||
self.set_status("[ make ] " + self.rosmake_pkg_times_to_string(self.pkg_start_times), self.cache_right)
|
||||
|
||||
def set_status(self, left, right = ''):
|
||||
header = "[ rosmake ] "
|
||||
|
@ -217,8 +220,8 @@ class RosMakeAll:
|
|||
"""
|
||||
return len(self.result[argument].keys())
|
||||
|
||||
def update_status(self, left, start_times, right):
|
||||
self.printer.rosmake_cache_info(left, start_times, right)
|
||||
def update_status(self, argument, start_times, right):
|
||||
self.printer.rosmake_cache_info(argument, start_times, right)
|
||||
|
||||
def get_path(self, package):
|
||||
if not package in self.paths:
|
||||
|
|
Loading…
Reference in New Issue