Bug 4381

Summary: Job identifiers clarification
Product: jbatch Reporter: geofjamg
Component: sourceAssignee: cvignola
Status: CLOSED FIXED    
Severity: normal CC: issues, ScottKurz
Priority: P5    
Version: 1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description geofjamg 2012-11-30 15:03:21 UTC
In 7.2, it is not clear to me if instanceId, executionId and stepExecutionId are expected to be globally unique in the repository or just unique for a particular job.
The job operator interface allows to get a JobInstance with only an instanceId and a JobExecution with only an executionId but to get a StepExecution we need both executionId and stepExecutionId => it means that instanceId and executionId could be unique in the repository but not stepExecutionId. Is there any reason for that?
Comment 1 ScottKurz 2012-11-30 15:18:54 UTC
It would have to be globally unique since there's nothing to scope a method like:
  JobInstance getJobInstance(long instanceId);
to a job.

For what it's worth, the RI is currently using the same id pool for both instanceIDs and executionIDs... which makes the point that there's no requirement for the ids to be sequential "without gaps" (not that we were specifically trying to make that point).

Also wanted to note that this reminds me of Bug 4051... where we recognized the need to add a way to get step execution ID from something like the JobExecution+stepname perhaps.
Comment 2 ScottKurz 2012-11-30 20:36:56 UTC
I think I missed a key detail in the original comment and confused the reply.

Starting over:

We agree that instanceId and (job) executionId must be globally unique, (not just unique within jobs and job instances).   

But must 'stepExecutionId' be globally unique? .. given that its only use as INPUT is:

  StepExecution getStepExecution(long jobExecutionId, long stepExecutionId);

If it is globally unique, then this would suffice:

  StepExecution getStepExecution(long stepExecutionId);


Again, this raises the point from Bug 4051, how does the JobOperator client get the 'stepExecutionId'?  

We should have something like:

  StepExecution getStepExecution(long jobExecutionId, String stepName);

Note that:

  List<StepExecution> getStepExecutions(long jobExecutionId); 

probably wouldn't cut it unless StepExecution were to be defined to have a getName().
Comment 3 cvignola 2012-12-07 00:09:33 UTC
StepExecutionId will be globally unique, just like InstanceId and ExecutionId.  We are reworking getStepExecution to accept only a StepExecutionId.  We are adding a getter to list an execution's stepexecutionIds.