|
21 | 21 | import java.io.IOException;
|
22 | 22 | import java.net.URI;
|
23 | 23 | import java.nio.ByteBuffer;
|
| 24 | +import java.util.Arrays; |
24 | 25 | import java.util.EnumSet;
|
25 | 26 | import java.util.HashMap;
|
26 | 27 | import java.util.HashSet;
|
@@ -173,6 +174,10 @@ public class GobblinYarnAppLauncher {
|
173 | 174 |
|
174 | 175 | private static final String GOBBLIN_YARN_APPLICATION_TYPE = "GOBBLIN_YARN";
|
175 | 176 |
|
| 177 | + // The application tags are set by HadoopJavaJob on mapreduce key even though it is not a mapreduce job |
| 178 | + // Reference: https://github.com/azkaban/azkaban/blob/6db750049f6fdf7842e18b8d533a3b736429bdf4/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/AbstractHadoopJavaProcessJob.java#L96 |
| 179 | + private static final String APPLICATION_TAGS_KEY = "hadoop-inject.mapreduce.job.tags"; |
| 180 | + |
176 | 181 | // The set of Yarn application types this class is interested in. This is used to
|
177 | 182 | // lookup the application this class has launched previously upon restarting.
|
178 | 183 | private static final Set<String> APPLICATION_TYPES = ImmutableSet.of(GOBBLIN_YARN_APPLICATION_TYPE);
|
@@ -575,6 +580,11 @@ ApplicationId setupAndSubmitApplication() throws IOException, YarnException, Int
|
575 | 580 | LOGGER.info("creating new yarn application");
|
576 | 581 | YarnClientApplication gobblinYarnApp = this.yarnClient.createApplication();
|
577 | 582 | ApplicationSubmissionContext appSubmissionContext = gobblinYarnApp.getApplicationSubmissionContext();
|
| 583 | + if (config.hasPath(APPLICATION_TAGS_KEY)) { |
| 584 | + String tags = config.getString(APPLICATION_TAGS_KEY); |
| 585 | + Set<String> tagSet = new HashSet<>(Arrays.asList(tags.split(","))); |
| 586 | + appSubmissionContext.setApplicationTags(tagSet); |
| 587 | + } |
578 | 588 | appSubmissionContext.setApplicationType(GOBBLIN_YARN_APPLICATION_TYPE);
|
579 | 589 | appSubmissionContext.setMaxAppAttempts(ConfigUtils.getInt(config, GobblinYarnConfigurationKeys.APP_MASTER_MAX_ATTEMPTS_KEY, GobblinYarnConfigurationKeys.DEFAULT_APP_MASTER_MAX_ATTEMPTS_KEY));
|
580 | 590 | ApplicationId applicationId = appSubmissionContext.getApplicationId();
|
|
0 commit comments