[2/2] incubator-systemml git commit: Use Apache Commons CLI to parse command line arguments in DMLScript

2017-04-21 Thread nakul02
Use Apache Commons CLI to parse command line arguments in DMLScript

- Added unit tests
- changed scripts to accept "-config " instead of "-config="
- Removed DMLScriptTest{1,2}
- Modified bin/systemml script to print a better help message
- Removed extraneous ZPackageSuite for DMLScriptTest{1,2}

Closes #440


Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/32924dc6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/32924dc6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/32924dc6

Branch: refs/heads/master
Commit: 32924dc6027df1973b37a8688b7d0cacbdefd4bf
Parents: f73673d
Author: Nakul Jindal 
Authored: Fri Apr 21 14:50:56 2017 -0700
Committer: Nakul Jindal 
Committed: Fri Apr 21 14:50:57 2017 -0700

--
 bin/systemml|  84 +--
 bin/systemml.bat|   4 +-
 docs/algorithms-classification.md   |  44 +-
 docs/algorithms-clustering.md   |  14 +-
 docs/algorithms-descriptive-statistics.md   |  14 +-
 docs/algorithms-matrix-factorization.md |  18 +-
 docs/algorithms-regression.md   |  36 +-
 docs/algorithms-survival-analysis.md|  16 +-
 docs/hadoop-batch-mode.md   |  16 +-
 docs/spark-batch-mode.md|   4 +-
 docs/standalone-guide.md|   2 +-
 docs/troubleshooting-guide.md   |   2 +-
 scripts/sparkDML.sh |   2 +-
 .../java/org/apache/sysml/api/DMLScript.java| 576 ---
 .../java/org/apache/sysml/api/MLContext.java|  49 +-
 .../org/apache/sysml/api/jmlc/Connection.java   |   2 +-
 .../sysml/api/mlcontext/ScriptExecutor.java |   2 +-
 .../org/apache/sysml/parser/ParserFactory.java  |  16 +-
 .../java/org/apache/sysml/utils/Explain.java|  32 +-
 .../org/apache/sysml/yarn/DMLYarnClient.java|   3 +-
 src/main/resources/scripts/sparkDML.sh  |   2 +-
 src/main/standalone/runStandaloneSystemML.bat   |   4 +-
 src/main/standalone/runStandaloneSystemML.sh|   2 +-
 .../test/integration/AutomatedTestBase.java |  19 +-
 .../functions/dmlscript/DMLScriptTest1.java | 125 
 .../functions/dmlscript/DMLScriptTest2.java | 151 -
 .../functions/misc/DataTypeChangeTest.java  |  14 +-
 .../parfor/ParForDependencyAnalysisTest.java|   2 +-
 .../TransformFrameEncodeDecodeTest.java |  15 +-
 .../sysml/test/unit/CLIOptionsParserTest.java   | 415 +
 .../functions/dmlscript/ZPackageSuite.java  |  37 --
 31 files changed, 992 insertions(+), 730 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/32924dc6/bin/systemml
--
diff --git a/bin/systemml b/bin/systemml
index 0ccee2d..44ab45e 100755
--- a/bin/systemml
+++ b/bin/systemml
@@ -20,32 +20,22 @@
 #
 #-
 
+
 # error help print
-printUsageExit()
+printSimpleUsage()
 {
 cat << EOF
 Usage: $0  [arguments] [-help]
--help - Print this usage message and exit
+-help - Print detailed help message
 EOF
   exit 1
 }
-#Script internally invokes 'java -Xmx4g -Xms4g -Xmn400m 
[Custom-Java-Options] -jar StandaloneSystemML.jar -f  -exec 
singlenode -config=SystemML-config.xml [Optional-Arguments]'
 
-while getopts "h:" options; do
-  case $options in
-h ) echo Warning: Help requested. Will exit after usage message
-printUsageExit
-;;
-\? ) echo Warning: Help requested. Will exit after usage message
-printUsageExit
-;;
-* ) echo Error: Unexpected error while processing options
-  esac
-done
+#Script internally invokes 'java -Xmx4g -Xms4g -Xmn400m 
[Custom-Java-Options] -jar StandaloneSystemML.jar -f  -exec 
singlenode -config=SystemML-config.xml [Optional-Arguments]'
 
 if [ -z "$1" ] ; then
 echo "Wrong Usage.";
-printUsageExit;
+printSimpleUsage
 fi
 
 
@@ -98,24 +88,6 @@ then
 fi
 
 
-# Peel off first argument so that $@ contains arguments to DML script
-SCRIPT_FILE=$1
-shift
-
-# if the script file path was omitted, try to complete the script path
-if [ ! -f "$SCRIPT_FILE" ]
-then
-  SCRIPT_FILE_NAME=$(basename $SCRIPT_FILE)
-  SCRIPT_FILE_FOUND=$(find "$PROJECT_ROOT_DIR/scripts" -name 
"$SCRIPT_FILE_NAME")
-  if [ ! "$SCRIPT_FILE_FOUND" ]
-  then
-echo "Could not find DML script: $SCRIPT_FILE"
-printUsageExit;
-  else
-SCRIPT_FILE=$SCRIPT_FILE_FOUND
-echo "DML script: $SCRIPT_FILE"
-  fi
-fi
 
 
 # add hadoop libraries which were generated by the build to the classpath
@@ -149,13 +121,57 @@ if [ -f "${PROJECT_ROOT_DIR}/conf/systemml-env.sh" ]; then
 

[2/2] incubator-systemml git commit: Use Apache Commons CLI to parse command line arguments in DMLScript

2017-03-27 Thread nakul02
Use Apache Commons CLI to parse command line arguments in DMLScript

- Uses Apache Commons CLI 1.2 to parse command line options
- Known limitation - strips arguments of leading and trailing double
  quotes
- Changed scripts to accept "-config " instead of "-config="
- Instead of "-gpu force=true", accepts "-gpu force"
- Concise description of usage options
- Updated bin/systemml script to print usage options when passed the
  "-help" option
- Removed DMLScriptTest{1,2}, lots of test cases added as unit tests as
  they were test the previous hand-rolled command line parsing
- Added unit tests

Closes #435


Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/8a125c75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/8a125c75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/8a125c75

Branch: refs/heads/gh-pages
Commit: 8a125c75c5f96ca65288806f36498483c413b04d
Parents: a1d73f8
Author: Nakul Jindal 
Authored: Mon Mar 27 13:35:12 2017 -0700
Committer: Nakul Jindal 
Committed: Mon Mar 27 13:35:12 2017 -0700

--
 algorithms-classification.md | 44 +++
 algorithms-clustering.md | 14 +-
 algorithms-descriptive-statistics.md | 14 +-
 algorithms-matrix-factorization.md   | 18 ++---
 algorithms-regression.md | 36 -
 algorithms-survival-analysis.md  | 16 +--
 hadoop-batch-mode.md | 16 +--
 spark-batch-mode.md  |  4 +--
 standalone-guide.md  |  2 +-
 troubleshooting-guide.md |  2 +-
 10 files changed, 83 insertions(+), 83 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/8a125c75/algorithms-classification.md
--
diff --git a/algorithms-classification.md b/algorithms-classification.md
index 0ee43bf..11bd1da 100644
--- a/algorithms-classification.md
+++ b/algorithms-classification.md
@@ -165,7 +165,7 @@ val prediction = model.transform(X_test_df)
  --conf spark.akka.frameSize=128
  SystemML.jar
  -f MultiLogReg.dml
- -config=SystemML-config.xml
+ -config SystemML-config.xml
  -exec hybrid_spark
  -nvargs X=
  Y=
@@ -336,7 +336,7 @@ prediction.show()
  --conf spark.akka.frameSize=128
  SystemML.jar
  -f MultiLogReg.dml
- -config=SystemML-config.xml
+ -config SystemML-config.xml
  -exec hybrid_spark
  -nvargs X=/user/ml/X.mtx
  Y=/user/ml/Y.mtx
@@ -532,7 +532,7 @@ val model = svm.fit(X_train_df)
  --conf spark.akka.frameSize=128
  SystemML.jar
  -f l2-svm.dml
- -config=SystemML-config.xml
+ -config SystemML-config.xml
  -exec hybrid_spark
  -nvargs X=
  Y=
@@ -579,7 +579,7 @@ val prediction = model.transform(X_test_df)
  --conf spark.akka.frameSize=128
  SystemML.jar
  -f l2-svm-predict.dml
- -config=SystemML-config.xml
+ -config SystemML-config.xml
  -exec hybrid_spark
  -nvargs X=
  Y=[file]
@@ -661,7 +661,7 @@ using a held-out test set. Note that this is an optional 
argument.
  --conf spark.akka.frameSize=128
  SystemML.jar
  -f l2-svm.dml
- -config=SystemML-config.xml
+ -config SystemML-config.xml
  -exec hybrid_spark
  -nvargs X=/user/ml/X.mtx
  Y=/user/ml/y.mtx
@@ -695,7 +695,7 @@ using a held-out test set. Note that this is an optional 
argument.
  --conf spark.akka.frameSize=128
  SystemML.jar