Source:
<code>public void execute(Job job, String token) throws Exception { Runnable runnable = () -> { try { ExecutorConfig executorConfig = ExecutorConfig.getExecutorConfig(job); logger.info("Ready to run {}", job.getCommandLine()); <START> Command com = new Command(job.getCommandLine() + " --session-id " + token); <END> DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(executorConfig.getStdout())); com.setOutputOutputStream(dataOutputStream); dataOutputStream = new DataOutputStream(new FileOutputStream(executorConfig.getStderr())); com.setErrorOutputStream(dataOutputStream); final long jobId = job.getUid(); Thread hook = new Thread(() -> { logger.info("Running ShutdownHook. Job {id: " + jobId + "} has being aborted."); com.setStatus(RunnableProcess.Status.KILLED); com.setExitValue(-2); closeOutputStreams(com); }); logger.info("=========================================="); logger.info("Executing job {}({})", job.getName(), job.getUid()); logger.debug("Executing commandLine {}", job.getCommandLine()); logger.info("=========================================="); System.err.println(); Runtime.getRuntime().addShutdownHook(hook); com.run(); Runtime.getRuntime().removeShutdownHook(hook); System.err.println(); logger.info("=========================================="); logger.info("Finished job {}({})", job.getName(), job.getUid()); logger.info("=========================================="); closeOutputStreams(com); } catch (FileNotFoundException e) { logger.error("Could not create the output/error files", e); } }; Thread thread = new Thread(runnable, "LocalExecutor-" + nextThreadNum()); thread.start(); }</code><technical_language>method "getCommandLine" in BatchExecutor interface, default a static method. Or, least, create a constant for "--session-id". This change in future</technical_language>

Target:
public void execute(Job job, String token) throws Exception { Runnable runnable = () -> { try { ExecutorConfig executorConfig = ExecutorConfig.getExecutorConfig(job); logger.info("Ready to run {}", job.getCommandLine()); Command com = new Command(getCommandLine(job, token)); DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(executorConfig.getStdout())); com.setOutputOutputStream(dataOutputStream); dataOutputStream = new DataOutputStream(new FileOutputStream(executorConfig.getStderr())); com.setErrorOutputStream(dataOutputStream); final long jobId = job.getUid(); Thread hook = new Thread(() -> { logger.info("Running ShutdownHook. Job {id: " + jobId + "} has being aborted."); com.setStatus(RunnableProcess.Status.KILLED); com.setExitValue(-2); closeOutputStreams(com); }); logger.info("=========================================="); logger.info("Executing job {}({})", job.getName(), job.getUid()); logger.debug("Executing commandLine {}", job.getCommandLine()); logger.info("=========================================="); System.err.println(); Runtime.getRuntime().addShutdownHook(hook); com.run(); Runtime.getRuntime().removeShutdownHook(hook); System.err.println(); logger.info("=========================================="); logger.info("Finished job {}({})", job.getName(), job.getUid()); logger.info("=========================================="); closeOutputStreams(com); } catch (FileNotFoundException e) { logger.error("Could not create the output/error files", e); } }; Thread thread = new Thread(runnable, "LocalExecutor-" + nextThreadNum()); thread.start(); }