You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by ta...@apache.org on 2014/06/10 02:30:17 UTC
git commit: TEZ-1196. FaultToleranceTestRunner should allow passing
generic options from cli (Karam Singh via tassapola)
Repository: incubator-tez
Updated Branches:
refs/heads/master 39e6b95a1 -> e2bb2788f
TEZ-1196. FaultToleranceTestRunner should allow passing generic options from cli (Karam Singh via tassapola)
Project: http://git-wip-us.apache.org/repos/asf/incubator-tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tez/commit/e2bb2788
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/e2bb2788
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/e2bb2788
Branch: refs/heads/master
Commit: e2bb2788f5a4170110ff2ef2b741490924621b40
Parents: 39e6b95
Author: Tassapol Athiapinya <ta...@hortonworks.com>
Authored: Mon Jun 9 17:27:10 2014 -0700
Committer: Tassapol Athiapinya <ta...@hortonworks.com>
Committed: Mon Jun 9 17:27:15 2014 -0700
----------------------------------------------------------------------
.../tez/test/FaultToleranceTestRunner.java | 32 ++++++++++++--------
1 file changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/e2bb2788/tez-tests/src/test/java/org/apache/tez/test/FaultToleranceTestRunner.java
----------------------------------------------------------------------
diff --git a/tez-tests/src/test/java/org/apache/tez/test/FaultToleranceTestRunner.java b/tez-tests/src/test/java/org/apache/tez/test/FaultToleranceTestRunner.java
index fb12352..32062d4 100644
--- a/tez-tests/src/test/java/org/apache/tez/test/FaultToleranceTestRunner.java
+++ b/tez-tests/src/test/java/org/apache/tez/test/FaultToleranceTestRunner.java
@@ -38,7 +38,7 @@ import org.apache.tez.dag.api.TezConfiguration;
import org.apache.tez.dag.api.TezUncheckedException;
import org.apache.tez.dag.api.client.DAGClient;
import org.apache.tez.dag.api.client.DAGStatus;
-
+import org.apache.hadoop.util.GenericOptionsParser;
/**
* Run a DAG on a cluster with the given configuration. Starts a TezSession
* using default cluster configuration from installation. Then uses reflection
@@ -51,13 +51,17 @@ import org.apache.tez.dag.api.client.DAGStatus;
public class FaultToleranceTestRunner {
static String TEST_ROOT_DIR = "tmp";
-
+ Configuration conf = null;
TezSession tezSession = null;
Resource defaultResource = Resource.newInstance(100, 0);
-
void setup() throws Exception {
- TezConfiguration tezConf = new TezConfiguration(new YarnConfiguration());
+ TezConfiguration tezConf = null;
+ if (conf == null ) {
+ tezConf = new TezConfiguration(new YarnConfiguration());
+ }else {
+ tezConf = new TezConfiguration(new YarnConfiguration(this.conf));
+ }
FileSystem defaultFs = FileSystem.get(tezConf);
Path remoteStagingDir = defaultFs.makeQualified(new Path(TEST_ROOT_DIR, String
@@ -97,7 +101,8 @@ public class FaultToleranceTestRunner {
return dag;
}
- boolean run(String className, String confFilePath) throws Exception {
+ boolean run(Configuration conf, String className, String confFilePath) throws Exception {
+ this.conf = conf;
setup();
try {
@@ -137,24 +142,27 @@ public class FaultToleranceTestRunner {
static void printUsage() {
System.err.println(
- "Usage: " + " FaultToleranceTestRunner <dag-class-name> <test-conf-path>");
+ "Usage: " + " FaultToleranceTestRunner [generic options] <dag-class-name> <test-conf-path>");
+ GenericOptionsParser.printGenericCommandUsage(System.err);
}
public static void main(String[] args) throws Exception {
+ Configuration conf = new Configuration();
+ String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
String className = null;
String confFilePath = null;
- if (args.length == 1) {
- className = args[0];
- } else if (args.length == 2) {
- className = args[0];
- confFilePath = args[1];
+ if (otherArgs.length == 1) {
+ className = otherArgs[0];
+ } else if (otherArgs.length == 2) {
+ className = otherArgs[0];
+ confFilePath = otherArgs[1];
} else {
printUsage();
System.exit(1);
}
FaultToleranceTestRunner job = new FaultToleranceTestRunner();
- if (job.run(className, confFilePath)) {
+ if (job.run(conf, className, confFilePath)) {
System.out.println("Succeeded.");
} else {
System.out.println("Failed.");