class_docstr: Execute using LSF Cluster Submission
  
  The plugin_args input to run can be used to control the LSF execution.
  Currently supported options are:
  
  - template : template to use for batch job submission
  - bsub_args : arguments to be prepended to the job execution script in the
                bsub call
code: def _submit_batchtask(self, scriptfile, node):
      cmd = CommandLine(
          "bsub",
          environ=dict(os.environ),
          resource_monitor=False,
          terminal_output="allatonce",
      )
      bsubargs = ""
      if self._bsub_args:
          bsubargs = self._bsub_args
      if "bsub_args" in node.plugin_args:
          if (
              "overwrite" in node.plugin_args
              and node.plugin_args["overwrite"]
          ):
              bsubargs = node.plugin_args["bsub_args"]
          else:
              bsubargs += " " + node.plugin_args["bsub_args"]
      if "-o" not in bsubargs:  # -o outfile
          bsubargs = "{} -o {}".format(bsubargs, scriptfile + ".log")
      if "-e" not in bsubargs:
          # -e error file
          bsubargs = "{} -e {}".format(bsubargs, scriptfile + ".log")
      if node._hierarchy:
          jobname = ".".join(
              (dict(os.environ)["LOGNAME"], node._hierarchy, node._id)
          )
      else:
          jobname = ".".join((dict(os.environ)["LOGNAME"], node._id))
      jobnameitems = jobname.split(".")
      jobnameitems.reverse()
      jobname = ".".join(jobnameitems)
      cmd.inputs.args = "{} -J {} sh {}".format(
          bsubargs,
          jobname,
          scriptfile,
      )  # -J job_name_spec
      logger.debug("bsub " + cmd.inputs.args)
      oldlevel = iflogger.level
      iflogger.setLevel(logging.getLevelName("CRITICAL"))
      tries = 0
      while True:
          try:
              result = cmd.run()
          except Exception as e:
              if tries < self._max_tries:
                  tries += 1
                  sleep(
                      self._retry_timeout
                  )  # sleep 2 seconds and try again.
              else:
                  iflogger.setLevel(oldlevel)
                  raise RuntimeError(
                      "\n".join(
                          (
                              "Could not submit lsf task for node %s"
                              % node._id,
                              str(e),
                          )
                      )
                  )
          else:
              break
      iflogger.setLevel(oldlevel)
      # retrieve lsf taskid
      match = re.search(r"<(\d*)>", result.runtime.stdout)
      if match:
          taskid = int(match.groups()[0])
      else:
          raise OSError(
              "Can't parse submission job output id: %s"
              % result.runtime.stdout
          )
      self._pending[taskid] = node.output_dir()
      logger.debug(
          "submitted lsf task: %d for node %s" % (taskid, node._id)
      )
      return taskid
  
file_path: nipype/nipype/pipeline/plugins/lsf.py
imports: import os
  import re
  from time import sleep
  from ...None import logging
  from ...interfaces.base import CommandLine
  from .base import SGELikeBatchManagerBase, logger
label_desc: Use image node_id 3 for calling the LSFPlugin obj's underlying member method code with example usage: obj._submit_batchtask(scriptfile, node) and returns: taskid