Browse Source

HPCC-16971 Add 3 additional options for WUInfo

Add options for not including ECL/Helpers/AllowedClusters in WUInfo

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 8 years ago
parent
commit
7dd137dc9d

+ 4 - 1
esp/scm/ws_workunits.ecm

@@ -690,6 +690,9 @@ ESPrequest WUInfoRequest
     [min_ver("1.16")] bool IncludeWorkflows(true);
     [min_ver("1.16")] bool IncludeWorkflows(true);
     [min_ver("1.39")] bool IncludeXmlSchemas(false);
     [min_ver("1.39")] bool IncludeXmlSchemas(false);
     [min_ver("1.47")] bool IncludeResourceURLs(false);
     [min_ver("1.47")] bool IncludeResourceURLs(false);
+    [min_ver("1.66")] bool IncludeECL(true);
+    [min_ver("1.66")] bool IncludeHelpers(true);
+    [min_ver("1.66")] bool IncludeAllowedClusters(true);
     [min_ver("1.16")] bool SuppressResultSchemas(false);
     [min_ver("1.16")] bool SuppressResultSchemas(false);
     [min_ver("1.25")] string ThorSlaveIP;
     [min_ver("1.25")] string ThorSlaveIP;
 };
 };
@@ -1795,7 +1798,7 @@ ESPresponse [exceptions_inline, nil_remove] WUGetNumFileToCopyResponse
 
 
 ESPservice [
 ESPservice [
     auth_feature("DEFERRED"), //This declares that the method logic handles feature level authorization
     auth_feature("DEFERRED"), //This declares that the method logic handles feature level authorization
-    version("1.65"), default_client_version("1.65"),
+    version("1.66"), default_client_version("1.66"),
     noforms,exceptions_inline("./smc_xslt/exceptions.xslt"),use_method_name] WsWorkunits
     noforms,exceptions_inline("./smc_xslt/exceptions.xslt"),use_method_name] WsWorkunits
 {
 {
     ESPmethod [resp_xsl_default("/esp/xslt/workunits.xslt")]     WUQuery(WUQueryRequest, WUQueryResponse);
     ESPmethod [resp_xsl_default("/esp/xslt/workunits.xslt")]     WUQuery(WUQueryRequest, WUQueryResponse);

+ 35 - 27
esp/services/ws_workunits/ws_workunitsHelpers.cpp

@@ -188,7 +188,7 @@ void getSashaNode(SocketEndpoint &ep)
 }
 }
 
 
 
 
-void WsWuInfo::getSourceFiles(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getSourceFiles(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if (!(flags & WUINFO_IncludeSourceFiles))
     if (!(flags & WUINFO_IncludeSourceFiles))
         return;
         return;
@@ -299,7 +299,7 @@ void WsWuInfo::getSourceFiles(IEspECLWorkunit &info, unsigned flags)
     }
     }
 }
 }
 
 
-void WsWuInfo::getExceptions(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getExceptions(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if ((flags & WUINFO_IncludeExceptions) || version > 1.16)
     if ((flags & WUINFO_IncludeExceptions) || version > 1.16)
     {
     {
@@ -316,7 +316,7 @@ void WsWuInfo::getExceptions(IEspECLWorkunit &info, unsigned flags)
     }
     }
 }
 }
 
 
-void WsWuInfo::getVariables(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getVariables(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if (!(flags & WUINFO_IncludeVariables))
     if (!(flags & WUINFO_IncludeVariables))
         return;
         return;
@@ -426,7 +426,7 @@ void WsWuInfo::doGetTimers(IArrayOf<IEspECLTimer>& timers)
     }
     }
 }
 }
 
 
-void WsWuInfo::getTimers(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getTimers(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if (!(flags & WUINFO_IncludeTimers))
     if (!(flags & WUINFO_IncludeTimers))
         return;
         return;
@@ -476,7 +476,7 @@ mapEnums queryFileTypes[] = {
    { FileTypeSize,  NULL },
    { FileTypeSize,  NULL },
 };
 };
 
 
-void WsWuInfo::getHelpers(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getHelpers(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     try
     try
     {
     {
@@ -487,20 +487,25 @@ void WsWuInfo::getHelpers(IEspECLWorkunit &info, unsigned flags)
         {
         {
             ERRLOG("Cannot get Query for this workunit.");
             ERRLOG("Cannot get Query for this workunit.");
             info.setHelpersDesc("Cannot get Query for this workunit.");
             info.setHelpersDesc("Cannot get Query for this workunit.");
+
+            if (!(flags & WUINFO_IncludeHelpers))
+                return;
         }
         }
         else
         else
         {
         {
-            SCMStringBuffer qname;
-            query->getQueryShortText(qname);
-            if(qname.length())
+            if (flags & WUINFO_IncludeECL)
             {
             {
-                if((flags & WUINFO_TruncateEclTo64k) && (qname.length() > 64000))
-                    qname.setLen(qname.str(), 64000);
+                SCMStringBuffer qname;
+                query->getQueryShortText(qname);
+                if(qname.length())
+                {
+                    if((flags & WUINFO_TruncateEclTo64k) && (qname.length() > 64000))
+                        qname.setLen(qname.str(), 64000);
 
 
-                IEspECLQuery* q=&info.updateQuery();
-                q->setText(qname.str());
+                    IEspECLQuery* q=&info.updateQuery();
+                    q->setText(qname.str());
+                }
             }
             }
-
             if (version > 1.34)
             if (version > 1.34)
             {
             {
                 SCMStringBuffer mainDefinition;
                 SCMStringBuffer mainDefinition;
@@ -517,6 +522,9 @@ void WsWuInfo::getHelpers(IEspECLWorkunit &info, unsigned flags)
                 info.setHasArchiveQuery(query->hasArchive());
                 info.setHasArchiveQuery(query->hasArchive());
             }
             }
 
 
+            if (!(flags & WUINFO_IncludeHelpers))
+                return;
+
             for (unsigned i = 0; i < FileTypeSize; i++)
             for (unsigned i = 0; i < FileTypeSize; i++)
                 getHelpFiles(query, (WUFileType) i, helpers);
                 getHelpFiles(query, (WUFileType) i, helpers);
         }
         }
@@ -588,7 +596,7 @@ void WsWuInfo::getHelpers(IEspECLWorkunit &info, unsigned flags)
     }
     }
 }
 }
 
 
-void WsWuInfo::getApplicationValues(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getApplicationValues(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if (!(flags & WUINFO_IncludeApplicationValues))
     if (!(flags & WUINFO_IncludeApplicationValues))
         return;
         return;
@@ -618,7 +626,7 @@ void WsWuInfo::getApplicationValues(IEspECLWorkunit &info, unsigned flags)
     }
     }
 }
 }
 
 
-void WsWuInfo::getDebugValues(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getDebugValues(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if (!(flags & WUINFO_IncludeDebugValues))
     if (!(flags & WUINFO_IncludeDebugValues))
     {
     {
@@ -753,7 +761,7 @@ void WsWuInfo::doGetGraphs(IArrayOf<IEspECLGraph>& graphs)
     }
     }
 }
 }
 
 
-void WsWuInfo::getGraphInfo(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getGraphInfo(IEspECLWorkunit &info, unsigned long flags)
 {
 {
      if (version > 1.01)
      if (version > 1.01)
      {
      {
@@ -795,7 +803,7 @@ void WsWuInfo::getWUGraphNameAndTypes(WUGraphType graphType, IArrayOf<IEspNameAn
     }
     }
 }
 }
 
 
-void WsWuInfo::getGraphTimingData(IArrayOf<IConstECLTimingData> &timingData, unsigned flags)
+void WsWuInfo::getGraphTimingData(IArrayOf<IConstECLTimingData> &timingData)
 {
 {
     StatisticsFilter filter(SCTall, SSTsubgraph, SMeasureTimeNs, StTimeElapsed);
     StatisticsFilter filter(SCTall, SSTsubgraph, SMeasureTimeNs, StTimeElapsed);
     Owned<IConstWUStatisticIterator> times = &cw->getStatistics(&filter);
     Owned<IConstWUStatisticIterator> times = &cw->getStatistics(&filter);
@@ -829,10 +837,10 @@ void WsWuInfo::getGraphTimingData(IArrayOf<IConstECLTimingData> &timingData, uns
     }
     }
 
 
     if (!matched)
     if (!matched)
-        legacyGetGraphTimingData(timingData, flags);
+        legacyGetGraphTimingData(timingData);
 }
 }
 
 
-void WsWuInfo::legacyGetGraphTimingData(IArrayOf<IConstECLTimingData> &timingData, unsigned flags)
+void WsWuInfo::legacyGetGraphTimingData(IArrayOf<IConstECLTimingData> &timingData)
 {
 {
     StatisticsFilter filter;
     StatisticsFilter filter;
     filter.setScopeDepth(1);
     filter.setScopeDepth(1);
@@ -935,7 +943,7 @@ unsigned WsWuInfo::getLegacyTotalThorTime()
     return 0;
     return 0;
 }
 }
 
 
-void WsWuInfo::getCommon(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getCommon(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     info.setWuid(cw->queryWuid());
     info.setWuid(cw->queryWuid());
     info.setProtected(cw->isProtected() ? 1 : 0);
     info.setProtected(cw->isProtected() ? 1 : 0);
@@ -997,7 +1005,7 @@ void WsWuInfo::setWUAbortTime(IEspECLWorkunit &info, unsigned __int64 abortTS)
     info.setAbortTime(abortTimeStr.str());
     info.setAbortTime(abortTimeStr.str());
 }
 }
 
 
-void WsWuInfo::getInfo(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getInfo(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     getCommon(info, flags);
     getCommon(info, flags);
 
 
@@ -1231,9 +1239,9 @@ unsigned WsWuInfo::getWorkunitThorLogInfo(IArrayOf<IEspECLHelpFile>& helpers, IE
     return countThorLog;
     return countThorLog;
 }
 }
 
 
-bool WsWuInfo::getClusterInfo(IEspECLWorkunit &info, unsigned flags)
+bool WsWuInfo::getClusterInfo(IEspECLWorkunit &info, unsigned long flags)
 {
 {
-    if (version > 1.04)
+    if ((flags & WUINFO_IncludeAllowedClusters) && (version > 1.04))
     {
     {
         StringArray allowedClusters;
         StringArray allowedClusters;
         SCMStringBuffer val;
         SCMStringBuffer val;
@@ -1287,7 +1295,7 @@ bool WsWuInfo::getClusterInfo(IEspECLWorkunit &info, unsigned flags)
     return true;
     return true;
 }
 }
 
 
-void WsWuInfo::getWorkflow(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getWorkflow(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if (!(flags & WUINFO_IncludeWorkflows))
     if (!(flags & WUINFO_IncludeWorkflows))
         return;
         return;
@@ -1449,7 +1457,7 @@ bool WsWuInfo::getResultEclSchemas(IConstWUResult &r, IArrayOf<IEspECLSchemaItem
     return true;
     return true;
 }
 }
 
 
-void WsWuInfo::getResult(IConstWUResult &r, IArrayOf<IEspECLResult>& results, unsigned flags)
+void WsWuInfo::getResult(IConstWUResult &r, IArrayOf<IEspECLResult>& results, unsigned long flags)
 {
 {
     SCMStringBuffer name;
     SCMStringBuffer name;
     r.getResultName(name);
     r.getResultName(name);
@@ -1557,7 +1565,7 @@ void WsWuInfo::getResult(IConstWUResult &r, IArrayOf<IEspECLResult>& results, un
 }
 }
 
 
 
 
-void WsWuInfo::getResults(IEspECLWorkunit &info, unsigned flags)
+void WsWuInfo::getResults(IEspECLWorkunit &info, unsigned long flags)
 {
 {
     if (!(flags & WUINFO_IncludeResults))
     if (!(flags & WUINFO_IncludeResults))
         return;
         return;
@@ -1779,7 +1787,7 @@ void WsWuInfo::getSubFiles(IPropertyTreeIterator* f, IEspECLSourceFile* eclSuper
     return;
     return;
 }
 }
 
 
-bool WsWuInfo::getResourceInfo(StringArray &viewnames, StringArray &urls, unsigned flags)
+bool WsWuInfo::getResourceInfo(StringArray &viewnames, StringArray &urls, unsigned long flags)
 {
 {
     if (!(flags & (WUINFO_IncludeResultsViewNames | WUINFO_IncludeResourceURLs)))
     if (!(flags & (WUINFO_IncludeResultsViewNames | WUINFO_IncludeResourceURLs)))
         return true;
         return true;

+ 21 - 18
esp/services/ws_workunits/ws_workunitsHelpers.hpp

@@ -125,7 +125,10 @@ private:
 #define WUINFO_IncludeResultsViewNames  0x0800
 #define WUINFO_IncludeResultsViewNames  0x0800
 #define WUINFO_IncludeXmlSchema         0x1000
 #define WUINFO_IncludeXmlSchema         0x1000
 #define WUINFO_IncludeResourceURLs      0x2000
 #define WUINFO_IncludeResourceURLs      0x2000
-#define WUINFO_All                      0xFFFF
+#define WUINFO_IncludeECL               0x4000
+#define WUINFO_IncludeHelpers           0x8000
+#define WUINFO_IncludeAllowedClusters   0x10000
+#define WUINFO_All                      0xFFFFFFFF
 
 
 class WsWuInfo
 class WsWuInfo
 {
 {
@@ -151,37 +154,37 @@ public:
             throw MakeStringException(ECLWATCH_CANNOT_OPEN_WORKUNIT,"Cannot open workunit %s.", wuid_);
             throw MakeStringException(ECLWATCH_CANNOT_OPEN_WORKUNIT,"Cannot open workunit %s.", wuid_);
     }
     }
 
 
-    bool getResourceInfo(StringArray &viewnames, StringArray &urls, unsigned flags);
+    bool getResourceInfo(StringArray &viewnames, StringArray &urls, unsigned long flags);
     unsigned getResourceURLCount();
     unsigned getResourceURLCount();
 
 
-    void getCommon(IEspECLWorkunit &info, unsigned flags);
-    void getInfo(IEspECLWorkunit &info, unsigned flags);
+    void getCommon(IEspECLWorkunit &info, unsigned long flags);
+    void getInfo(IEspECLWorkunit &info, unsigned long flags);
 
 
-    void getResults(IEspECLWorkunit &info, unsigned flags);
-    void getVariables(IEspECLWorkunit &info, unsigned flags);
-    void getDebugValues(IEspECLWorkunit &info, unsigned flags);
-    bool getClusterInfo(IEspECLWorkunit &info, unsigned flags);
-    void getApplicationValues(IEspECLWorkunit &info, unsigned flags);
-    void getExceptions(IEspECLWorkunit &info, unsigned flags);
-    void getSourceFiles(IEspECLWorkunit &info, unsigned flags);
+    void getResults(IEspECLWorkunit &info, unsigned long flags);
+    void getVariables(IEspECLWorkunit &info, unsigned long flags);
+    void getDebugValues(IEspECLWorkunit &info, unsigned long flags);
+    bool getClusterInfo(IEspECLWorkunit &info, unsigned long flags);
+    void getApplicationValues(IEspECLWorkunit &info, unsigned long flags);
+    void getExceptions(IEspECLWorkunit &info, unsigned long flags);
+    void getSourceFiles(IEspECLWorkunit &info, unsigned long flags);
     unsigned getTimerCount();
     unsigned getTimerCount();
-    void getTimers(IEspECLWorkunit &info, unsigned flags);
+    void getTimers(IEspECLWorkunit &info, unsigned long flags);
     void doGetTimers(IArrayOf<IEspECLTimer>& timers);
     void doGetTimers(IArrayOf<IEspECLTimer>& timers);
-    void getHelpers(IEspECLWorkunit &info, unsigned flags);
-    void getGraphInfo(IEspECLWorkunit &info, unsigned flags);
+    void getHelpers(IEspECLWorkunit &info, unsigned long flags);
+    void getGraphInfo(IEspECLWorkunit &info, unsigned long flags);
     void doGetGraphs(IArrayOf<IEspECLGraph>& graphs);
     void doGetGraphs(IArrayOf<IEspECLGraph>& graphs);
     void getWUGraphNameAndTypes(WUGraphType graphType, IArrayOf<IEspNameAndType>& graphNameAndTypes);
     void getWUGraphNameAndTypes(WUGraphType graphType, IArrayOf<IEspNameAndType>& graphNameAndTypes);
-    void getGraphTimingData(IArrayOf<IConstECLTimingData> &timingData, unsigned flags);
+    void getGraphTimingData(IArrayOf<IConstECLTimingData> &timingData);
     bool getFileSize(const char* fileName, const char* IPAddress, offset_t& fileSize);
     bool getFileSize(const char* fileName, const char* IPAddress, offset_t& fileSize);
 
 
-    void getWorkflow(IEspECLWorkunit &info, unsigned flags);
+    void getWorkflow(IEspECLWorkunit &info, unsigned long flags);
 
 
     void getHelpFiles(IConstWUQuery* query, WUFileType type, IArrayOf<IEspECLHelpFile>& helpers);
     void getHelpFiles(IConstWUQuery* query, WUFileType type, IArrayOf<IEspECLHelpFile>& helpers);
     void getSubFiles(IPropertyTreeIterator* f, IEspECLSourceFile* eclSuperFile, StringArray& fileNames);
     void getSubFiles(IPropertyTreeIterator* f, IEspECLSourceFile* eclSuperFile, StringArray& fileNames);
     void getEclSchemaChildFields(IArrayOf<IEspECLSchemaItem>& schemas, IHqlExpression * expr, bool isConditional);
     void getEclSchemaChildFields(IArrayOf<IEspECLSchemaItem>& schemas, IHqlExpression * expr, bool isConditional);
     void getEclSchemaFields(IArrayOf<IEspECLSchemaItem>& schemas, IHqlExpression * expr, bool isConditional);
     void getEclSchemaFields(IArrayOf<IEspECLSchemaItem>& schemas, IHqlExpression * expr, bool isConditional);
     bool getResultEclSchemas(IConstWUResult &r, IArrayOf<IEspECLSchemaItem>& schemas);
     bool getResultEclSchemas(IConstWUResult &r, IArrayOf<IEspECLSchemaItem>& schemas);
-    void getResult(IConstWUResult &r, IArrayOf<IEspECLResult>& results, unsigned flags);
+    void getResult(IConstWUResult &r, IArrayOf<IEspECLResult>& results, unsigned long flags);
     void getStats(StatisticsFilter& filter, bool createDescriptions, IArrayOf<IEspWUStatisticItem>& statistics);
     void getStats(StatisticsFilter& filter, bool createDescriptions, IArrayOf<IEspWUStatisticItem>& statistics);
 
 
     void getWorkunitEclAgentLog(const char* eclAgentInstance, const char* agentPid, MemoryBuffer& buf);
     void getWorkunitEclAgentLog(const char* eclAgentInstance, const char* agentPid, MemoryBuffer& buf);
@@ -211,7 +214,7 @@ protected:
     unsigned getLegacyTotalThorTime();
     unsigned getLegacyTotalThorTime();
     bool hasSubGraphTimings();
     bool hasSubGraphTimings();
     bool legacyHasSubGraphTimings();
     bool legacyHasSubGraphTimings();
-    void legacyGetGraphTimingData(IArrayOf<IConstECLTimingData> &timingData, unsigned flags);
+    void legacyGetGraphTimingData(IArrayOf<IConstECLTimingData> &timingData);
 
 
 public:
 public:
     IEspContext &context;
     IEspContext &context;

+ 8 - 2
esp/services/ws_workunits/ws_workunitsService.cpp

@@ -1440,7 +1440,7 @@ bool CWsWorkunitsEx::onWUInfo(IEspContext &context, IEspWUInfoRequest &req, IEsp
                 ensureWsWorkunitAccess(context, wuid.str(), SecAccess_Read);
                 ensureWsWorkunitAccess(context, wuid.str(), SecAccess_Read);
                 PROGLOG("WUInfo: %s", wuid.str());
                 PROGLOG("WUInfo: %s", wuid.str());
 
 
-                unsigned flags=0;
+                unsigned long flags=0;
                 if (req.getTruncateEclTo64k())
                 if (req.getTruncateEclTo64k())
                     flags|=WUINFO_TruncateEclTo64k;
                     flags|=WUINFO_TruncateEclTo64k;
                 if (req.getIncludeExceptions())
                 if (req.getIncludeExceptions())
@@ -1469,6 +1469,12 @@ bool CWsWorkunitsEx::onWUInfo(IEspContext &context, IEspWUInfoRequest &req, IEsp
                     flags|=WUINFO_IncludeResultsViewNames;
                     flags|=WUINFO_IncludeResultsViewNames;
                 if (req.getIncludeResourceURLs())
                 if (req.getIncludeResourceURLs())
                     flags|=WUINFO_IncludeResourceURLs;
                     flags|=WUINFO_IncludeResourceURLs;
+                if (req.getIncludeECL())
+                    flags|=WUINFO_IncludeECL;
+                if (req.getIncludeHelpers())
+                    flags|=WUINFO_IncludeHelpers;
+                if (req.getIncludeAllowedClusters())
+                    flags|=WUINFO_IncludeAllowedClusters;
 
 
                 WsWuInfo winfo(context, wuid.str());
                 WsWuInfo winfo(context, wuid.str());
                 winfo.getInfo(resp.updateWorkunit(), flags);
                 winfo.getInfo(resp.updateWorkunit(), flags);
@@ -4004,7 +4010,7 @@ bool CWsWorkunitsEx::onWUGraphTiming(IEspContext &context, IEspWUGraphTimingRequ
 
 
         WsWuInfo winfo(context, cw);
         WsWuInfo winfo(context, cw);
         IArrayOf<IConstECLTimingData> timingData;
         IArrayOf<IConstECLTimingData> timingData;
-        winfo.getGraphTimingData(timingData, 0);
+        winfo.getGraphTimingData(timingData);
         resp.updateWorkunit().setTimingData(timingData);
         resp.updateWorkunit().setTimingData(timingData);
     }
     }
     catch(IException* e)
     catch(IException* e)