Jake Smith 13 years ago
parent
commit
0faeebdf05

+ 2 - 2
esp/eclwatch/ws_XSLT/index.xslt

@@ -773,7 +773,7 @@
                         <xsl:attribute name="title">Queue running - Thor running</xsl:attribute>
                       </xsl:otherwise>
                     </xsl:choose>
-                    <xsl:attribute name="href">javascript:go('/WsTopology/TpClusterInfo?Name=<xsl:value-of select="$queue"/>')</xsl:attribute>
+                    <xsl:attribute name="href">javascript:go('/WsTopology/TpClusterInfo?Name=<xsl:value-of select="$cluster"/>')</xsl:attribute>
                     <xsl:value-of select="$queue"/>
                                 </a>
                                 </xsl:when>
@@ -821,7 +821,7 @@
                       </xsl:otherwise>
                     </xsl:choose>
                     <xsl:if test="string-length($status)">
-                                            <xsl:attribute name="href">javascript:go('/WsTopology/TpClusterInfo?Name=<xsl:value-of select="$queue"/>')</xsl:attribute>
+                                            <xsl:attribute name="href">javascript:go('/WsTopology/TpClusterInfo?Name=<xsl:value-of select="$cluster"/>')</xsl:attribute>
                                         </xsl:if>
                                         <xsl:choose>
                                           <xsl:when test="$roxie!='0'">RoxieCluster - </xsl:when>

+ 18 - 30
esp/services/ws_topology/ws_topologyService.cpp

@@ -1299,43 +1299,31 @@ bool CWsTopologyEx::onTpClusterInfo(IEspContext &context, IEspTpClusterInfoReque
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to get Cluster Information. Permission denied.");
 
-        CClusterQueue cq(req.getName());                // NB name is probably queue name
-        if (cq.thors.ordinality()>0) 
+        Owned<IRemoteConnection> conn = querySDS().connect("/Status/Servers/", myProcessSession(),RTM_SUB,SDS_LOCK_TIMEOUT);
+        if (conn)
         {
-            IPropertyTree &tree = cq.thors.item(0);
-            resp.setName(tree.queryProp("@thorname"));
-            resp.setWorkUnit(tree.queryProp("WorkUnit"));
-
-            double version = context.getClientVersion();
-            if (version > 1.09)
-            {       
-                IArrayOf<IEspTpQueue> Queues;
-                ForEachItemIn(i,cq.thors) 
+            SCMStringBuffer thorQueues;
+            getThorQueueNames(thorQueues, req.getName());
+            resp.setName(req.getName());
+            StringArray qlist;
+            CslToStringArray(thorQueues.str(), qlist, true);
+            IArrayOf<IEspTpQueue> Queues;
+            ForEachItemIn(q, qlist)
+            {
+                const char *queueName = qlist.item(q);
+                StringBuffer xpath("Server[@name=\"ThorMaster\"][@queue=\"");
+                xpath.append(queueName).append("\"]");
+                Owned<IPropertyTreeIterator> iter = conn->getElements(xpath.str()); // NB: should only be one
+                ForEach(*iter)
                 {
-                    IPropertyTree &tree = cq.thors.item(i);
-
+                    IPropertyTree &server = iter->query();
                     IEspTpQueue* pQueue = createTpQueue("","");
-                    pQueue->setName(tree.queryProp("@thorname"));
-                    pQueue->setWorkUnit(tree.queryProp("WorkUnit"));
+                    pQueue->setName(server.queryProp("@thorname"));
+                    pQueue->setWorkUnit(server.queryProp("WorkUnit"));
                     Queues.append(*pQueue);
                 }
-                resp.setTpQueues(Queues);
             }
-        }
-        else // fallback to cluster name
-        {
-            IArrayOf<IEspTpQueue> Queues;
-            
-            CCluster conn(req.getName());                   
-            IPropertyTree* tree = conn->queryRoot();
-            IEspTpQueue* pQueue = createTpQueue("","");
-            pQueue->setName(req.getName());
-            pQueue->setWorkUnit(tree->queryProp("WorkUnit"));
-            Queues.append(*pQueue);
             resp.setTpQueues(Queues);
-
-            resp.setName(req.getName());
-            resp.setWorkUnit(tree->queryProp("WorkUnit"));          
         }
     }
     catch(IException* e)

+ 3 - 7
esp/services/ws_workunits/ws_workunitsHelpers.cpp

@@ -144,13 +144,9 @@ StringBuffer &getWuidFromLogicalFileName(IEspContext &context, const char *logic
 
 const char *getThorQueueName(const char *cluster)
 {
-    Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
-    Owned<IConstEnvironment> environment = factory->openEnvironmentByFile();
-    Owned<IPropertyTree> root = &environment->getPTree();
-    if (!root)
-        throw MakeStringException(ECLWATCH_CANNOT_GET_ENV_INFO, "Failed to get environment information.");
-    VStringBuffer xpath("Software/ThorCluster[@name='%s']/@queueName", cluster);
-    return root->queryProp(xpath.str());
+    SCMStringBuffer thorQueues;
+    getThorQueueNames(thorQueues, cluster);
+    return thorQueues.str();
 }
 
 void formatDuration(StringBuffer &s, unsigned ms)

+ 0 - 33
esp/smc/SMCLib/TpWrapper.cpp

@@ -1756,36 +1756,3 @@ void CTpWrapper::getAttPath(const char* Path,StringBuffer& returnStr)
     StringBuffer decodedStr;
     JBASE64_Decode(Path, returnStr);
 }
-
-CClusterQueue::CClusterQueue(const char* qname)
-{
-    if (!qname||!*qname)
-        return;
-    Owned<IRemoteConnection> conn = querySDS().connect("/Status/Servers",myProcessSession(),RTM_SUB,SDS_LOCK_TIMEOUT);
-    if (!conn)
-        return;
-    // lookup active thor clusters based on qname (this could also look up eclservers if we so wanted)
-    StringBuffer xpath;
-    xpath.appendf("Server[@name=\"ThorMaster\"][@queue=\"%s.thor\"]",qname);
-    Owned<IPropertyTreeIterator> iter = conn->getElements(xpath.str());
-    ForEach(*iter)
-    {
-        // use simple insertion sort
-        IPropertyTree &tree = iter->get();
-        const char *name = tree.queryProp("@thorname");
-        if (name&&*name) {
-            unsigned i = 0;
-            loop {
-                if (i==thors.ordinality()) {
-                    thors.append(tree);
-                    break;
-                }
-                if (stricmp(name,thors.item(i).queryProp("@thorname"))<0) {
-                    thors.add(tree,i);
-                    break;
-                }
-                i++;
-            }
-        }
-    }
-}

+ 0 - 7
esp/smc/SMCLib/TpWrapper.hpp

@@ -200,12 +200,5 @@ private:
     Owned<IRemoteConnection> conn;
 };
 
-class TPWRAPPER_API CClusterQueue // looks up all thor clusters active based on queue name
-{
-public:
-    CClusterQueue(const char* qname);
-    IArrayOf<IPropertyTree> thors;
-};
-
 #endif //_ESPWIZ_TpWrapper_HPP__