You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2016/03/01 19:34:10 UTC

[1/3] storm git commit: STORM-1244: port backtype.storm.command.upload-credentials to java

Repository: storm
Updated Branches:
  refs/heads/master 87e3c2467 -> 8fc0b92b1


STORM-1244: port backtype.storm.command.upload-credentials to java


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/2cabc3b7
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/2cabc3b7
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/2cabc3b7

Branch: refs/heads/master
Commit: 2cabc3b70f0c70c483ee9faa14daa63c9fd21077
Parents: 07629c1
Author: Abhishek Agarwal <ab...@inmobi.com>
Authored: Mon Feb 29 18:42:00 2016 +0530
Committer: Abhishek Agarwal <ab...@inmobi.com>
Committed: Mon Feb 29 23:52:13 2016 +0530

----------------------------------------------------------------------
 bin/storm.cmd                                   |  2 +-
 bin/storm.py                                    |  4 +-
 .../apache/storm/command/upload_credentials.clj | 35 -----------
 .../src/jvm/org/apache/storm/command/List.java  | 50 ----------------
 .../apache/storm/command/ListTopologies.java    | 52 +++++++++++++++++
 .../apache/storm/command/UploadCredentials.java | 61 ++++++++++++++++++++
 6 files changed, 116 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/2cabc3b7/bin/storm.cmd
----------------------------------------------------------------------
diff --git a/bin/storm.cmd b/bin/storm.cmd
index 1ef1e42..bfbd547 100644
--- a/bin/storm.cmd
+++ b/bin/storm.cmd
@@ -165,7 +165,7 @@
   goto :eof
 
 :list
-  set CLASS=org.apache.storm.command.List
+  set CLASS=org.apache.storm.command.ListTopologies
   set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS%
   goto :eof
 

http://git-wip-us.apache.org/repos/asf/storm/blob/2cabc3b7/bin/storm.py
----------------------------------------------------------------------
diff --git a/bin/storm.py b/bin/storm.py
index 94d6143..997989a 100755
--- a/bin/storm.py
+++ b/bin/storm.py
@@ -293,7 +293,7 @@ def upload_credentials(*args):
         print_usage(command="upload_credentials")
         sys.exit(2)
     exec_storm_class(
-        "org.apache.storm.command.upload_credentials",
+        "org.apache.storm.command.UploadCredentials",
         args=args,
         jvmtype="-client",
         extrajars=[USER_CONF_DIR, STORM_BIN_DIR])
@@ -389,7 +389,7 @@ def listtopos(*args):
     List the running topologies and their statuses.
     """
     exec_storm_class(
-        "org.apache.storm.command.List",
+        "org.apache.storm.command.ListTopologies",
         args=args,
         jvmtype="-client",
         extrajars=[USER_CONF_DIR, STORM_BIN_DIR])

http://git-wip-us.apache.org/repos/asf/storm/blob/2cabc3b7/storm-core/src/clj/org/apache/storm/command/upload_credentials.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/command/upload_credentials.clj b/storm-core/src/clj/org/apache/storm/command/upload_credentials.clj
deleted file mode 100644
index f63bde4..0000000
--- a/storm-core/src/clj/org/apache/storm/command/upload_credentials.clj
+++ /dev/null
@@ -1,35 +0,0 @@
-;; Licensed to the Apache Software Foundation (ASF) under one
-;; or more contributor license agreements.  See the NOTICE file
-;; distributed with this work for additional information
-;; regarding copyright ownership.  The ASF licenses this file
-;; to you under the Apache License, Version 2.0 (the
-;; "License"); you may not use this file except in compliance
-;; with the License.  You may obtain a copy of the License at
-;;
-;; http://www.apache.org/licenses/LICENSE-2.0
-;;
-;; Unless required by applicable law or agreed to in writing, software
-;; distributed under the License is distributed on an "AS IS" BASIS,
-;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;; See the License for the specific language governing permissions and
-;; limitations under the License.
-(ns org.apache.storm.command.upload-credentials
-  (:use [clojure.tools.cli :only [cli]])
-  (:use [org.apache.storm log util])
-  (:import [org.apache.storm StormSubmitter])
-  (:import [java.util Properties])
-  (:import [java.io FileReader])
-  (:gen-class))
-
-(defn read-map [file-name]
-  (let [props (Properties. )
-        _ (.load props (FileReader. file-name))]
-    (clojurify-structure props)))
-
-(defn -main [& args]
-  (let [[{cred-file :file} [name & rawCreds]] (cli args ["-f" "--file" :default nil])
-        _ (when (and rawCreds (not (even? (.size rawCreds)))) (throw (RuntimeException.  "Need an even number of arguments to make a map")))
-        mapping (if rawCreds (apply assoc {} rawCreds) {})
-        file-mapping (if (nil? cred-file) {} (read-map cred-file))]
-      (StormSubmitter/pushCredentials name {} (merge file-mapping mapping))
-      (log-message "Uploaded new creds to topology: " name)))

http://git-wip-us.apache.org/repos/asf/storm/blob/2cabc3b7/storm-core/src/jvm/org/apache/storm/command/List.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/command/List.java b/storm-core/src/jvm/org/apache/storm/command/List.java
deleted file mode 100644
index 7df0711..0000000
--- a/storm-core/src/jvm/org/apache/storm/command/List.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.storm.command;
-
-import org.apache.storm.generated.Nimbus;
-import org.apache.storm.generated.TopologySummary;
-import org.apache.storm.utils.NimbusClient;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class List {
-    private static final Logger LOG = LoggerFactory.getLogger(List.class);
-    private static final String MSG_FORMAT = "%-20s %-10s %-10s %-12s %-10s\n";
-
-    public static void main(String [] args) throws Exception {
-        NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() {
-          @Override
-          public void run(Nimbus.Client nimbus) throws Exception {
-              java.util.List<TopologySummary> topologies = nimbus.getClusterInfo().get_topologies();
-              if (topologies == null || topologies.isEmpty()) {
-                  System.out.println("No topologies running.");
-              } else {
-                  System.out.printf(MSG_FORMAT, "Topology_name", "Status", "Num_tasks", "Num_workers", "Uptime_secs");
-                  System.out.println("-------------------------------------------------------------------");
-                  for (TopologySummary topology: topologies) {
-                      System.out.printf(MSG_FORMAT, topology.get_name(), topology.get_status(),
-                                        topology.get_num_tasks(), topology.get_num_workers(),
-                                        topology.get_uptime_secs());
-                  }
-              }
-          }
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/storm/blob/2cabc3b7/storm-core/src/jvm/org/apache/storm/command/ListTopologies.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/command/ListTopologies.java b/storm-core/src/jvm/org/apache/storm/command/ListTopologies.java
new file mode 100644
index 0000000..97d18d5
--- /dev/null
+++ b/storm-core/src/jvm/org/apache/storm/command/ListTopologies.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.storm.command;
+
+import org.apache.storm.generated.Nimbus;
+import org.apache.storm.generated.TopologySummary;
+import org.apache.storm.utils.NimbusClient;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class ListTopologies {
+    private static final Logger LOG = LoggerFactory.getLogger(ListTopologies.class);
+    private static final String MSG_FORMAT = "%-20s %-10s %-10s %-12s %-10s\n";
+
+    public static void main(String [] args) throws Exception {
+        NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() {
+          @Override
+          public void run(Nimbus.Client nimbus) throws Exception {
+              List<TopologySummary> topologies = nimbus.getClusterInfo().get_topologies();
+              if (topologies == null || topologies.isEmpty()) {
+                  System.out.println("No topologies running.");
+              } else {
+                  System.out.printf(MSG_FORMAT, "Topology_name", "Status", "Num_tasks", "Num_workers", "Uptime_secs");
+                  System.out.println("-------------------------------------------------------------------");
+                  for (TopologySummary topology: topologies) {
+                      System.out.printf(MSG_FORMAT, topology.get_name(), topology.get_status(),
+                                        topology.get_num_tasks(), topology.get_num_workers(),
+                                        topology.get_uptime_secs());
+                  }
+              }
+          }
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/storm/blob/2cabc3b7/storm-core/src/jvm/org/apache/storm/command/UploadCredentials.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/command/UploadCredentials.java b/storm-core/src/jvm/org/apache/storm/command/UploadCredentials.java
new file mode 100644
index 0000000..6023409
--- /dev/null
+++ b/storm-core/src/jvm/org/apache/storm/command/UploadCredentials.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.storm.command;
+
+import org.apache.storm.StormSubmitter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.FileReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class UploadCredentials {
+
+    private static final Logger LOG = LoggerFactory.getLogger(UploadCredentials.class);
+
+    public static void main(String[] args) throws Exception {
+        Map<String, Object> cl = CLI.opt("f", "file", null)
+            .arg("topologyName", CLI.FIRST_WINS)
+            .arg("rawCredentials", CLI.INTO_LIST)
+            .parse(args);
+
+        String credentialFile = (String) cl.get("f");
+        List<String> rawCredentials = (List<String>) cl.get("rawCredentials");
+        String topologyName = (String) cl.get("topologyName");
+
+        if (null != rawCredentials && ((rawCredentials.size() % 2) != 0)) {
+            throw new RuntimeException("Need an even number of arguments to make a map");
+        }
+        Map credentialsMap = new HashMap<>();
+        if (null != credentialFile) {
+            Properties credentialProps = new Properties();
+            credentialProps.load(new FileReader(credentialFile));
+            credentialsMap.putAll(credentialProps);
+        }
+        if (null != rawCredentials) {
+            for (int i = 0; i < rawCredentials.size(); i += 2) {
+                credentialsMap.put(rawCredentials.get(i), rawCredentials.get(i + 1));
+            }
+        }
+        StormSubmitter.pushCredentials(topologyName, new HashMap(), credentialsMap);
+        LOG.info("Uploaded new creds to topology: {}", topologyName);
+    }
+}


[2/3] storm git commit: Merge branch 'upload-credentials' of https://github.com/abhishekagarwal87/storm into STORM-1244

Posted by bo...@apache.org.
Merge branch 'upload-credentials' of https://github.com/abhishekagarwal87/storm into STORM-1244

STORM-1244: port backtype.storm.command.upload-credentials to java


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

Branch: refs/heads/master
Commit: dab642bd356d106600d6cfdea09736bf3408dc87
Parents: 87e3c24 2cabc3b
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Tue Mar 1 11:24:56 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Tue Mar 1 11:24:56 2016 -0600

----------------------------------------------------------------------
 bin/storm.cmd                                   |  2 +-
 bin/storm.py                                    |  4 +-
 .../apache/storm/command/upload_credentials.clj | 35 -----------
 .../src/jvm/org/apache/storm/command/List.java  | 50 ----------------
 .../apache/storm/command/ListTopologies.java    | 52 +++++++++++++++++
 .../apache/storm/command/UploadCredentials.java | 61 ++++++++++++++++++++
 6 files changed, 116 insertions(+), 88 deletions(-)
----------------------------------------------------------------------



[3/3] storm git commit: Added STORM-1244 to Changelog

Posted by bo...@apache.org.
Added STORM-1244 to Changelog


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

Branch: refs/heads/master
Commit: 8fc0b92b168a95624a7d43eee4225192e65110bb
Parents: dab642b
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Tue Mar 1 11:25:19 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Tue Mar 1 11:25:19 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/8fc0b92b/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 689c138..87287f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
 ## 2.0.0
+ * STORM-1244: port backtype.storm.command.upload-credentials to java
  * STORM-1245: port backtype.storm.daemon.acker to java
  * STORM-1545: Topology Debug Event Log in Wrong Location
  * STORM-1254: port ui.helper to java