Repository: incubator-gobblin
Updated Branches:
  refs/heads/master 56ead8845 -> e19f21093


[GOBBLIN-336] use a private method to construct cmd options for launcher

Use a private method to construct cmd options for
the single task
launcher.

Testing:
The SingleTaskLauncherTest passed.

Use a private method to construct cmd options for
the single task
launcher.

Testing:
The SingleTaskLauncherTest passed.

Closes #2213 from HappyRay/improve-cmd-option-
building


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

Branch: refs/heads/master
Commit: e19f210930ca471b3e50e1601cda8252d8b1638e
Parents: 56ead88
Author: Ray Yang <[email protected]>
Authored: Mon Dec 18 14:50:25 2017 -0800
Committer: Abhishek Tiwari <[email protected]>
Committed: Mon Dec 18 14:50:25 2017 -0800

----------------------------------------------------------------------
 .../apache/gobblin/cluster/SingleTaskLauncher.java   | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/e19f2109/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTaskLauncher.java
----------------------------------------------------------------------
diff --git 
a/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTaskLauncher.java
 
b/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTaskLauncher.java
index 945b5e5..77c74cb 100644
--- 
a/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTaskLauncher.java
+++ 
b/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTaskLauncher.java
@@ -100,22 +100,21 @@ class SingleTaskLauncher {
     }
 
     private void addClusterConfigPath() {
-      this.cmd.add(formatParam(CLUSTER_CONFIG_FILE_PATH));
-      this.cmd.add(SingleTaskLauncher.this.clusterConfigFilePath.toString());
+      addOneOption(CLUSTER_CONFIG_FILE_PATH,
+          SingleTaskLauncher.this.clusterConfigFilePath.toString());
     }
 
     private void addWorkUnitPath() {
-      this.cmd.add(formatParam(WORK_UNIT_FILE_PATH));
-      this.cmd.add(this.workUnitFilePath.toString());
+      addOneOption(WORK_UNIT_FILE_PATH, this.workUnitFilePath.toString());
     }
 
     private void addJobId() {
-      this.cmd.add(formatParam(JOB_ID));
-      this.cmd.add(this.jobId);
+      addOneOption(JOB_ID, this.jobId);
     }
 
-    private String formatParam(final String param) {
-      return "--" + param;
+    private void addOneOption(final String key, final String value) {
+      this.cmd.add("--" + key);
+      this.cmd.add(value);
     }
   }
 }

Reply via email to