예제 #1
0
파일: module.py 프로젝트: diluga/ceph
    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
예제 #2
0
파일: module.py 프로젝트: zhunzhong/ceph
    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
예제 #3
0
파일: module.py 프로젝트: cernceph/ceph
 def __json__(self):
     return {
         'id': self.id,
         'running': map(
             lambda x: {
                 'command': x.command,
                 'outs': x.outs,
                 'outb': x.outb,
             },
             self.running
         ),
         'finished': map(
             lambda x: {
                 'command': x.command,
                 'outs': x.outs,
                 'outb': x.outb,
             },
             self.finished
         ),
         'waiting': map(
             lambda x: map(
                 lambda y: common.humanify_command(y),
                 x
             ),
             self.waiting
         ),
         'failed': map(
             lambda x: {
                 'command': x.command,
                 'outs': x.outs,
                 'outb': x.outb,
             },
             self.failed
         ),
         'is_waiting': self.is_waiting(),
         'is_finished': self.is_finished(),
         'has_failed': self.has_failed(),
         'state': self.get_state(),
     }
예제 #4
0
 def __json__(self):
     return {
         'id':
         self.id,
         'running':
         map(
             lambda x: {
                 'command': x.command,
                 'outs': x.outs,
                 'outb': x.outb,
             }, self.running),
         'finished':
         map(
             lambda x: {
                 'command': x.command,
                 'outs': x.outs,
                 'outb': x.outb,
             }, self.finished),
         'waiting':
         map(lambda x: map(lambda y: common.humanify_command(y), x),
             self.waiting),
         'failed':
         map(
             lambda x: {
                 'command': x.command,
                 'outs': x.outs,
                 'outb': x.outb,
             }, self.failed),
         'is_waiting':
         self.is_waiting(),
         'is_finished':
         self.is_finished(),
         'has_failed':
         self.has_failed(),
         'state':
         self.get_state(),
     }