Source:
<code>public static void main(String[] args) throws Exception { Thread.setDefaultUncaughtExceptionHandler( new SamzaUncaughtExceptionHandler(() -> { log.info("Exiting process now."); System.exit(1); })); String containerId = System.getenv(ShellCommandConfig.ENV_CONTAINER_ID()); log.info(String.format("Got container ID: %s", containerId)); System.out.println(String.format("Container ID: %s", containerId)); String coordinatorUrl = System.getenv(ShellCommandConfig.ENV_COORDINATOR_URL()); log.info(String.format("Got coordinator URL: %s", coordinatorUrl)); System.out.println(String.format("Coordinator URL: %s", coordinatorUrl)); Optional<String> execEnvContainerId = Optional.ofNullable(System.getenv(ShellCommandConfig.ENV_EXECUTION_ENV_CONTAINER_ID())); int delay = new Random().nextInt(SamzaContainer.DEFAULT_READ_JOBMODEL_DELAY_MS()) + 1; JobModel jobModel = SamzaContainer.readJobModel(coordinatorUrl, delay); Config config = jobModel.getConfig(); JobConfig jobConfig = new JobConfig(config); <START> String jobName = jobConfig.getName().orElseThrow(() -> new SamzaException("can not find the job name")); <END> String jobId = jobConfig.getJobId(); MDC.put("containerName", "samza-container-" + containerId); MDC.put("jobName", jobName); MDC.put("jobId", jobId); DiagnosticsUtil.writeMetadataFile(jobName, jobId, containerId, execEnvContainerId, config); ApplicationDescriptorImpl<? extends ApplicationDescriptor> appDesc = ApplicationDescriptorUtil.getAppDescriptor(ApplicationUtil.fromConfig(config), config); ContainerLaunchUtil.run(appDesc, jobName, jobId, containerId, execEnvContainerId, jobModel); }</code><technical_language>"Config job.name is missing"</technical_language>

Target:
public static void main(String[] args) throws Exception { Thread.setDefaultUncaughtExceptionHandler( new SamzaUncaughtExceptionHandler(() -> { log.info("Exiting process now."); System.exit(1); })); String containerId = System.getenv(ShellCommandConfig.ENV_CONTAINER_ID()); log.info(String.format("Got container ID: %s", containerId)); System.out.println(String.format("Container ID: %s", containerId)); String coordinatorUrl = System.getenv(ShellCommandConfig.ENV_COORDINATOR_URL()); log.info(String.format("Got coordinator URL: %s", coordinatorUrl)); System.out.println(String.format("Coordinator URL: %s", coordinatorUrl)); Optional<String> execEnvContainerId = Optional.ofNullable(System.getenv(ShellCommandConfig.ENV_EXECUTION_ENV_CONTAINER_ID())); int delay = new Random().nextInt(SamzaContainer.DEFAULT_READ_JOBMODEL_DELAY_MS()) + 1; JobModel jobModel = SamzaContainer.readJobModel(coordinatorUrl, delay); Config config = jobModel.getConfig(); JobConfig jobConfig = new JobConfig(config); String jobName = jobConfig.getName() .orElseThrow(() -> new SamzaException(String.format("Config %s is missing", JobConfig.JOB_NAME))); String jobId = jobConfig.getJobId(); MDC.put("containerName", "samza-container-" + containerId); MDC.put("jobName", jobName); MDC.put("jobId", jobId); DiagnosticsUtil.writeMetadataFile(jobName, jobId, containerId, execEnvContainerId, config); ApplicationDescriptorImpl<? extends ApplicationDescriptor> appDesc = ApplicationDescriptorUtil.getAppDescriptor(ApplicationUtil.fromConfig(config), config); ContainerLaunchUtil.run(appDesc, jobName, jobId, containerId, execEnvContainerId, jobModel); }