def submitToQueue(self, programName=None):
        """Submits to sge queueing system using qsub""" 
        if self.queue_type == "sge":
            strprocs = str(self.procs)
            strmem = "%s=%sG" % (self.mem_request_variable,float(self.mem))
            jobname = ""
            if programName is not None:
                executablePath = os.path.abspath(programName)
                jobname = os.path.basename(executablePath) + "-" 
            now = datetime.now().strftime("%Y-%m-%d-at-%H-%M-%S-%f")
            ident = "pipeline-executor-" + now
            jobname += ident
            queue_opts = ['-V', '-j', 'yes',
                          '-N', jobname,
                          '-l', strmem,
                          '-o', os.path.join(os.getcwd(),
                                             ident + '-eo.log')] \
                          + (['-q', self.queue_name]
                             if self.queue_name else []) \
                          + (['-pe', self.pe, strprocs]
                             if self.pe else []) \
                          + shlex.split(self.queue_opts)
            qsub_cmd = ['qsub'] + queue_opts
            cmd  = ["pipeline_executor.py", "--local"]
            cmd += ['--uri-file', self.uri_file]
            # Only one exec is launched at a time in this manner, so:
            cmd += ["--num-executors", str(1)]
            # pass most args to the executor
            cmd += q.remove_flags(['--num-exec', '--mem'], sys.argv[1:])
            cmd += ['--mem', str(self.mem)]
            script = "#!/usr/bin/env bash\n%s\n" % ' '.join(cmd)
            # FIXME huge hack -- shouldn't we just iterate over options,
            # possibly checking for membership in the executor option group?
            # The problem is that we can't easily check if an option is
            # available from a parser (but what about calling get_defaults and
            # looking at exceptions?).  However, one possibility is to
            # create a list of tuples consisting of the data with which to 
            # call parser.add_arguments and use this to check.
            # NOTE there's a problem with argparse's prefix matching which
            # also affects removal of --num-executors
            env = os.environ.copy()
            env['PYRO_LOGFILE'] = os.path.join(os.getcwd(), ident + ".log")
            p = subprocess.Popen(qsub_cmd, stdin=subprocess.PIPE, shell=False, env=env)
            p.communicate(script)
        else:
            logger.info("Specified queueing system is: %s" % (self.queue_type))
            logger.info("Only queue_type=sge or queue_type=None currently supports pipeline launching own executors.")
            logger.info("Exiting...")
            sys.exit()
dataset/ETHPy150Open Mouse-Imaging-Centre/pydpiper/pydpiper/pipeline_executor.py/pipelineExecutor.submitToQueue/original