Browse Source

HPCC-27172 Update WUInfo & WUQuery to return compile costs

Signed-off-by: Shamser Ahmed <shamser.ahmed@lexisnexis.com>
Shamser Ahmed 3 years ago
parent
commit
4ad0b0fcb3

+ 13 - 0
common/workunit/workunit.cpp

@@ -3662,6 +3662,7 @@ public:
 
         costExecute = p.getPropInt64("@costExecute");
         costFileAccess = p.getPropInt64("@costFileAccess");
+        costCompile = p.getPropInt64("@costCompile");
     }
     virtual const char *queryWuid() const { return wuid.str(); }
     virtual const char *queryUser() const { return user.str(); }
@@ -3678,6 +3679,7 @@ public:
     virtual bool isProtected() const { return _isProtected; }
     virtual cost_type getExecuteCost() const { return costExecute; }
     virtual cost_type getFileAccessCost() const { return costFileAccess; }
+    virtual cost_type getCompileCost() const { return costCompile; }
     virtual IJlibDateTime & getTimeScheduled(IJlibDateTime & val) const
     {
         if (timeScheduled.length())
@@ -3698,6 +3700,7 @@ protected:
     bool _isProtected;
     unsigned __int64 costExecute;
     unsigned __int64 costFileAccess;
+    unsigned __int64 costCompile;
 };
 
 extern IConstWorkUnitInfo *createConstWorkUnitInfo(IPropertyTree &p)
@@ -4353,6 +4356,8 @@ public:
             { return c->getExecuteCost(); }
     virtual cost_type getFileAccessCost() const
             { return c->getFileAccessCost(); }
+    virtual cost_type getCompileCost() const
+            { return c->getCompileCost(); }
     virtual void import(IPropertyTree *wuTree, IPropertyTree *graphProgressTree)
             { return c->import(wuTree, graphProgressTree); }
 
@@ -8669,6 +8674,8 @@ void CLocalWorkUnit::setStatistic(StatisticCreatorType creatorType, const char *
         else if (kind == StCostFileAccess)
             p->setPropInt64("@costFileAccess", value);
     }
+    if (kind == StCostCompile)
+        p->setPropInt64("@costCompile", value);
 }
 
 void CLocalWorkUnit::_loadStatistics() const
@@ -12330,6 +12337,12 @@ cost_type CLocalWorkUnit::getFileAccessCost() const
     return p->getPropInt64("@costFileAccess");
 }
 
+cost_type CLocalWorkUnit::getCompileCost() const
+{
+    CriticalBlock block(crit);
+    return p->getPropInt64("@costCompile");
+}
+
 #if 0
 void testConstWorkflow(IConstWorkflowItem * cwf, bool * okay, bool * dep)
 {

+ 2 - 0
common/workunit/workunit.hpp

@@ -1193,6 +1193,7 @@ interface IConstWorkUnitInfo : extends IInterface
     virtual bool isProtected() const = 0;
     virtual cost_type getExecuteCost() const = 0;
     virtual cost_type getFileAccessCost() const = 0;
+    virtual cost_type getCompileCost() const = 0;
     virtual IJlibDateTime & getTimeScheduled(IJlibDateTime & val) const = 0;
 
     virtual unsigned getTotalThorTime() const = 0;
@@ -1304,6 +1305,7 @@ interface IConstWorkUnit : extends IConstWorkUnitInfo
     virtual unsigned __int64 getAbortTimeStamp() const = 0;
     virtual cost_type getExecuteCost() const = 0;
     virtual cost_type getFileAccessCost() const = 0;
+    virtual cost_type getCompileCost() const = 0;
 };
 
 

+ 1 - 0
common/workunit/workunit.ipp

@@ -308,6 +308,7 @@ public:
     virtual unsigned __int64 getAbortTimeStamp() const;
     virtual cost_type getExecuteCost() const;
     virtual cost_type getFileAccessCost() const;
+    virtual cost_type getCompileCost() const;
     void clearExceptions(const char *source=nullptr);
     void commit();
     IWUException *createException();

+ 1 - 1
esp/scm/ws_workunits.ecm

@@ -25,7 +25,7 @@ EspInclude(ws_workunits_queryset_req_resp);
 
 ESPservice [
     auth_feature("DEFERRED"), //This declares that the method logic handles feature level authorization
-    version("1.86"), default_client_version("1.86"), cache_group("ESPWsWUs"),
+    version("1.87"), default_client_version("1.87"), cache_group("ESPWsWUs"),
     noforms,exceptions_inline("./smc_xslt/exceptions.xslt"),use_method_name] WsWorkunits
 {
     ESPmethod [cache_seconds(60), resp_xsl_default("/esp/xslt/workunits.xslt")]     WUQuery(WUQueryRequest, WUQueryResponse);

+ 1 - 0
esp/scm/ws_workunits_struct.ecm

@@ -441,6 +441,7 @@ ESPStruct [nil_remove] ECLWorkunit
     [min_ver("1.78")] ESParray<string> ServiceNames;
     [min_ver("1.84")] double ExecuteCost;
     [min_ver("1.85")] double FileAccessCost;
+    [min_ver("1.87")] double CompileCost;
 };
 
 ESPStruct [nil_remove] WUECLAttribute

+ 4 - 1
esp/services/ws_workunits/ws_workunitsHelpers.cpp

@@ -998,6 +998,8 @@ void WsWuInfo::getCommon(IEspECLWorkunit &info, unsigned long flags)
         info.setExecuteCost(cost_type2money(cw->getExecuteCost()));
     if (version>=1.85)
         info.setFileAccessCost(cost_type2money(cw->getFileAccessCost()));
+    if (version>=1.87)
+        info.setCompileCost(cost_type2money(cw->getCompileCost()));
 }
 
 void WsWuInfo::setWUAbortTime(IEspECLWorkunit &info, unsigned __int64 abortTS)
@@ -1057,7 +1059,8 @@ void WsWuInfo::getInfo(IEspECLWorkunit &info, unsigned long flags)
         info.setExecuteCost(cost_type2money(cw->getExecuteCost()));
     if(version>=1.85)
         info.setFileAccessCost(cost_type2money(cw->getFileAccessCost()));
-
+    if (version>=1.87)
+        info.setCompileCost(cost_type2money(cw->getCompileCost()));
     getClusterInfo(info, flags);
     getExceptions(info, flags);
     getHelpers(info, flags);

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

@@ -1987,6 +1987,8 @@ void doWUQueryWithSort(IEspContext &context, IEspWUQueryRequest & req, IEspWUQue
             info->setExecuteCost(cost_type2money(cw.getExecuteCost()));
         if (version>=1.85)
             info->setFileAccessCost(cost_type2money(cw.getFileAccessCost()));
+        if (version>=1.87)
+            info->setCompileCost(cost_type2money(cw.getCompileCost()));
         results.append(*info.getClear());
     }