def RobustRemoteCommand(self, command, should_log=False):
    self._PushRobustCommandScripts()

    execute_path = os.path.join(vm_util.VM_TMP_DIR,
                                os.path.basename(EXECUTE_COMMAND))
    wait_path = os.path.join(vm_util.VM_TMP_DIR,
                             os.path.basename(WAIT_FOR_COMMAND))

    uid = uuid.uuid4()
    file_base = os.path.join(vm_util.VM_TMP_DIR, 'cmd%s' % uid)
    wrapper_log = file_base + '.log'
    stdout_file = file_base + '.stdout'
    stderr_file = file_base + '.stderr'
    status_file = file_base + '.status'

    if not isinstance(command, basestring):
      command = ' '.join(command)

    start_command = ['nohup', 'python', execute_path,
                     '--stdout', stdout_file,
                     '--stderr', stderr_file,
                     '--status', status_file,
                     '--command', pipes.quote(command)]

    start_command = '%s 1> %s 2>&1 &' % (' '.join(start_command),
                                         wrapper_log)
    self.RemoteCommand(start_command)

    wait_command = ['python', wait_path, '--stdout', stdout_file,
                    '--stderr', stderr_file,
                    '--status', status_file,
                    '--delete']
    try:
      return self.RemoteCommand(' '.join(wait_command), should_log=should_log)
    except errors.VirtualMachine.RemoteCommandError:
      # In case the error was with the wrapper script itself, print the log.
      stdout, _ = self.RemoteCommand('cat %s' % wrapper_log, should_log=False)
      if stdout.strip():
        logging.warn('Exception during RobustRemoteCommand. '
                     'Wrapper script log:\n%s', stdout)
      raise
Convert 1 D chunks
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/linux_virtual_machine.py/BaseLinuxMixin.RobustRemoteCommand--crossover with--dataset/ETHPy150Open dask/dask/dask/array/tests/test_rechunk.py/test_intersect_1