def submit(self, job_id, directory, script=None):
if job_id is None:<EOL><INDENT>job_id = '<STR_LIT>' % (Path(directory).unicodename,<EOL>self.destination['<STR_LIT:username>'],<EOL>make_unique_name())<EOL><DEDENT>else:<EOL><INDENT>check_jobid(job_id)<EOL><DEDENT>queue = self._get_queue()<EOL>if queue is None:<EOL><INDENT>queue = self._setup()<EOL><DEDENT>if script is None:<EOL><INDENT>script = '<STR_LIT>'<EOL><DEDENT>ret, target = self._call('<STR_LIT>' % (<EOL>shell_escape(queue / '<STR_LIT>'),<EOL>job_id),<EOL>True)<EOL>if ret == <NUM_LIT:4>:<EOL><INDENT>raise JobAlreadyExists<EOL><DEDENT>elif ret != <NUM_LIT:0>:<EOL><INDENT>raise JobNotFound("<STR_LIT>")<EOL><DEDENT>target = PosixPath(target)<EOL>logger.debug("<STR_LIT>", target)<EOL>try:<EOL><INDENT>scp_client = self.get_scp_client()<EOL>scp_client.put(str(Path(directory)),<EOL>str(target),<EOL>recursive=True)<EOL><DEDENT>except BaseException as e:<EOL><INDENT>try:<EOL><INDENT>self.delete(job_id)<EOL><DEDENT>except BaseException:<EOL><INDENT>raise e<EOL><DEDENT>raise<EOL><DEDENT>logger.debug("<STR_LIT>")<EOL>self.check_call('<STR_LIT>' % (<EOL>shell_escape(queue / '<STR_LIT>'),<EOL>job_id, shell_escape(target),<EOL>shell_escape(script)))<EOL>logger.info("<STR_LIT>", job_id)<EOL>return job_id<EOL>
Submits a job to the queue.

        If the runtime is not there, it will be installed. If it is a broken
        chain of links, error.