Example #1
0
 def run(self):
     # first get commands
     self.getCommands()
     if VERBOSE:
         print self.commands
     for c in self.commands:
         c.finished = False
     # next get first commands
     self.first_commands = InstanceCommand.getFirstCommands(self.commands)
     # add commands to run to a queue
     threads = []
     for command in self.first_commands:
         threads.append(RunCommandThread(command, worker=self))
     # start all threads, when each thread finishes command it starts a new set of
     # threads for yet to be completed and ready commands and waits for them to
     # complete, so when the initial threads are finished all threads are finished
     for thread in threads:
         thread.start()
     # what for threads to finish
     for thread in threads:
         thread.join()
Example #2
0
 def testGetFirstCommands(self):
     commands = self.getCommands()
     firstcommands = InstanceCommand.getFirstCommands(commands)
     # do first commands have any dependencies in all commands
     allIDs = [c.id for c in commands]
     self.assertTrue(all([all([cd.id not in allIDs for cd in c.command_dependencies]) for c in firstcommands]), "first commands have dependencies in all commands")