Skip to content

Commit

Permalink
Add run_count in job props
Browse files Browse the repository at this point in the history
  • Loading branch information
sandynz committed Sep 20, 2023
1 parent a9280d0 commit 787d1e9
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ protected JobConfigurationPOJO convertJobConfiguration(final PipelineJobConfigur
String createTimeFormat = LocalDateTime.now().format(DATE_TIME_FORMATTER);
result.getProps().setProperty("create_time", createTimeFormat);
result.getProps().setProperty("start_time_millis", String.valueOf(System.currentTimeMillis()));
result.getProps().setProperty("run_count", "1");
result.setJobListenerTypes(Collections.singletonList(PipelineElasticJobListener.class.getName()));
return result;
}
Expand All @@ -125,6 +126,7 @@ public void startDisabledJob(final String jobId) {
jobConfigPOJO.getProps().setProperty("start_time_millis", String.valueOf(System.currentTimeMillis()));
jobConfigPOJO.getProps().remove("stop_time");
jobConfigPOJO.getProps().remove("stop_time_millis");
jobConfigPOJO.getProps().setProperty("run_count", String.valueOf(Integer.parseInt(jobConfigPOJO.getProps().getProperty("run_count", "0")) + 1));
String barrierEnablePath = PipelineMetaDataNode.getJobBarrierEnablePath(jobId);
pipelineDistributedBarrier.register(barrierEnablePath, jobConfigPOJO.getShardingTotalCount());
PipelineAPIFactory.getJobConfigurationAPI(PipelineJobIdUtils.parseContextKey(jobId)).updateJobConfiguration(jobConfigPOJO);
Expand Down Expand Up @@ -154,7 +156,13 @@ protected void dropJob(final String jobId) {
PipelineAPIFactory.getGovernanceRepositoryAPI(contextKey).deleteJob(jobId);
}

protected final JobConfigurationPOJO getElasticJobConfigPOJO(final String jobId) {
/**
* Get ElasticJob configuration POJO.
*
* @param jobId job id
* @return ElasticJob configuration POJO
*/
public final JobConfigurationPOJO getElasticJobConfigPOJO(final String jobId) {
JobConfigurationPOJO result = PipelineAPIFactory.getJobConfigurationAPI(PipelineJobIdUtils.parseContextKey(jobId)).getJobConfiguration(jobId);
ShardingSpherePreconditions.checkNotNull(result, () -> new PipelineJobNotFoundException(jobId));
return result;
Expand Down

0 comments on commit 787d1e9

Please sign in to comment.