original_docstring: Constructs header and commands for pbs script, based on options input from calling program
docstring: Constructs header and commands for pbs script, based on options input from calling program
docstring_tokens: Constructs header and commands for pbs script based on options input from calling program
code: def addHeaderAndCommands(self, time, isMainFile):
          """Constructs header and commands for pbs script, based on options input from calling program"""
          self.jobFile.write("#!/bin/bash\n")
          requestNodes = 1
          name = self.jobName
          launchExecs = not isMainFile
          if isMainFile:
              # Number of nodes used depends on:
              # 1) number of available processors per node
              # 2) number of processes per executor
              nodes = divmod(self.procs, self.ppn)
              if self.numexec == 0:
                  name += "-no-executors"
              elif self.numexec == 1:
                  name += "-all"
                  halfPpn = self.ppn/2
                  if nodes[1] <= halfPpn and nodes[0] != 0:
                      requestNodes = nodes[0]
                  else:
                      requestNodes = nodes[0] + 1               
              else:  
                  name += "-plus-exec" 
          else:
              name += "-executor"
          m,s = divmod(time,60)
          h,m = divmod(m,60)
          timestr = "%d:%02d:%02d" % (h,m,s)
          self.jobFile.write("#PBS -l nodes=%d:ppn=%d,walltime=%s\n" % (requestNodes, self.ppn, timestr))
          self.jobFile.write("#PBS -N %s\n" % name)
          self.jobFile.write("#PBS -q %s\n" % self.queue_name)
          if self.prologue_file is not None:
              try:
                  with open(self.prologue_file, 'r') as fh:
                      for l in fh:
                          self.jobFile.write(l)
                  self.jobFile.write('\n')
              except:
                  print("Failed copying prologue script into submit script")
                  raise
          # cd from $HOME into the submission directory:
          self.jobFile.write("cd $PBS_O_WORKDIR\n\n")
          if isMainFile:
              self.jobFile.write(self.buildMainCommand())
              self.jobFile.write(" &\n\n")
          if launchExecs:
              self.jobFile.write("sleep %s\n" %
                                 self.executor_start_delay)
              # provide the pipeline_executor with the uri_file that
              # the server will use
              cmd = "pipeline_executor.py --local --num-executors=1 --uri-file " + self.uri_file + " "
              cmd += ' '.join(remove_flags(['--num-exec'], self.arguments[1:]))
              cmd += ' &\n\n'
              self.jobFile.write(cmd)
code_tokens: def addHeaderAndCommands ( self , time , isMainFile ) : self . jobFile . write ( "#!/bin/bash\n" ) requestNodes = 1 name = self . jobName launchExecs = not isMainFile if isMainFile : nodes = divmod ( self . procs , self . ppn ) if self . numexec == 0 : name += "-no-executors" elif self . numexec == 1 : name += "-all" halfPpn = self . ppn / 2 if nodes [ 1 ] <= halfPpn and nodes [ 0 ] != 0 : requestNodes = nodes [ 0 ] else : requestNodes = nodes [ 0 ] + 1 else : name += "-plus-exec" else : name += "-executor" m , s = divmod ( time , 60 ) h , m = divmod ( m , 60 ) timestr = "%d:%02d:%02d" % ( h , m , s ) self . jobFile . write ( "#PBS -l nodes=%d:ppn=%d,walltime=%s\n" % ( requestNodes , self . ppn , timestr ) ) self . jobFile . write ( "#PBS -N %s\n" % name ) self . jobFile . write ( "#PBS -q %s\n" % self . queue_name ) if self . prologue_file is not None : try : with open ( self . prologue_file , 'r' ) as fh : for l in fh : self . jobFile . write ( l ) self . jobFile . write ( '\n' ) except : print ( "Failed copying prologue script into submit script" ) raise self . jobFile . write ( "cd $PBS_O_WORKDIR\n\n" ) if isMainFile : self . jobFile . write ( self . buildMainCommand ( ) ) self . jobFile . write ( " &\n\n" ) if launchExecs : self . jobFile . write ( "sleep %s\n" % self . executor_start_delay ) cmd = "pipeline_executor.py --local --num-executors=1 --uri-file " + self . uri_file + " " cmd += ' ' . join ( remove_flags ( [ '--num-exec' ] , self . arguments [ 1 : ] ) ) cmd += ' &\n\n' self . jobFile . write ( cmd )
short_docstring: Constructs header and commands for pbs script, based on options input from calling program
short_docstring_tokens: Constructs header and commands for pbs script based on options input from calling program
comment: """Constructs header and commands for pbs script, based on options input from calling program"""$SEP$# Number of nodes used depends on:$SEP$# 1) number of available processors per node$SEP$# 2) number of processes per executor$SEP$# cd from $HOME into the submission directory:$SEP$# provide the pipeline_executor with the uri_file that$SEP$# the server will use