ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject incubator-ignite git commit: master: visor debug reworked
Date Wed, 10 Dec 2014 09:26:11 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/master 20872dc75 -> a0e5f1bb9


master: visor debug reworked


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

Branch: refs/heads/master
Commit: a0e5f1bb9abdf979b6603927f2deb0db02101ce9
Parents: 20872dc
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Wed Dec 10 12:26:04 2014 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Wed Dec 10 12:26:04 2014 +0300

----------------------------------------------------------------------
 .../grid/kernal/visor/VisorMultiNodeTask.java   | 31 +++++++---
 .../visor/node/VisorNodeDataCollectorJob.java   | 64 ++++++++++++++++----
 .../visor/node/VisorNodeDataCollectorTask.java  | 24 ++++----
 3 files changed, 88 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0e5f1bb/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
index 8db90e0..de6d88b 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/VisorMultiNodeTask.java
@@ -14,7 +14,6 @@ import org.apache.ignite.compute.*;
 import org.apache.ignite.resources.*;
 import org.gridgain.grid.*;
 import org.gridgain.grid.kernal.*;
-import org.gridgain.grid.util.*;
 import org.gridgain.grid.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
 
@@ -48,8 +47,8 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
     protected abstract VisorJob<A, J> job(A arg);
 
     /** {@inheritDoc} */
-    @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode>
subgrid,
-        @Nullable VisorTaskArgument<A> arg) throws GridException {
+    @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode>
subgrid, VisorTaskArgument<A> arg)
+        throws GridException {
         assert arg != null;
 
         start = U.currentTimeMillis();
@@ -61,13 +60,24 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
         if (debug)
             logStart(g.log(), getClass(), start);
 
+        return map0(subgrid, arg);
+    }
+
+    /**
+     * Actual map logic.
+     *
+     * @param arg Task execution argument.
+     * @param subgrid Nodes available for this task execution.
+     * @return Map of grid jobs assigned to subgrid node.
+     * @throws GridException If mapping could not complete successfully.
+     */
+    protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode> subgrid,
VisorTaskArgument<A> arg)
+        throws GridException {
         Collection<UUID> nodeIds = arg.nodes();
 
         Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size());
 
         try {
-            taskArg = arg.argument();
-
             for (ClusterNode node : subgrid)
                 if (nodeIds.contains(node.id()))
                     map.put(job(taskArg), node);
@@ -75,8 +85,7 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
             return map;
         }
         finally {
-            if (debug)
-                logMapped(g.log(), getClass(), map.values());
+            logMapped(g.log(), getClass(), map.values());
         }
     }
 
@@ -87,7 +96,13 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
         return ComputeJobResultPolicy.WAIT;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Actual reduce logic.
+     *
+     * @param results Job results.
+     * @return Task result.
+     * @throws GridException If reduction or results caused an error.
+     */
     @Nullable protected abstract R reduce0(List<ComputeJobResult> results) throws GridException;
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0e5f1bb/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorJob.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorJob.java
index 1b5df78..7b3cec1 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorJob.java
@@ -86,8 +86,17 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
             for (GridCache cache : g.cachesx()) {
                 String cacheName = cache.name();
 
-                if (arg.systemCaches() || !(isSystemCache(cacheName) || isGgfsCache(cfg,
cacheName)))
-                    res.caches().add(VisorCache.from(g, cache, arg.sample()));
+                if (arg.systemCaches() || !(isSystemCache(cacheName) || isGgfsCache(cfg,
cacheName))) {
+                    long start0 = U.currentTimeMillis();
+
+                    try {
+                        res.caches().add(VisorCache.from(g, cache, arg.sample()));
+                    }
+                    finally {
+                        if (debug)
+                            log(g.log(), "Collected cache: " + cache.name(), getClass(),
start0);
+                    }
+                }
             }
         }
         catch (Throwable cachesEx) {
@@ -101,16 +110,24 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
             GridGgfsProcessorAdapter ggfsProc = ((GridKernal)g).context().ggfs();
 
             for (IgniteFs ggfs : ggfsProc.ggfss()) {
-                Collection<GridIpcServerEndpoint> endPoints = ggfsProc.endpoints(ggfs.name());
+                long start0 = U.currentTimeMillis();
 
-                if (endPoints != null) {
-                    for (GridIpcServerEndpoint ep : endPoints)
-                        if (ep.isManagement())
-                            res.ggfsEndpoints().add(new VisorGgfsEndpoint(ggfs.name(), g.name(),
-                                ep.getHost(), ep.getPort()));
-                }
+                try {
+                    Collection<GridIpcServerEndpoint> endPoints = ggfsProc.endpoints(ggfs.name());
 
-                res.ggfss().add(VisorGgfs.from(ggfs));
+                    if (endPoints != null) {
+                        for (GridIpcServerEndpoint ep : endPoints)
+                            if (ep.isManagement())
+                                res.ggfsEndpoints().add(new VisorGgfsEndpoint(ggfs.name(),
g.name(),
+                                    ep.getHost(), ep.getPort()));
+                    }
+
+                    res.ggfss().add(VisorGgfs.from(ggfs));
+                }
+                finally {
+                    if (debug)
+                        log(g.log(), "Collected GGFS: " + ggfs.name(), getClass(), start0);
+                }
             }
         }
         catch (Throwable ggfssEx) {
@@ -124,8 +141,17 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
             StreamerConfiguration[] cfgs = g.configuration().getStreamerConfiguration();
 
             if (cfgs != null) {
-                for (StreamerConfiguration cfg : cfgs)
-                    res.streamers().add(VisorStreamer.from(g.streamer(cfg.getName())));
+                for (StreamerConfiguration cfg : cfgs) {
+                    long start0 = U.currentTimeMillis();
+
+                    try {
+                        res.streamers().add(VisorStreamer.from(g.streamer(cfg.getName())));
+                    }
+                    finally {
+                        if (debug)
+                            log(g.log(), "Collected streamer: " + cfg.getName(), getClass(),
start0);
+                    }
+                }
             }
         }
         catch (Throwable streamersEx) {
@@ -144,14 +170,28 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
 
         res.topologyVersion(g.topologyVersion());
 
+        long start0 = U.currentTimeMillis();
+
         events(res, arg);
 
+        if (debug)
+            start0 = log(g.log(), "Collected events", getClass(), start0);
+
         caches(res, arg);
 
+        if (debug)
+            start0 = log(g.log(), "Collected caches", getClass(), start0);
+
         ggfs(res);
 
+        if (debug)
+            start0 = log(g.log(), "Collected ggfs", getClass(), start0);
+
         streamers(res);
 
+        if (debug)
+            log(g.log(), "Collected streamers", getClass(), start0);
+
         return res;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0e5f1bb/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorTask.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorTask.java
index 7ff18e9..6107d4a 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorTask.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/node/VisorNodeDataCollectorTask.java
@@ -19,6 +19,8 @@ import org.jetbrains.annotations.*;
 
 import java.util.*;
 
+import static org.gridgain.grid.kernal.visor.util.VisorTaskUtils.*;
+
 /**
  * Collects current Grid state mostly topology and metrics.
  */
@@ -29,21 +31,21 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
-    @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode>
subgrid,
-        @Nullable VisorTaskArgument<VisorNodeDataCollectorTaskArg> arg) throws GridException
{
+    @Override protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode>
subgrid,
+        VisorTaskArgument<VisorNodeDataCollectorTaskArg> arg) throws GridException
{
         assert arg != null;
 
-        taskArg = arg.argument();
-
-        Collection<ClusterNode> nodes = g.nodes();
-
-        Map<ComputeJob, ClusterNode> map = U.newHashMap(nodes.size());
+        Map<ComputeJob, ClusterNode> map = U.newHashMap(subgrid.size());
 
-        // Collect data from ALL nodes.
-        for (ClusterNode node : nodes)
-            map.put(job(taskArg), node);
+        try {
+            for (ClusterNode node : subgrid)
+                map.put(job(taskArg), node);
 
-        return map;
+            return map;
+        }
+        finally {
+            logMapped(g.log(), getClass(), map.values());
+        }
     }
 
     /** {@inheritDoc} */


Mime
View raw message