浏览代码

Merge pull request #14009 from wangkx/addProcess_max_pattern_single

HPCC-24157 Add more information to ECL WU Process entries

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 年之前
父节点
当前提交
cc3c11a897

+ 4 - 0
common/thorhelper/thorhelper.hpp

@@ -28,6 +28,10 @@
  #define THORHELPER_API DECL_IMPORT
 #endif
 
+#define SLAVEIDSTR "#SLAVEID#"
+#define THORMASTERLOGSEARCHSTR "thormaster."
+#define THORSLAVELOGSEARCHSTR "thorslave."
+
 interface IXmlToRawTransformer : extends IInterface
 {
     virtual IDataVal & transform(IDataVal & result, size32_t len, const void * text, bool isDataset) = 0;

+ 10 - 3
common/workunit/workunit.cpp

@@ -4226,8 +4226,8 @@ public:
             { c->commit(); }
     virtual IWUException * createException()
             { return c->createException(); }
-    virtual void addProcess(const char *type, const char *instance, unsigned pid, const char *log)
-            { c->addProcess(type, instance, pid, log); }
+    virtual void addProcess(const char *type, const char *instance, unsigned pid, unsigned max, const char *pattern, bool singleLog, const char *log)
+            { c->addProcess(type, instance, pid, max, pattern, singleLog, log); }
     virtual void protect(bool protectMode)
             { c->protect(protectMode); }
     virtual void setAction(WUAction action)
@@ -8181,7 +8181,8 @@ IStringIterator *CLocalWorkUnit::getProcesses(const char *type) const
     return new CStringPTreeTagIterator(p->getElements(xpath.str()));
 }
 
-void CLocalWorkUnit::addProcess(const char *type, const char *instance, unsigned pid, const char *log)
+void CLocalWorkUnit::addProcess(const char *type, const char *instance, unsigned pid,
+    unsigned max, const char *pattern, bool singleLog, const char *log)
 {
     VStringBuffer processType("Process/%s", type);
     VStringBuffer xpath("%s/%s", processType.str(), instance);
@@ -8194,6 +8195,12 @@ void CLocalWorkUnit::addProcess(const char *type, const char *instance, unsigned
         node = node->addPropTree(instance);
         node->setProp("@log", log);
         node->setPropInt("@pid", pid);
+        if (max > 0)
+            node->setPropInt("@max", max);
+        if (!isEmptyString(pattern))
+            node->setProp("@pattern", pattern);
+        if (singleLog)
+            node->setPropBool("@singleLog", true);
     }
 }
 

+ 1 - 1
common/workunit/workunit.hpp

@@ -1303,7 +1303,7 @@ interface IWorkUnit : extends IConstWorkUnit
     virtual void clearExceptions(const char *source=nullptr) = 0;
     virtual void commit() = 0;
     virtual IWUException * createException() = 0;
-    virtual void addProcess(const char *type, const char *instance, unsigned pid, const char *log=NULL) = 0;
+    virtual void addProcess(const char *type, const char *instance, unsigned pid, unsigned max, const char *pattern, bool singleLog, const char *log=nullptr) = 0;
     virtual void setAction(WUAction action) = 0;
     virtual void setApplicationValue(const char * application, const char * propname, const char * value, bool overwrite) = 0;
     virtual void setApplicationValueInt(const char * application, const char * propname, int value, bool overwrite) = 0;

+ 1 - 1
common/workunit/workunit.ipp

@@ -354,7 +354,7 @@ public:
     void clearExceptions(const char *source=nullptr);
     void commit();
     IWUException *createException();
-    void addProcess(const char *type, const char *instance, unsigned pid, const char *log);
+    void addProcess(const char *type, const char *instance, unsigned pid, unsigned max, const char *pattern, bool singleLog, const char *log);
     void setAction(WUAction action);
     void setApplicationValue(const char * application, const char * propname, const char * value, bool overwrite);
     void setApplicationValueInt(const char * application, const char * propname, int value, bool overwrite);

+ 1 - 1
ecl/eclagent/eclagent.cpp

@@ -1870,7 +1870,7 @@ void EclAgent::doProcess()
                 traceLevel = w->getDebugValueInt("traceLevel", 10);
             w->setTracingValue("EclAgentBuild", BUILD_TAG);
             if (agentTopology->hasProp("@name"))
-                w->addProcess("EclAgent", agentTopology->queryProp("@name"), GetCurrentProcessId(), logname.str());
+                w->addProcess("EclAgent", agentTopology->queryProp("@name"), GetCurrentProcessId(), 0, nullptr, false, logname.str());
 
             eclccCodeVersion = w->getCodeVersion();
             if (eclccCodeVersion == 0)

+ 1 - 1
ecl/eclagent/eclgraph.cpp

@@ -1559,7 +1559,7 @@ void EclAgent::updateWULogfile()
             rlf.getRemotePath(logname.clear());
 
             Owned <IWorkUnit> w = updateWorkUnit();
-            w->addProcess("EclAgent", agentTopology->queryProp("@name"), GetCurrentProcessId(), logname.str());
+            w->addProcess("EclAgent", agentTopology->queryProp("@name"), GetCurrentProcessId(), 0, nullptr, false, logname.str());
         }
         else
         {

+ 8 - 2
thorlcr/master/thgraphmanager.cpp

@@ -331,10 +331,16 @@ void CJobManager::fatal(IException *e)
 
 void CJobManager::updateWorkUnitLog(IWorkUnit &workunit)
 {
-    StringBuffer log, logUrl;
+    StringBuffer log, logUrl, slaveLogPattern;
     logHandler->getLogName(log);
     createUNCFilename(log, logUrl, false);
-    workunit.addProcess("Thor", globals->queryProp("@name"), 0, logUrl.str());
+    slaveLogPattern.set(THORSLAVELOGSEARCHSTR).append(SLAVEIDSTR);
+    const char *ptr = strstr(log, THORMASTERLOGSEARCHSTR);
+    dbgassertex(ptr);
+    slaveLogPattern.append(ptr + strlen(THORMASTERLOGSEARCHSTR) - 1); //Keep the '.' at the end of the THORMASTERLOGSEARCHSTR.
+    Owned<IConstWUClusterInfo> clusterInfo = getTargetClusterInfo(workunit.queryClusterName());
+    unsigned numberOfSlaves = clusterInfo->getNumberOfSlaveLogs();
+    workunit.addProcess("Thor", globals->queryProp("@name"), 0, numberOfSlaves, slaveLogPattern, false, logUrl.str());
 }
 
 

+ 1 - 1
tools/wutool/wutool.cpp

@@ -1343,7 +1343,7 @@ protected:
                 ex->setTimeStamp("2001");
             }
 
-            wu->addProcess("ptype", "pInstance", 54321, "mylog");
+            wu->addProcess("ptype", "pInstance", 54321, 50, "pPattern", false, "mylog");
             wu->setAction(WUActionCompile);
             wu->setApplicationValue("app1", "av1", "value", true);
             wu->setApplicationValueInt("app2", "av2", 42, true);