parameters: (numParallelProcesses, commandString, argumentFilePath, parallelArgs=[], nodeListPath=None, verbose=False)
return_statement: return returnCode
docstring: Use GNU Parallel to spread task across multiple computers and processes
docstring_summary: Use GNU Parallel to spread task across multiple computers and processes
docstring_tokens: Use GNU Parallel to spread task across multiple computers and processes
function: def runInGnuParallel(numParallelProcesses, commandString, argumentFilePath, parallelArgs=[], nodeListPath=None, verbose=False):
      """Use GNU Parallel to spread task across multiple computers and processes"""
  
      # Make sure GNU parallel is installed
      if not checkIfToolExists('parallel'):
          raise Exception('Need GNU Parallel to distribute the jobs.')
  
      # Ensure our 'parallel' is not out of date
      check_parallel_version()
  
      # Use GNU parallel with given number of processes.
      # Let output be interspersed, read input series from file
      # Start in the same directory on remote machines. Ensure
      # that vital env variables are copied over.
      cmd = ['parallel',  '--will-cite', '--workdir', os.getcwd(), '-u',
             '--env', 'PATH', '--env', 'PYTHONPATH', '--env', 'ISISROOT',
             '--env', 'ISISDATA', '-a', argumentFilePath]
  
      # Add number of processes if specified (default is one job per CPU core)
      if numParallelProcesses is not None:
          cmd += ['-P', str(numParallelProcesses)]
  
      # Add list of nodes as argument to the parallel tool if it is available
      if nodeListPath is not None:
          cmd += ['--sshloginfile', nodeListPath]
  
      # Append any additional arguments to parallel
      cmd += parallelArgs
  
      # Append the actual command we want to call to the GNU Parallel call
      cmd += [commandString]
  
      if verbose: # Echo the command line call we are about to make
          print(" ".join(cmd))
  
      returnCode = subprocess.call(cmd)
      return returnCode
function_tokens: def runInGnuParallel ( numParallelProcesses , commandString , argumentFilePath , parallelArgs = [ ] , nodeListPath = None , verbose = False ) : # Make sure GNU parallel is installed if not checkIfToolExists ( 'parallel' ) : raise Exception ( 'Need GNU Parallel to distribute the jobs.' ) # Ensure our 'parallel' is not out of date check_parallel_version ( ) # Use GNU parallel with given number of processes. # Let output be interspersed, read input series from file # Start in the same directory on remote machines. Ensure # that vital env variables are copied over. cmd = [ 'parallel' , '--will-cite' , '--workdir' , os . getcwd ( ) , '-u' , '--env' , 'PATH' , '--env' , 'PYTHONPATH' , '--env' , 'ISISROOT' , '--env' , 'ISISDATA' , '-a' , argumentFilePath ] # Add number of processes if specified (default is one job per CPU core) if numParallelProcesses is not None : cmd += [ '-P' , str ( numParallelProcesses ) ] # Add list of nodes as argument to the parallel tool if it is available if nodeListPath is not None : cmd += [ '--sshloginfile' , nodeListPath ] # Append any additional arguments to parallel cmd += parallelArgs # Append the actual command we want to call to the GNU Parallel call cmd += [ commandString ] if verbose : # Echo the command line call we are about to make print ( " " . join ( cmd ) ) returnCode = subprocess . call ( cmd ) return returnCode