YARN-8076. Support to specify application tags in distributed shell. Contributed by Weiwei Yang.
This commit is contained in:
parent
3d185d62fc
commit
431076f637
@ -230,6 +230,9 @@ public class Client {
|
|||||||
// Docker client configuration
|
// Docker client configuration
|
||||||
private String dockerClientConfig = null;
|
private String dockerClientConfig = null;
|
||||||
|
|
||||||
|
// Application tags
|
||||||
|
private Set<String> applicationTags = new HashSet<>();
|
||||||
|
|
||||||
// Command line options
|
// Command line options
|
||||||
private Options opts;
|
private Options opts;
|
||||||
|
|
||||||
@ -384,6 +387,7 @@ public Client(Configuration conf) throws Exception {
|
|||||||
"Placement specification. Please note, if this option is specified,"
|
"Placement specification. Please note, if this option is specified,"
|
||||||
+ " The \"num_containers\" option will be ignored. All requested"
|
+ " The \"num_containers\" option will be ignored. All requested"
|
||||||
+ " containers will be of type GUARANTEED" );
|
+ " containers will be of type GUARANTEED" );
|
||||||
|
opts.addOption("application_tags", true, "Application tags.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -604,6 +608,14 @@ public boolean init(String[] args) throws ParseException {
|
|||||||
if (cliParser.hasOption("docker_client_config")) {
|
if (cliParser.hasOption("docker_client_config")) {
|
||||||
dockerClientConfig = cliParser.getOptionValue("docker_client_config");
|
dockerClientConfig = cliParser.getOptionValue("docker_client_config");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cliParser.hasOption("application_tags")) {
|
||||||
|
String applicationTagsStr = cliParser.getOptionValue("application_tags");
|
||||||
|
String[] appTags = applicationTagsStr.split(",");
|
||||||
|
for (String appTag : appTags) {
|
||||||
|
this.applicationTags.add(appTag.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,6 +741,9 @@ public boolean run() throws IOException, YarnException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Set<String> tags = new HashSet<String>();
|
Set<String> tags = new HashSet<String>();
|
||||||
|
if (applicationTags != null) {
|
||||||
|
tags.addAll(applicationTags);
|
||||||
|
}
|
||||||
if (flowName != null) {
|
if (flowName != null) {
|
||||||
tags.add(TimelineUtils.generateFlowNameTag(flowName));
|
tags.add(TimelineUtils.generateFlowNameTag(flowName));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user