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-268] Generate unique job name and job uri for GaaS #2121

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ private JobSpec buildJobSpec (ServiceNode sourceNode, ServiceNode targetNode, UR
// Add job.name and job.group
if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_NAME_KEY)) {
jobSpec.setConfig(jobSpec.getConfig()
.withValue(ConfigurationKeys.JOB_NAME_KEY, flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_NAME_KEY)));
.withValue(ConfigurationKeys.JOB_NAME_KEY, ConfigValueFactory.fromAnyRef(
flowSpec.getConfig().getValue(ConfigurationKeys.FLOW_NAME_KEY).unwrapped().toString()
+ "-" + sourceNode.getNodeName()
+ "-" + targetNode.getNodeName())));
}
if (flowSpec.getConfig().hasPath(ConfigurationKeys.FLOW_GROUP_KEY)) {
jobSpec.setConfig(jobSpec.getConfig()
Expand Down Expand Up @@ -329,8 +332,9 @@ private URI getTemplateURI (ServiceNode sourceNode, ServiceNode targetNode, Flow
*/
public static URI jobSpecURIGenerator(FlowSpec flowSpec, ServiceNode sourceNode, ServiceNode targetNode) {
try {
return new URI(flowSpec.getUri().getScheme(), flowSpec.getUri().getAuthority(),
"/" + sourceNode.getNodeName() + "-" + targetNode.getNodeName(), null);
return new URI(JobSpec.Builder.DEFAULT_JOB_CATALOG_SCHEME, flowSpec.getUri().getAuthority(),
StringUtils.appendIfMissing(StringUtils.prependIfMissing(flowSpec.getUri().getPath(), "/"),"/")
+ sourceNode.getNodeName() + "-" + targetNode.getNodeName(), null);
} catch (URISyntaxException e) {
log.error(
"URI construction failed when jobSpec from " + sourceNode.getNodeName() + " to " + targetNode.getNodeName());
Expand Down