def run(self, commands): """ A static method that will execute the given list of commands in parallel and will return the list of command results. """ # Gather the results (in parallel) results = [] for index in range(len(commands)): tag = '%s:%d' % (str(self.id), index) # Store the result result = CommandResult(tag) result.command = common.humanify_command(commands[index]) results.append(result) # Run the command instance.send_command(result, 'mon', '', json.dumps(commands[index]), tag) return results
def run(self, commands): """ A static method that will execute the given list of commands in parallel and will return the list of command results. """ # Gather the results (in parallel) results = [] for index in range(len(commands)): tag = '%s:%d' % (str(self.id), index) # Store the result result = CommandResult(tag) result.command = common.humanify_command(commands[index]) results.append(result) # Run the command context.instance.send_command(result, 'mon', '', json.dumps(commands[index]), tag) return results
def run(self, commands): """ A static method that will execute the given list of commands in parallel and will return the list of command results. """ # Gather the results (in parallel) results = [] for index, command in enumerate(commands): tag = '%s:%s:%d' % (__name__, self.id, index) # Store the result result = CommandResult(tag) result.command = common.humanify_command(command) results.append(result) # Run the command context.instance.send_command(result, 'mon', '', json.dumps(command), tag) return results