code: public JobSubmissionResult run(PackagedProgram prog, int parallelism)
  			throws ProgramInvocationException, ProgramMissingJobException {
  		Thread.currentThread().setContextClassLoader(prog.getUserCodeClassLoader());
  		if (prog.isUsingProgramEntryPoint()) {
  
  			final JobWithJars jobWithJars = prog.getPlanWithJars();
  
  			return run(jobWithJars, parallelism, prog.getSavepointSettings());
  		}
  		else if (prog.isUsingInteractiveMode()) {
  			log.info("Starting program in interactive mode (detached: {})", isDetached());
  
  			final List<URL> libraries = prog.getAllLibraries();
  
  			ContextEnvironmentFactory factory = new ContextEnvironmentFactory(this, libraries,
  					prog.getClasspaths(), prog.getUserCodeClassLoader(), parallelism, isDetached(),
  					prog.getSavepointSettings());
  			ContextEnvironment.setAsContext(factory);
  
  			try {
  				// invoke main method
  				prog.invokeInteractiveModeForExecution();
  				if (lastJobExecutionResult == null && factory.getLastEnvCreated() == null) {
  					throw new ProgramMissingJobException("The program didn't contain a Flink job.");
  				}
  				if (isDetached()) {
  					// in detached mode, we execute the whole user code to extract the Flink job, afterwards we run it here
  					return ((DetachedEnvironment) factory.getLastEnvCreated()).finalizeExecute();
  				}
  				else {
  					// in blocking mode, we execute all Flink jobs contained in the user code and then return here
  					return this.lastJobExecutionResult;
  				}
  			}
  			finally {
  				ContextEnvironment.unsetContext();
  			}
  		}
  		else {
  			throw new ProgramInvocationException("PackagedProgram does not have a valid invocation mode.");
  		}
  	}
docs: General purpose method to run a user jar from the CliFrontend in either blocking or detached mode, depending
  on whether {@code setDetached(true)} or {@code setDetached(false)}.
  @param prog the packaged program
  @param parallelism the parallelism to execute the contained Flink job
  @return The result of the execution
  @throws ProgramMissingJobException
  @throws ProgramInvocationException