def ExecuteInParallel(commands, on_output=None, serial=False):
    '''
    @param commands: list(ParallelCmd)
        The commands to execute.
        
    @param on_output: callable
        Method to be called when the command finishes and gives it output 
        (by default Prints the output).
        
    @param serial: bool
        This probably should not be here, but leave it for now: execute things in parallel instead.
    '''

    from mu_repo.execute_git_command_in_thread import ExecuteGitCommandThread
    try:
        import Queue
    except ImportError:
        import queue as Queue

    threads = []
    output_queue = Queue.Queue()
    for cmd in commands:
        t = ExecuteGitCommandThread(cmd.repo, cmd.cmd, output_queue)
        threads.append(t)

    if serial:
        for t in threads:
            t.run(serial=True)  #When serial will print as is executing.
    else:
        from mu_repo.execute_git_command_in_thread import ExecuteThreadsHandlingOutputQueue
        ExecuteThreadsHandlingOutputQueue(threads,
                                          output_queue,
                                          on_output=on_output)
def ExecuteInParallel(commands, on_output=None, serial=False):
    '''
    @param commands: list(ParallelCmd)
        The commands to execute.
        
    @param on_output: callable
        Method to be called when the command finishes and gives it output 
        (by default Prints the output).
        
    @param serial: bool
        This probably should not be here, but leave it for now: execute things in parallel instead.
    '''

    from mu_repo.execute_git_command_in_thread import ExecuteGitCommandThread
    try:
        import Queue
    except ImportError:
        import queue as Queue

    threads = []
    output_queue = Queue.Queue()
    for cmd in commands:
        t = ExecuteGitCommandThread(
            cmd.repo, cmd.cmd, output_queue)
        threads.append(t)

    if serial:
        for t in threads:
            t.run(serial=True) #When serial will print as is executing.
    else:
        from mu_repo.execute_git_command_in_thread import ExecuteThreadsHandlingOutputQueue
        ExecuteThreadsHandlingOutputQueue(threads, output_queue, on_output=on_output)
Example #3
0
    def __init__(self, config, repo, symlink, temp_working, temp_repo, branch):
        self.symlink = symlink
        self.temp_working = temp_working
        self.temp_repo = temp_repo
        self.branch = branch
        self.config = config
        if not branch:
            args = 'status --porcelain -z'.split()
        else:
            args = 'diff --name-only -z HEAD'.split() + [branch]
        self.entry_count = 0

        ExecuteGitCommandThread.__init__(
            self, repo, [config.git] + args, output_queue=DummyQueue())
Example #4
0
    def __init__(self, config, repo, symlink, temp_working, temp_repo, branch):
        self.symlink = symlink
        self.temp_working = temp_working
        self.temp_repo = temp_repo
        self.branch = branch
        self.config = config
        if not branch:
            args = 'status --porcelain -z'.split()
        else:
            args = 'diff --name-only -z HEAD'.split() + [branch]
        self.entry_count = 0

        ExecuteGitCommandThread.__init__(self,
                                         repo, [config.git] + args,
                                         output_queue=DummyQueue())
Example #5
0
 def run(self):
     try:
         ExecuteGitCommandThread.run(self, serial=False)
     except:
         NotifyErrorListeners()
Example #6
0
 def run(self):
     try:
         ExecuteGitCommandThread.run(self, serial=False)
     except:
         NotifyErrorListeners()