YARN-8076. Support to specify application tags in distributed shell. Contributed by Weiwei Yang.

This commit is contained in:
Sunil G 2018-03-29 15:55:39 +05:30
parent 3d185d62fc
commit 431076f637
1 changed files with 15 additions and 0 deletions

View File

@ -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 class Client {
"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 class Client {
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 class Client {
} }
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));
} }