YARN-8076. Support to specify application tags in distributed shell. Contributed by Weiwei Yang.
(cherry picked from commit 431076f63751f855ab6036ff85825a8552257b93) (cherry picked from commit 04161bad789fc4d970b9f537803806d4ba02a791)
This commit is contained in:
parent
c1d3c2a227
commit
a891f812da
@ -230,6 +230,9 @@ public class Client {
|
||||
// Docker client configuration
|
||||
private String dockerClientConfig = null;
|
||||
|
||||
// Application tags
|
||||
private Set<String> applicationTags = new HashSet<>();
|
||||
|
||||
// Command line options
|
||||
private Options opts;
|
||||
|
||||
@ -384,6 +387,7 @@ public Client(Configuration conf) throws Exception {
|
||||
"Placement specification. Please note, if this option is specified,"
|
||||
+ " The \"num_containers\" option will be ignored. All requested"
|
||||
+ " 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")) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -729,6 +741,9 @@ public boolean run() throws IOException, YarnException {
|
||||
}
|
||||
|
||||
Set<String> tags = new HashSet<String>();
|
||||
if (applicationTags != null) {
|
||||
tags.addAll(applicationTags);
|
||||
}
|
||||
if (flowName != null) {
|
||||
tags.add(TimelineUtils.generateFlowNameTag(flowName));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user