Skip to content
This repository
Browse code

Closes OOZIE-9 (Apache) Launcher job should be able to run in differe…

…nt queue than job itself
  • Loading branch information...
commit 2670d1e945af42c2d3afa1f1436d5b5437aad886 1 parent 66d6fec
Alejandro Abdelnur authored August 17, 2011 Mohammad Kamrul Islam committed August 22, 2011
10  core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
@@ -378,10 +378,13 @@ protected String getLauncherMain(Configuration launcherConf, Element actionXml)
378 378
         return e.getTextTrim();
379 379
     }
380 380
 
  381
+    private static final String QUEUE_NAME = "mapred.job.queue.name";
  382
+    private static final String OOZIE_LAUNCHER_QUEUE_NAME = "oozie.launcher.mapred.job.queue.name";
  383
+
381 384
     private static final Set<String> SPECIAL_PROPERTIES = new HashSet<String>();
382 385
 
383 386
     static {
384  
-        SPECIAL_PROPERTIES.add("mapred.job.queue.name");
  387
+        SPECIAL_PROPERTIES.add(QUEUE_NAME);
385 388
         SPECIAL_PROPERTIES.add("mapreduce.jobtracker.kerberos.principal");
386 389
         SPECIAL_PROPERTIES.add("dfs.namenode.kerberos.principal");
387 390
     }
@@ -444,7 +447,10 @@ JobConf createLauncherConf(FileSystem actionFs, Context context, WorkflowAction
444 447
             for (String name : SPECIAL_PROPERTIES) {
445 448
                 String value = actionConf.get(name);
446 449
                 if (value != null) {
447  
-                    launcherJobConf.set(name, value);
  450
+                    if (!name.equals(QUEUE_NAME) ||
  451
+                        (name.equals(QUEUE_NAME) && launcherJobConf.get(OOZIE_LAUNCHER_QUEUE_NAME) == null)) {
  452
+                        launcherJobConf.set(name, value);
  453
+                    }
448 454
                 }
449 455
             }
450 456
 
34  core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
@@ -248,6 +248,40 @@ public void testSetupMethods() throws Exception {
248 248
 
249 249
         assertTrue(getFileSystem().exists(new Path(context.getActionDir(), LauncherMapper.ACTION_CONF_XML)));
250 250
 
  251
+        actionXml = XmlUtils.parseXml("<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
  252
+                "<name-node>" + getNameNodeUri() + "</name-node> <configuration>" +
  253
+                "<property><name>mapred.job.queue.name</name><value>AQ</value></property>" +
  254
+                "</configuration>" + "<main-class>MAIN-CLASS</main-class>" +
  255
+                "</java>");
  256
+        actionConf = ae.createBaseHadoopConf(context, actionXml);
  257
+        ae.setupActionConf(actionConf, context, actionXml, appPath);
  258
+        conf = ae.createLauncherConf(getFileSystem(), context, action, actionXml, actionConf);
  259
+        assertEquals("AQ", conf.get("mapred.job.queue.name"));
  260
+        assertEquals("AQ", actionConf.get("mapred.job.queue.name"));
  261
+
  262
+        actionXml = XmlUtils.parseXml("<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
  263
+                "<name-node>" + getNameNodeUri() + "</name-node> <configuration>" +
  264
+                "<property><name>oozie.launcher.mapred.job.queue.name</name><value>LQ</value></property>" +
  265
+                "</configuration>" + "<main-class>MAIN-CLASS</main-class>" +
  266
+                "</java>");
  267
+        actionConf = ae.createBaseHadoopConf(context, actionXml);
  268
+        ae.setupActionConf(actionConf, context, actionXml, appPath);
  269
+        conf = ae.createLauncherConf(getFileSystem(), context, action, actionXml, actionConf);
  270
+        assertEquals("LQ", conf.get("mapred.job.queue.name"));
  271
+
  272
+        actionXml = XmlUtils.parseXml("<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" +
  273
+                "<name-node>" + getNameNodeUri() + "</name-node> <configuration>" +
  274
+                "<property><name>oozie.launcher.mapred.job.queue.name</name><value>LQ</value></property>" +
  275
+                "<property><name>mapred.job.queue.name</name><value>AQ</value></property>" +
  276
+                "</configuration>" + "<main-class>MAIN-CLASS</main-class>" +
  277
+                "</java>");
  278
+        actionConf = ae.createBaseHadoopConf(context, actionXml);
  279
+        ae.setupActionConf(actionConf, context, actionXml, appPath);
  280
+        conf = ae.createLauncherConf(getFileSystem(), context, action, actionXml, actionConf);
  281
+        assertEquals("LQ", conf.get("mapred.job.queue.name"));
  282
+        assertEquals("AQ", actionConf.get("mapred.job.queue.name"));
  283
+
  284
+
251 285
     }
252 286
 
253 287
     protected Context createContext(String actionXml) throws Exception {
1  release-log.txt
... ...
@@ -1,5 +1,6 @@
1 1
 -- Oozie 3.1.0 release
2 2
 
  3
+OOZIE-9 (Apache) Launcher job should be able to run in different queue than job itself
3 4
 OOZIE-20 add sql scripts for oozie 3.1.0
4 5
 OOZIE-135 support multiple shared lib path in oozie
5 6
 OOZIE-18 Option to view Workflow job details from Coordinator job detail popup

0 notes on commit 2670d1e

Please sign in to comment.
Something went wrong with that request. Please try again.