Exemplo n.º 1
0
def _simple_exec_cmd(command,
                     env=None,
                     nice=None,
                     ioclass=None,
                     stdin=None,
                     stdout=None,
                     stderr=None):

    command = wrap_command(command,
                           with_ioclass=ioclass,
                           ioclassdata=None,
                           with_nice=nice,
                           with_setsid=False,
                           with_sudo=False,
                           reset_cpu_affinity=True)

    logging.debug(cmdutils.command_log_line(command, cwd=None))

    p = CPopen(command,
               close_fds=True,
               cwd=None,
               env=env,
               stdin=stdin,
               stdout=stdout,
               stderr=stderr)
    return p
Exemplo n.º 2
0
 def __init__(self, cmd, cwd=None, nice=utils.NICENESS.HIGH,
              ioclass=utils.IOCLASS.IDLE):
     self._cmd = wrap_command(cmd, with_nice=nice, with_ioclass=ioclass)
     self._cwd = cwd
     self._lock = threading.Lock()
     self._state = CREATED
     self._proc = None
Exemplo n.º 3
0
 def __init__(self,
              cmd,
              cwd=None,
              nice=utils.NICENESS.HIGH,
              ioclass=utils.IOCLASS.IDLE):
     self._cmd = wrap_command(cmd, with_nice=nice, with_ioclass=ioclass)
     self._cwd = cwd
     self._lock = threading.Lock()
     self._state = CREATED
     self._proc = None
Exemplo n.º 4
0
 def _start_process(self):
     """
     Starts a dd process performing direct I/O to path, reading the process
     stderr. When stderr has closed, _read_completed will be called.
     """
     cmd = [constants.EXT_DD, "if=%s" % self._path, "of=/dev/null",
            "bs=4096", "count=1", "iflag=direct"]
     cmd = cmdutils.wrap_command(cmd)
     self._proc = CPopen(cmd, stdin=None, stdout=None,
                         stderr=subprocess.PIPE)
     self._reader = self._loop.create_dispatcher(
         asyncevent.BufferedReader, self._proc.stderr, self._read_completed)
Exemplo n.º 5
0
 def _start_process(self):
     """
     Starts a dd process performing direct I/O to path, reading the process
     stderr. When stderr has closed, _read_completed will be called.
     """
     cmd = [constants.EXT_DD, "if=%s" % self._path, "of=/dev/null",
            "bs=4096", "count=1", "iflag=direct"]
     cmd = cmdutils.wrap_command(cmd)
     self._proc = CPopen(cmd, stdin=None, stdout=None,
                         stderr=subprocess.PIPE)
     self._reader = self._loop.create_dispatcher(
         asyncevent.BufferedReader, self._proc.stderr, self._read_completed)
Exemplo n.º 6
0
def _simple_exec_cmd(command, env=None, nice=None, ioclass=None,
                     stdin=None, stdout=None, stderr=None):

    command = cmdutils.wrap_command(command, with_ioclass=ioclass,
                                    ioclassdata=None, with_nice=nice,
                                    with_setsid=False, with_sudo=False,
                                    reset_cpu_affinity=True)

    logging.debug(cmdutils.command_log_line(command, cwd=None))

    p = CPopen(command, close_fds=True, cwd=None, env=env,
               stdin=stdin, stdout=stdout, stderr=stderr)
    return p
Exemplo n.º 7
0
    def __init__(self, cmd, cwd=None):
        self._lock = threading.Lock()
        self._aborted = False
        self._progress = 0.0

        self._stdout = bytearray()
        self._stderr = bytearray()

        self.cmd = wrap_command(cmd,
                                with_nice=utils.NICENESS.HIGH,
                                with_ioclass=utils.IOCLASS.IDLE)
        _log.debug(cmdutils.command_log_line(self.cmd, cwd=cwd))
        self._command = CPopen(self.cmd, cwd=cwd, deathSignal=signal.SIGKILL)
        self._stream = utils.CommandStream(self._command, self._recvstdout,
                                           self._recvstderr)
Exemplo n.º 8
0
    def __init__(self, cmd, cwd=None):
        self._lock = threading.Lock()
        self._aborted = False
        self._progress = 0.0

        self._stdout = bytearray()
        self._stderr = bytearray()

        self.cmd = wrap_command(
            cmd,
            with_nice=utils.NICENESS.HIGH,
            with_ioclass=utils.IOCLASS.IDLE)
        _log.debug(cmdutils.command_log_line(self.cmd, cwd=cwd))
        self._command = CPopen(self.cmd, cwd=cwd,
                               deathSignal=signal.SIGKILL)
        self._stream = utils.CommandStream(
            self._command, self._recvstdout, self._recvstderr)