@Override protected void launchWorkerProcess(List<String> command, Map<String, String> env, String logPrefix, ExitCodeCallback processExitCallback, File targetDir) throws IOException { String workerDir = targetDir.getAbsolutePath(); String user = this.getWorkerUser(); List<String> args = Arrays.asList("worker", workerDir, ServerUtils.writeScript(workerDir, command, env)); List<String> commandPrefix = null; if (_resourceIsolationManager != null) { commandPrefix = _resourceIsolationManager.getLaunchCommandPrefix(_workerId); } ClientSupervisorUtils.processLauncher(_conf, user, commandPrefix, args, null, logPrefix, processExitCallback, targetDir); }
@Override protected boolean runProfilingCommand(List<String> command, Map<String, String> env, String logPrefix, File targetDir) throws IOException, InterruptedException { String user = this.getWorkerUser(); String td = targetDir.getAbsolutePath(); LOG.info("Running as user: {} command: {}", user, command); String containerFile = ServerUtils.containerFilePath(td); if (Utils.checkFileExists(containerFile)) { SupervisorUtils.rmrAsUser(_conf, containerFile, containerFile); } String scriptFile = ServerUtils.scriptFilePath(td); if (Utils.checkFileExists(scriptFile)) { SupervisorUtils.rmrAsUser(_conf, scriptFile, scriptFile); } String script = ServerUtils.writeScript(td, command, env); List<String> args = Arrays.asList("profiler", td, script); int ret = ClientSupervisorUtils.processLauncherAndWait(_conf, user, args, env, logPrefix); return ret == 0; }