Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GOBBLIN-1821] Let flow execution ID propagate to the Job ID if it exists #3684

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.apache.gobblin.runtime.listeners.JobListener;
import org.apache.gobblin.util.Id;
import org.apache.gobblin.util.JobLauncherUtils;
import org.apache.gobblin.util.PropertiesUtils;

import static org.apache.helix.task.TaskState.STOPPED;

Expand Down Expand Up @@ -159,7 +160,8 @@ public static List<? extends Tag<?>> initBaseEventTags(Properties jobProps,
if (jobProps.containsKey(ConfigurationKeys.JOB_ID_KEY)) {
jobId = jobProps.getProperty(ConfigurationKeys.JOB_ID_KEY);
} else {
jobId = JobLauncherUtils.newJobId(JobState.getJobNameFromProps(jobProps));
jobId = JobLauncherUtils.newJobId(JobState.getJobNameFromProps(jobProps),
PropertiesUtils.getPropAsLong(jobProps, ConfigurationKeys.FLOW_EXECUTION_ID_KEY, System.currentTimeMillis()));
jobProps.put(ConfigurationKeys.JOB_ID_KEY, jobId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ public static String newJobId(String jobName) {
return Id.Job.create(jobName, System.currentTimeMillis()).toString();
}

/**
* Create a new job ID from a flow execution ID.
*
* @param jobName job name
* @return new job ID
*/
public static String newJobId(String jobName, long executionId) {
return Id.Job.create(jobName, executionId).toString();
}

/**
* Create a new task ID for the job with the given job ID.
*
Expand Down