Updated Branches: refs/heads/master 694e2a565 -> a6f0685d4
OOZIE-1626 pig action pop-up is not working properly in UI (puru via rohini) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/a6f0685d Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/a6f0685d Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/a6f0685d Branch: refs/heads/master Commit: a6f0685d43a38c97519fe7bff911f961f7b9e2db Parents: 694e2a5 Author: Rohini Palaniswamy <[email protected]> Authored: Thu Jan 9 09:20:08 2014 -0800 Committer: Rohini Palaniswamy <[email protected]> Committed: Thu Jan 9 09:20:08 2014 -0800 ---------------------------------------------------------------------- release-log.txt | 2 +- .../oozie/action/hadoop/LauncherMain.java | 17 +++--- .../org/apache/oozie/action/hadoop/PigMain.java | 4 ++ .../apache/oozie/action/hadoop/PigTestCase.java | 29 +++++++++- .../apache/oozie/action/hadoop/TestPigMain.java | 15 +++--- webapp/src/main/webapp/oozie-console.js | 56 +++++++++++--------- 6 files changed, 83 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/a6f0685d/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index a831cac..2b2a819 100644 --- a/release-log.txt +++ b/release-log.txt @@ -102,7 +102,7 @@ OOZIE-1440 Build fails in certain environments due to xerces OpenJPA issue (mack OOZIE-1630 <prepare> operations fail when path doesn't have scheme (ryota) OOZIE-1627 Rerun doesn't resolve workflow app name (puru via rohini) -OOZIE-1626 pig action pop-up is not working properly in UI (ryota) +OOZIE-1626 pig action pop-up is not working properly in UI (ryota, puru via rohini) OOZIE-1607 [Doc]Update workflow specification for chgrp command (puru via rohini) OOZIE-1542 When extjs isn't installed, the web UI is unhelpfully blank (rkanter) OOZIE-1565 OOZIE-1481 should only affect v2 of the API, not v1 (rkanter) http://git-wip-us.apache.org/repos/asf/oozie/blob/a6f0685d/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java ---------------------------------------------------------------------- diff --git a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java b/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java index 2864898..2cb690f 100644 --- a/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java +++ b/sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java @@ -28,6 +28,7 @@ import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.hadoop.util.Shell; +import org.apache.commons.lang.StringUtils; public abstract class LauncherMain { @@ -54,6 +55,10 @@ public abstract class LauncherMain { Matcher matcher = pattern.matcher(line); if (matcher.find()) { String jobId = matcher.group(1); + if (StringUtils.isEmpty(jobId) || jobId.equalsIgnoreCase("NULL")) { + continue; + } + sb.append(separator).append(jobId); separator = ","; } @@ -82,7 +87,7 @@ public abstract class LauncherMain { StringWriter writer = new StringWriter(); writer.write(header + "\n"); writer.write("--------------------\n"); - for (Map.Entry entry : (Iterable<Map.Entry>) conf){ + for (Map.Entry entry : (Iterable<Map.Entry>) conf) { String name = (String) entry.getKey(); String value = (String) entry.getValue(); for (String mask : maskSet) { @@ -106,11 +111,11 @@ public abstract class LauncherMain { if (path != null && Shell.WINDOWS) { // In Windows, file paths are enclosed in \" so remove them here // to avoid path errors - if(path.charAt(0)=='"') { + if (path.charAt(0) == '"') { path = path.substring(1); } - if(path.charAt(path.length()-1) == '"') { - path = path.substring(0, path.length()-1); + if (path.charAt(path.length() - 1) == '"') { + path = path.substring(0, path.length() - 1); } } return path; @@ -119,11 +124,11 @@ public abstract class LauncherMain { class LauncherMainException extends Exception { private int errorCode; - + public LauncherMainException(int code) { errorCode = code; } - + int getErrorCode() { return errorCode; } http://git-wip-us.apache.org/repos/asf/oozie/blob/a6f0685d/sharelib/pig/src/main/java/org/apache/oozie/action/hadoop/PigMain.java ---------------------------------------------------------------------- diff --git a/sharelib/pig/src/main/java/org/apache/oozie/action/hadoop/PigMain.java b/sharelib/pig/src/main/java/org/apache/oozie/action/hadoop/PigMain.java index 2814db2..9c1e659 100644 --- a/sharelib/pig/src/main/java/org/apache/oozie/action/hadoop/PigMain.java +++ b/sharelib/pig/src/main/java/org/apache/oozie/action/hadoop/PigMain.java @@ -21,6 +21,7 @@ import org.apache.pig.Main; import org.apache.pig.PigRunner; import org.apache.pig.tools.pigstats.JobStats; import org.apache.pig.tools.pigstats.PigStats; +import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; @@ -371,6 +372,9 @@ public class PigMain extends LauncherMain { PigStats.JobGraph jobGraph = pigStats.getJobGraph(); for (JobStats jobStats : jobGraph) { String hadoopJobId = jobStats.getJobId(); + if (StringUtils.isEmpty(hadoopJobId) || hadoopJobId.trim().equalsIgnoreCase("NULL")) { + continue; + } if (sb.length() > 0) { sb.append(separator); } http://git-wip-us.apache.org/repos/asf/oozie/blob/a6f0685d/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/PigTestCase.java ---------------------------------------------------------------------- diff --git a/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/PigTestCase.java b/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/PigTestCase.java index 9e09395..24237b9 100644 --- a/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/PigTestCase.java +++ b/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/PigTestCase.java @@ -17,7 +17,9 @@ */ package org.apache.oozie.action.hadoop; +import java.io.File; import java.io.FileInputStream; +import java.io.FileReader; import java.io.InputStream; import java.io.OutputStream; import java.util.concurrent.Callable; @@ -36,6 +38,7 @@ import com.google.common.primitives.Booleans; public abstract class PigTestCase extends XFsTestCase implements Callable<Void> { protected static String pigScript; protected static boolean writeStats; + protected static boolean failOnException = true; private static String commonPigScript = "set job.name 'test'\n" + "set debug on\n" + "A = load '$IN' using PigStorage(':');\n" + @@ -47,11 +50,17 @@ public abstract class PigTestCase extends XFsTestCase implements Callable<Void> public void testPigScript() throws Exception { pigScript = commonPigScript; writeStats = true; + failOnException = true; MainTestCase.execute(getTestUser(), this); - } + String hadoopIdsFile = System.getProperty("oozie.action.externalChildIDs"); + assertTrue(new File(hadoopIdsFile).exists()); + String externalChildIds = IOUtils.getReaderAsString(new FileReader(hadoopIdsFile), -1); + assertTrue(externalChildIds.contains("job_")); + } // testing embedded Pig feature of Pig 0.9 public void testEmbeddedPigWithinPython() throws Exception { + failOnException = true; FileSystem fs = getFileSystem(); Path jythonJar = new Path(getFsTestCaseDir(), "jython.jar"); InputStream is = new FileInputStream(ClassUtils.findContainingJar(jython.class)); @@ -86,4 +95,22 @@ public abstract class PigTestCase extends XFsTestCase implements Callable<Void> MainTestCase.execute(getTestUser(), this); } + public void testPig_withNullExternalID() throws Exception { + failOnException = false; + String script = "A = load '$IN' using PigStorage(':');\n" + + "store A into '$IN' USING PigStorage();"; + pigScript = script; + writeStats = true; + try { + MainTestCase.execute(getTestUser(), this); + } + catch (Exception e) { + //Ignore exception + } + String hadoopIdsFile = System.getProperty("oozie.action.externalChildIDs"); + assertFalse(new File(hadoopIdsFile).exists()); + + } + + } http://git-wip-us.apache.org/repos/asf/oozie/blob/a6f0685d/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigMain.java ---------------------------------------------------------------------- diff --git a/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigMain.java b/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigMain.java index d19d4dd..1c72d12 100644 --- a/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigMain.java +++ b/sharelib/pig/src/test/java/org/apache/oozie/action/hadoop/TestPigMain.java @@ -120,8 +120,10 @@ public class TestPigMain extends PigTestCase { if (LauncherSecurityManager.getExitInvoked()) { System.out.println("Intercepting System.exit(" + LauncherSecurityManager.getExitCode() + ")"); System.err.println("Intercepting System.exit(" + LauncherSecurityManager.getExitCode() + ")"); - if (LauncherSecurityManager.getExitCode() != 0) { - fail(); + if (failOnException) { + if (LauncherSecurityManager.getExitCode() != 0) { + fail(); + } } } else { @@ -144,10 +146,11 @@ public class TestPigMain extends PigTestCase { } else { assertFalse(statsDataFile.exists()); } - // HadoopIds should always be stored - assertTrue(hadoopIdsFile.exists()); - String externalChildIds = IOUtils.getReaderAsString(new FileReader(hadoopIdsFile), -1); - assertTrue(externalChildIds.contains("job_")); + //File exist only if there is external child jobID. + if (hadoopIdsFile.exists()) { + String externalChildIds = IOUtils.getReaderAsString(new FileReader(hadoopIdsFile), -1); + assertTrue(externalChildIds.contains("job_")); + } return null; } http://git-wip-us.apache.org/repos/asf/oozie/blob/a6f0685d/webapp/src/main/webapp/oozie-console.js ---------------------------------------------------------------------- diff --git a/webapp/src/main/webapp/oozie-console.js b/webapp/src/main/webapp/oozie-console.js index e1b4588..986d10e 100644 --- a/webapp/src/main/webapp/oozie-console.js +++ b/webapp/src/main/webapp/oozie-console.js @@ -606,41 +606,45 @@ function jobDetailsPopup(response, request) { } } - function populateUrlUnit(actionStatus, urlUnit) { - var consoleUrl = actionStatus["consoleUrl"]; + function populateUrlUnit(actionStatus, urlUnit) { + var consoleUrl = actionStatus["consoleUrl"]; var externalChildIDs = actionStatus["externalChildIDs"]; - if(consoleUrl && externalChildIDs && externalChildIDs != "null") { - var urlPrefix = consoleUrl.trim().split(/_/)[0]; - //externalChildIds is a comma-separated string of each child job ID. - //Create URL list by appending jobID portion after stripping "job" + if (consoleUrl && externalChildIDs && externalChildIDs != "null") { + var urlPrefix = consoleUrl.trim().split(/_/)[0]; + // externalChildIds is a comma-separated string of each child job + // ID. + // Create URL list by appending jobID portion after stripping "job" var jobIds = externalChildIDs.split(/,/); var count = 1; jobIds.forEach(function(jobId) { - jobId = jobId.trim().split(/job/)[1]; - var jobUrl = new Ext.form.TriggerField({ - fieldLabel: 'Child Job ' + count, - editable: false, - name: 'childJobURLs', - width: 400, - value: urlPrefix + jobId, - triggerClass: 'x-form-search-trigger', - onTriggerClick: function() { - window.open(urlPrefix + jobId); - } - }); - if(jobId != undefined) { - urlUnit.add(jobUrl); - count++; - } - }); + jobId = jobId.trim().split(/job/); + if (jobId.length > 1) { + jobId = jobId[1]; + var jobUrl = new Ext.form.TriggerField({ + fieldLabel : 'Child Job ' + count, + editable : false, + name : 'childJobURLs', + width : 400, + value : urlPrefix + jobId, + triggerClass : 'x-form-search-trigger', + onTriggerClick : function() { + window.open(urlPrefix + jobId); + } + }); + if (jobId != undefined) { + urlUnit.add(jobUrl); + count++; + } + } + }); } else { var note = new Ext.form.TextField({ - fieldLabel: 'Child Job', - value: 'n/a' + fieldLabel : 'Child Job', + value : 'n/a' }); urlUnit.add(note); } - } + } function refreshActionDetails(actionId, detail, urlUnit) { Ext.Ajax.request({
