Example #1
0
    def main_loop(self):
        """
        Called in a looping call.
        This is actually the main loop of the application.
        
        Starting by the process with no dependency, starts them, in the order they were given, sleeping some time before each, as configured using their sleep_after attribute. 
        
        The master is set up to either keep every child alive, or keep them dead. Stopping them is done as soon as possible. Starting them is done using the sequence described above. 

        
        # get children of the root
        # get time now
        # if not started give them a time to be started, if it doesn't have one
        # if started, check if it has children
        # if so, give it a time to be started.

        """
        # Trying to make all child live. (False if in the process of quitting)
        #orphans = self.tree.get_supported_by(self.tree.ROOT)
        #self._manage_siblings(orphans, should_run=self.wants_to_live)
        #log.info("----- Managing slaves LOOP ----")

        self._time_now = time.time()
        iterator = graph.iter_from_root_to_leaves(self.tree)
        for current in iterator:
            if current != self.tree.ROOT:
                self._treat_node(current)
Example #2
0
 def test_iterator(self):
     iterator = graph.iter_from_root_to_leaves(self.g)
     visited = []
     for n in iterator:
         visited.append(n)
     self.failUnlessEqual(
         visited,
         [self.g.ROOT, "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"])
Example #3
0
 def test_iterator(self):
     iterator = graph.iter_from_root_to_leaves(self.g)
     visited = []
     for n in iterator:
         visited.append(n)
     self.failUnlessEqual(visited, [self.g.ROOT, "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"])