You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by snikhil5 <gi...@git.apache.org> on 2015/06/04 04:52:38 UTC

[GitHub] storm pull request: YSTORM-552 Adding new cli for getting latest e...

GitHub user snikhil5 opened a pull request:

    https://github.com/apache/storm/pull/576

    YSTORM-552 Adding new cli for getting latest errors from running storm topology

    This has been tested with the latest src code.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/snikhil5/incubator-storm error-cli

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/storm/pull/576.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #576
    
----
commit ff187f6ffbfe58c9bfc6b1b712f6c6ae62652b34
Author: Nikhil Singh <ns...@yahoo.com>
Date:   2015-05-27T05:44:17Z

    Adding the new cli get-errors to get the latest errors from storm components

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-847 Adding new cli for getting latest er...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/storm/pull/576


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: YSTORM-552 Adding new cli for getting latest e...

Posted by knusbaum <gi...@git.apache.org>.
Github user knusbaum commented on the pull request:

    https://github.com/apache/storm/pull/576#issuecomment-110874435
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: YSTORM-552 Adding new cli for getting latest e...

Posted by d2r <gi...@git.apache.org>.
Github user d2r commented on a diff in the pull request:

    https://github.com/apache/storm/pull/576#discussion_r31825223
  
    --- Diff: bin/storm.py ---
    @@ -304,6 +304,19 @@ def rebalance(*args):
             jvmtype="-client",
             extrajars=[USER_CONF_DIR, STORM_BIN_DIR])
     
    +def get_errors(*args):
    +    """Syntax: [storm get-errors topology-name]
    +
    +    Get the latest error from the running topology. The returned result contains
    +    the key value pairs for component-name and component-error for the components in error.
    +    The result is returned in json format.
    +    """
    +    exec_storm_class(
    +        "backtype.storm.command.get_errors",
    +        args=args,
    +        jvmtype="-client",
    +        extrajars=[USER_CONF_DIR, STORM_DIR + "/bin"])
    --- End diff --
    
    Let's use `os.path.join(STORM_DIR, "bin")` here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: YSTORM-552 Adding new cli for getting latest e...

Posted by d2r <gi...@git.apache.org>.
Github user d2r commented on a diff in the pull request:

    https://github.com/apache/storm/pull/576#discussion_r31825011
  
    --- Diff: storm-core/src/clj/backtype/storm/command/get_errors.clj ---
    @@ -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.
    +(ns backtype.storm.command.get-errors
    +  (:use [clojure.tools.cli :only [cli]])
    +  (:use [backtype.storm thrift log])
    +  (:use [backtype.storm util])
    +  (:require [backtype.storm.daemon
    +             [nimbus :as nimbus]
    +             [common :as common]])
    +  (:import [backtype.storm.generated GetInfoOptions NumErrorsChoice
    +            TopologySummary ErrorInfo])
    +  (:gen-class))
    +
    +(defn get-topology-id [name topologies]
    +  (let [topology (first (filter #(= (.get_name %1) name) topologies))]
    +    (when (not-nil? topology) (.get_id topology))))
    +
    +(defn get-component-errors
    +  [topology-errors]
    +  (apply hash-map (remove nil?
    +                    (flatten (for [[comp-name comp-errors] topology-errors]
    +                               (let [latest-error (when (not (empty? comp-errors)) (first comp-errors))]
    +                                 (if latest-error [comp-name (.get_error ^ErrorInfo latest-error)])))))))
    +
    +(defn -main [name]
    +  (with-configured-nimbus-connection nimbus
    +    (let [opts (doto (GetInfoOptions.)
    +                 (.set_num_err_choice NumErrorsChoice/ONE))
    +          cluster-info (.getClusterInfo nimbus)
    +          topologies (.get_topologies cluster-info)
    +          topo-id (get-topology-id name topologies)
    +          topo-info (when (not-nil? topo-id) (.getTopologyInfoWithOpts nimbus topo-id opts))]
    +      (if (or (nil? topo-id) (nil? topo-info))
    +        (println (to-json {"Failure" (str "No topologies running with name " name)}))
    +        (let [topology-name (.get_name topo-info)
    +              topology-errors (.get_errors topo-info)]
    +          (println  (to-json (hash-map
    +                                   "Topology Name" topology-name
    +                                   "Comp-Errors" (get-component-errors topology-errors)))))))))
    --- End diff --
    
    really minor: There are some strange formatting issues in the last three lines.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: YSTORM-552 Adding new cli for getting latest e...

Posted by d2r <gi...@git.apache.org>.
Github user d2r commented on the pull request:

    https://github.com/apache/storm/pull/576#issuecomment-110853173
  
    +1 looks good


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: STORM-847 Adding new cli for getting latest er...

Posted by kishorvpatil <gi...@git.apache.org>.
Github user kishorvpatil commented on the pull request:

    https://github.com/apache/storm/pull/576#issuecomment-111516456
  
    Thank you @snikhil5. This is pulled into master.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: YSTORM-552 Adding new cli for getting latest e...

Posted by d2r <gi...@git.apache.org>.
Github user d2r commented on the pull request:

    https://github.com/apache/storm/pull/576#issuecomment-109340293
  
    Looks OK to me overall.  Just minor comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: YSTORM-552 Adding new cli for getting latest e...

Posted by snikhil5 <gi...@git.apache.org>.
Github user snikhil5 commented on the pull request:

    https://github.com/apache/storm/pull/576#issuecomment-110412416
  
    updated..


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---