String jobExecutionId = Long.toString(Id.Job.parse(jobId).getSequence());
public GobblinHelixTask(TaskCallbackContext taskCallbackContext, Optional<ContainerMetrics> containerMetrics, TaskExecutor taskExecutor, TaskStateTracker taskStateTracker, FileSystem fs, Path appWorkDir, StateStores stateStores) throws IOException { this.taskExecutor = taskExecutor; this.taskStateTracker = taskStateTracker; this.taskConfig = taskCallbackContext.getTaskConfig(); this.jobName = this.taskConfig.getConfigMap().get(ConfigurationKeys.JOB_NAME_KEY); this.jobId = this.taskConfig.getConfigMap().get(ConfigurationKeys.JOB_ID_KEY); this.jobKey = Long.toString(Id.parse(this.jobId).getSequence()); this.participantId = taskCallbackContext.getManager().getInstanceName(); this.fs = fs; this.stateStores = stateStores; Path jobStateFilePath = new Path(appWorkDir, this.jobId + "." + AbstractJobLauncher.JOB_STATE_FILE_NAME); SerializationUtils.deserializeState(this.fs, jobStateFilePath, this.jobState); if (containerMetrics.isPresent()) { // This must be done after the jobState is deserialized from the jobStateFilePath // A reference to jobMetrics is required to ensure it is not evicted from the GobblinMetricsRegistry Cache this.jobMetrics = Optional.of(JobMetrics.get(this.jobState, containerMetrics.get().getMetricContext())); } else { this.jobMetrics = Optional.absent(); } }
@Override protected void forWorkUnit(WorkUnit workUnit) { workUnit.setProp(ConfigurationKeys.JOB_ID_KEY, this.jobId); String taskId = JobLauncherUtils.newTaskId(this.jobId, this.taskIdSequence++); workUnit.setId(taskId); workUnit.setProp(ConfigurationKeys.TASK_ID_KEY, taskId); workUnit.setProp(ConfigurationKeys.TASK_KEY_KEY, Long.toString(Id.Task.parse(taskId).getSequence())); } }
this.jobId = jobProps.containsKey(ConfigurationKeys.JOB_ID_KEY) ? jobProps.getProperty(ConfigurationKeys.JOB_ID_KEY) : JobLauncherUtils.newJobId(this.jobName); this.jobSequence = Long.toString(Id.Job.parse(this.jobId).getSequence()); jobProps.setProperty(ConfigurationKeys.JOB_ID_KEY, this.jobId);