def shutdown(self): """Shuts down all components. This should be called when the program exits so that components can do any necessary clean-up.""" # Stop all components first self.stop() for component in self.components.keys(): log.debug("Shutting down component %s..", component) try: if self.components[component].get_state() != COMPONENT_STATE.index("Stopped"): self.components[component].shutdown() except Exception, e: log.debug("Unable to call shutdown(): %s", e)