瀏覽代碼

HPCC-12251 Create cassandra plugin for workunit storage

Rationalize the lightweight workunit info, and its use in the WUQuery service.

Remove unused "RoxieCluster" value and references to it.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 10 年之前
父節點
當前提交
50f58cd07a

+ 43 - 186
common/workunit/workunit.cpp

@@ -971,6 +971,18 @@ mapEnums states[] = {
    { WUStateSize, NULL }
 };
 
+mapEnums actions[] = {
+   { WUActionUnknown, "unknown" },
+   { WUActionCompile, "compile" },
+   { WUActionCheck, "check" },
+   { WUActionRun, "run" },
+   { WUActionExecuteExisting, "execute" },
+   { WUActionPause, "pause" },
+   { WUActionPauseNow, "pausenow" },
+   { WUActionResume, "resume" },
+   { WUActionSize, NULL },
+};
+
 const char * getWorkunitStateStr(WUState state)
 {
     dbgassertex(state < WUStateSize);
@@ -1039,9 +1051,11 @@ public:
         clusterName.set(p.queryProp("@clusterName"));
         timeScheduled.set(p.queryProp("@timeScheduled"));
         state = (WUState) getEnum(&p, "@state", states);
+        action = (WUAction) getEnum(&p, "Action", actions);
         wuscope.set(p.queryProp("@scope"));
+        appvalues.load(&p,"Application/*");
+        totalThorTime = p.getPropInt("@totalThorTime", 0);
         _isProtected = p.getPropBool("@protected", false);
-        _isAborting = false; // MORE - this one is tricky
     }
     virtual const char *queryWuid() const { return wuid.str(); }
     virtual const char *queryUser() const { return user.str(); }
@@ -1049,10 +1063,10 @@ public:
     virtual const char *queryClusterName() const { return clusterName.str(); }
     virtual const char *queryWuScope() const { return wuscope.str(); }
     virtual WUState getState() const { return state; }
-    virtual const char *queryStateDesc() const { return getEnumText(getState(), states); }
+    virtual const char *queryStateDesc() const { return getEnumText(state, states); }
+    virtual WUAction getAction() const { return action; }
+    virtual const char *queryActionDesc() const { return getEnumText(action, actions); }
     virtual bool isProtected() const { return _isProtected; }
-// Not sure about these ones...
-    virtual bool aborting() const { return _isAborting; }
     virtual IJlibDateTime & getTimeScheduled(IJlibDateTime & val) const
     {
         if (timeScheduled.length())
@@ -1060,11 +1074,15 @@ public:
         return val;
     }
 
+    virtual unsigned getTotalThorTime() const { return totalThorTime; };
+    virtual IConstWUAppValueIterator & getApplicationValues() const { return *new CArrayIteratorOf<IConstWUAppValue,IConstWUAppValueIterator> (appvalues, 0, (IConstWorkUnitInfo *) this); };
 protected:
     StringAttr wuid, user, jobName, clusterName, timeScheduled, wuscope;
+    mutable CachedTags<CLocalWUAppValue,IConstWUAppValue> appvalues;
+    unsigned totalThorTime;
     WUState state;
+    WUAction action;
     bool _isProtected;
-    bool _isAborting;
 };
 
 extern IConstWorkUnitInfo *createConstWorkUnitInfo(IPropertyTree &p)
@@ -1262,8 +1280,8 @@ public:
             { UNIMPLEMENTED; }
     virtual WUAction getAction() const
             { return c->getAction(); }
-    virtual IStringVal& getActionEx(IStringVal & str) const
-            { return c->getActionEx(str); }
+    virtual const char *queryActionDesc() const
+            { return c->queryActionDesc(); }
     virtual IStringVal & getApplicationValue(const char * application, const char * propname, IStringVal & str) const
             { return c->getApplicationValue(application, propname, str); }
     virtual int getApplicationValueInt(const char * application, const char * propname, int defVal) const
@@ -1354,8 +1372,6 @@ public:
             { return c->getQuery(); }
     virtual IConstWUWebServicesInfo * getWebServicesInfo() const
             { return c->getWebServicesInfo(); }
-    virtual IConstWURoxieQueryInfo* getRoxieQueryInfo() const
-        { return c->getRoxieQueryInfo(); }
     virtual bool getRescheduleFlag() const
             { return c->getRescheduleFlag(); }
     virtual IConstWUResult * getResultByName(const char * name) const
@@ -1450,6 +1466,8 @@ public:
             { return c->getProcesses(type); }
     virtual IPropertyTreeIterator* getProcesses(const char *type, const char *instance) const
             { return c->getProcesses(type, instance); }
+    virtual unsigned getTotalThorTime() const
+            { return c->getTotalThorTime(); }
 
     virtual void clearExceptions()
             { c->clearExceptions(); }
@@ -1535,8 +1553,6 @@ public:
             { return c->updateQuery(); }
     virtual IWUWebServicesInfo * updateWebServicesInfo(bool create)
         { return c->updateWebServicesInfo(create); }
-    virtual IWURoxieQueryInfo * updateRoxieQueryInfo(const char *wuid, const char *roxieClusterName)
-        { return c->updateRoxieQueryInfo(wuid, roxieClusterName); }
     virtual IWUPlugin * updatePluginByName(const char * name)
             { return c->updatePluginByName(name); }
     virtual IWULibrary * updateLibraryByName(const char * name)
@@ -1715,29 +1731,6 @@ public:
     virtual void        setWebServicesCRC(unsigned);
 };
 
-class CLocalWURoxieQueryInfo : public CInterface, implements IWURoxieQueryInfo
-{
-    Owned<IPropertyTree> p;
-    mutable CriticalSection crit;
-
-private:
-    
-public:
-    IMPLEMENT_IINTERFACE;
-    CLocalWURoxieQueryInfo(IPropertyTree *p);
-
-    virtual IStringVal& getQueryInfo(IStringVal &str) const;
-    virtual IStringVal& getDefaultPackageInfo(IStringVal &str) const;
-    virtual IStringVal& getRoxieClusterName(IStringVal &str) const;
-    virtual IStringVal& getWuid(IStringVal &str) const;
-
-    virtual void        setQueryInfo(const char *info); 
-    virtual void        setDefaultPackageInfo(const char *, int len);
-    virtual void        setRoxieClusterName(const char *str);
-    virtual void        setWuid(const char *str);
-
-};
-
 class CLocalWUResult : public CInterface, implements IWUResult
 {
     friend class CLocalWorkUnit;
@@ -2013,8 +2006,8 @@ mapEnums workunitSortFields[] =
    { WUSFwuid, "@" },
    { WUSFecl, "Query/Text" },
    { WUSFfileread, "FilesRead/File/@name" },
-   { WUSFroxiecluster, "RoxieQueryInfo/@roxieClusterName" },
-   { WUSFtotalthortime, "Statistics/Statistic[@c='summary'][@creator='thor'][@kind='TimeElapsed']/@value|"
+   { WUSFtotalthortime, "@totalClusterTime|"
+                        "Statistics/Statistic[@c='summary'][@creator='thor'][@kind='TimeElapsed']/@value|"
                         "Statistics/Statistic[@c='summary'][@creator='hthor'][@kind='TimeElapsed']/@value|"
                         "Statistics/Statistic[@c='summary'][@creator='roxie'][@kind='TimeElapsed']/@value|"
                         "Statistics/Statistic[@desc='Total thor time']/@value|"
@@ -3256,7 +3249,6 @@ void CLocalWorkUnit::clearCached(bool clearTree)
 {
     query.clear();
     webServicesInfo.clear();
-    roxieQueryInfo.clear();
     workflowIterator.clear();
     cachedGraphs.clear();
 
@@ -3818,6 +3810,12 @@ unsigned CLocalWorkUnit::getDebugAgentListenerPort() const
     return p->getPropInt("@DebugListenerPort", 0);
 }
 
+unsigned CLocalWorkUnit::getTotalThorTime() const
+{
+    CriticalBlock block(crit);
+    return p->getPropInt("@totalThorTime", 0);
+}
+
 void CLocalWorkUnit::setDebugAgentListenerPort(unsigned port)
 {
     CriticalBlock block(crit);
@@ -4169,18 +4167,6 @@ const char * CLocalWorkUnit::queryStateDesc() const
     }
 }
 
-mapEnums actions[] = {
-   { WUActionUnknown, "unknown" },
-   { WUActionCompile, "compile" },
-   { WUActionCheck, "check" },
-   { WUActionRun, "run" },
-   { WUActionExecuteExisting, "execute" },
-   { WUActionPause, "pause" },
-   { WUActionPauseNow, "pausenow" },
-   { WUActionResume, "resume" },
-   { WUActionSize, NULL },
-};
-
 void CLocalWorkUnit::setAction(WUAction value) 
 {
     CriticalBlock block(crit);
@@ -4193,11 +4179,10 @@ WUAction CLocalWorkUnit::getAction() const
     return (WUAction) getEnum(p, "Action", actions);
 }
 
-IStringVal& CLocalWorkUnit::getActionEx(IStringVal & str) const
+const char *CLocalWorkUnit::queryActionDesc() const
 {
     CriticalBlock block(crit);
-    str.set(p->queryProp("Action"));
-    return str;
+    return p->queryProp("Action");
 }
 
 IStringVal& CLocalWorkUnit::getApplicationValue(const char *app, const char *propname, IStringVal &str) const
@@ -5722,7 +5707,7 @@ void CLocalWorkUnit::setStatistic(StatisticCreatorType creatorType, const char *
         mergeAction = StatsMergeAppend;
     }
 
-    if (mergeAction != StatsMergeAppend)
+    if (mergeAction != StatsMergeAppend) // RKC->GH Is this right??
     {
         unsigned __int64 oldValue = statTree->getPropInt64("@value", 0);
         unsigned __int64 oldCount = statTree->getPropInt64("@count", 0);
@@ -5744,6 +5729,11 @@ void CLocalWorkUnit::setStatistic(StatisticCreatorType creatorType, const char *
         else
             statTree->removeProp("@max");
     }
+    if (creatorType==SCTsummary && scope==GLOBAL_SCOPE && kind==StTimeElapsed)
+    {
+        assertex(mergeAction==StatsMergeReplace);
+        p->setPropInt("@totalThorTime", (int) nanoToMilli(value));
+    }
 }
 
 void CLocalWorkUnit::_loadStatistics() const
@@ -5943,43 +5933,6 @@ IWUWebServicesInfo* CLocalWorkUnit::updateWebServicesInfo(bool create)
     return webServicesInfo.getLink();
 }
 
-IConstWURoxieQueryInfo* CLocalWorkUnit::getRoxieQueryInfo() const
-{
-    // For this to be legally called, we must have the read-able interface. So we are already locked for (at least) read.
-    CriticalBlock block(crit);
-    if (!roxieQueryInfoCached)
-    {
-        assertex(!roxieQueryInfo);
-        IPropertyTree *s = p->getPropTree("RoxieQueryInfo");
-        if (s)
-            roxieQueryInfo.setown(new CLocalWURoxieQueryInfo(s)); // NB takes ownership of 's'
-        roxieQueryInfoCached = true;
-    }
-    return roxieQueryInfo.getLink();
-}
-
-IWURoxieQueryInfo* CLocalWorkUnit::updateRoxieQueryInfo(const char *wuid, const char *roxieClusterName)
-{
-    // For this to be legally called, we must have the write-able interface. So we are already locked for write.
-    CriticalBlock block(crit);
-    if (!roxieQueryInfoCached)
-    {
-        IPropertyTree *s = p->queryPropTree("RoxieQueryInfo");
-        if (!s)
-            s = p->addPropTree("RoxieQueryInfo", createPTreeFromXMLString("<RoxieQueryInfo />"));
-        if (wuid && *wuid)
-            s->addProp("@wuid", wuid);
-
-        if (roxieClusterName && *roxieClusterName)
-            s->addProp("@roxieClusterName", roxieClusterName);
-
-        s->Link();
-        roxieQueryInfo.setown(new CLocalWURoxieQueryInfo(s)); 
-        roxieQueryInfoCached = true;
-    }
-    return roxieQueryInfo.getLink();
-}
-
 static int compareResults(IInterface * const *ll, IInterface * const *rr)
 {
     CLocalWUResult *l = (CLocalWUResult *) *ll;
@@ -7530,102 +7483,6 @@ void CLocalWUWebServicesInfo::setText(const char *name, const char *info)
     p->setProp(name, info);
 }
 
-
-//========================================================================================
-
-CLocalWURoxieQueryInfo::CLocalWURoxieQueryInfo(IPropertyTree *props) : p(props)
-{
-}
-
-IStringVal& CLocalWURoxieQueryInfo::getQueryInfo(IStringVal &str) const
-{
-    IPropertyTree *queryTree = p->queryPropTree("query");
-    if (queryTree)
-    {
-        StringBuffer temp;
-        toXML(queryTree, temp);
-        str.set(temp.str());
-    }
-
-    return str;
-}
-
-IStringVal& CLocalWURoxieQueryInfo::getDefaultPackageInfo(IStringVal &str) const
-{
-    MemoryBuffer mb;
-    p->getPropBin("RoxiePackages",mb);
-
-    if (mb.length())
-    {
-        unsigned len;
-        mb.read(len);
-        str.setLen((const char *) mb.readDirect(len), len);
-    }
-
-    return str;
-}
-
-IStringVal& CLocalWURoxieQueryInfo::getRoxieClusterName(IStringVal &str) const
-{
-    const char *val = p->queryProp("@roxieClusterName");
-    if (val)
-        str.set(val);
-    
-    return str;
-}
-
-IStringVal& CLocalWURoxieQueryInfo::getWuid(IStringVal &str) const
-{
-    const char *val = p->queryProp("@wuid");
-    if (val)
-        str.set(val);
-
-    return str;
-}
-
-
-void CLocalWURoxieQueryInfo::setQueryInfo(const char *info)
-{
-    IPropertyTree *queryTree = p->queryPropTree("query");
-    if (queryTree)
-        p->removeTree(queryTree);
-
-    IPropertyTree * tempTree = p->addPropTree("query", createPTreeFromXMLString(info));
-
-    if (!p->hasProp("@roxieClusterName"))
-    {
-        const char *roxieClusterName = tempTree->queryProp("@roxieName");
-        if (roxieClusterName && *roxieClusterName)
-            p->addProp("@roxieClusterName", roxieClusterName);
-    }
-
-    if (!p->hasProp("@wuid"))
-    {
-        const char *wuid = tempTree->queryProp("Query/@wuid");
-        if (wuid && *wuid)
-            p->addProp("@wuid", wuid);
-    }
-
-}
-
-void CLocalWURoxieQueryInfo::setDefaultPackageInfo(const char *info, int len)
-{
-    MemoryBuffer m;
-    serializeLPString(len, info, m);
-    p->setPropBin("RoxiePackages", m.length(), m.toByteArray());
-}
-
-void CLocalWURoxieQueryInfo::setRoxieClusterName(const char *info)
-{
-    p->setProp("@roxieClusterName", info);
-}
-
-void CLocalWURoxieQueryInfo::setWuid(const char *info)
-{
-    p->setProp("@wuid", info);
-}
-
-
 //========================================================================================
 
 CLocalWUResult::CLocalWUResult(IPropertyTree *props) : p(props)

+ 7 - 25
common/workunit/workunit.hpp

@@ -435,25 +435,6 @@ interface IWUWebServicesInfo : extends IConstWUWebServicesInfo
 };
 
 
-interface IConstWURoxieQueryInfo : extends IInterface
-{
-    virtual IStringVal & getQueryInfo(IStringVal & str) const = 0;
-    virtual IStringVal & getDefaultPackageInfo(IStringVal & str) const = 0;
-    virtual IStringVal & getRoxieClusterName(IStringVal & str) const = 0;
-    virtual IStringVal & getWuid(IStringVal & str) const = 0;
-};
-
-
-interface IWURoxieQueryInfo : extends IConstWURoxieQueryInfo
-{
-    virtual void setQueryInfo(const char * info) = 0;
-    virtual void setDefaultPackageInfo(const char * pstr, int len) = 0;
-    virtual void setRoxieClusterName(const char * name) = 0;
-    virtual void setWuid(const char * wuid) = 0;
-};
-
-
-
 //! IWUPlugin
 
 interface IConstWUPlugin : extends IInterface
@@ -983,8 +964,13 @@ interface IConstWorkUnitInfo : extends IInterface
     virtual const char *queryClusterName() const = 0;
     virtual WUState getState() const = 0;
     virtual const char *queryStateDesc() const = 0;
+    virtual WUAction getAction() const = 0;
+    virtual const char *queryActionDesc() const = 0;
     virtual bool isProtected() const = 0;
     virtual IJlibDateTime & getTimeScheduled(IJlibDateTime & val) const = 0;
+
+    virtual unsigned getTotalThorTime() const = 0;
+    virtual IConstWUAppValueIterator & getApplicationValues() const = 0;
 };
 
 interface IConstWorkUnit : extends IConstWorkUnitInfo
@@ -992,10 +978,8 @@ interface IConstWorkUnit : extends IConstWorkUnitInfo
     virtual bool aborting() const = 0;
     virtual void forceReload() = 0;
     virtual WUAction getAction() const = 0;
-    virtual IStringVal& getActionEx(IStringVal & str) const = 0;
     virtual IStringVal & getApplicationValue(const char * application, const char * propname, IStringVal & str) const = 0;
     virtual int getApplicationValueInt(const char * application, const char * propname, int defVal) const = 0;
-    virtual IConstWUAppValueIterator & getApplicationValues() const = 0;
     virtual bool hasWorkflow() const = 0;
     virtual unsigned queryEventScheduledCount() const = 0;
     virtual IPropertyTree * queryWorkflowTree() const = 0;
@@ -1038,7 +1022,6 @@ interface IConstWorkUnit : extends IConstWorkUnitInfo
     virtual IConstWUResultIterator & getTemporaries() const = 0;
     virtual bool getRunningGraph(IStringVal & graphName, WUGraphIDType & subId) const = 0;
     virtual IConstWUWebServicesInfo * getWebServicesInfo() const = 0;
-    virtual IConstWURoxieQueryInfo * getRoxieQueryInfo() const = 0;
     virtual IConstWUStatisticIterator & getStatistics(const IStatisticsFilter * filter) const = 0; // filter must currently stay alive while the iterator does.
     virtual IConstWUStatistic * getStatistic(const char * creator, const char * scope, StatisticKind kind) const = 0;
     virtual IConstWUResult * getVariableByName(const char * name) const = 0;
@@ -1103,7 +1086,7 @@ interface IWorkUnit : extends IConstWorkUnit
     virtual void setResultLimit(unsigned value) = 0;
     virtual void setSecurityToken(const char * value) = 0;
     virtual void setState(WUState state) = 0;
-    virtual void setStateEx(const char * text) = 0;
+    virtual void setStateEx(const char * text) = 0;  // Indicates why blocked
     virtual void setAgentSession(__int64 sessionId) = 0;
     virtual void setStatistic(StatisticCreatorType creatorType, const char * creator, StatisticScopeType scopeType, const char * scope, StatisticKind kind, const char * optDescription, unsigned __int64 value, unsigned __int64 count, unsigned __int64 maxValue, StatsMergeAction mergeAction) = 0;
     virtual void setTracingValue(const char * propname, const char * value) = 0;
@@ -1124,7 +1107,6 @@ interface IWorkUnit : extends IConstWorkUnit
     virtual IWUGraph * updateGraph(const char * name) = 0;
     virtual IWUQuery * updateQuery() = 0;
     virtual IWUWebServicesInfo * updateWebServicesInfo(bool create) = 0;
-    virtual IWURoxieQueryInfo * updateRoxieQueryInfo(const char * wuid, const char * roxieClusterName) = 0;
     virtual IWUPlugin * updatePluginByName(const char * name) = 0;
     virtual IWULibrary * updateLibraryByName(const char * name) = 0;
     virtual IWUResult * updateResultByName(const char * name) = 0;
@@ -1212,7 +1194,7 @@ enum WUSortField
     WUSFwuid = 6,
     WUSFwuidhigh = 7,
     WUSFfileread = 8,
-    WUSFroxiecluster = 9,
+    // WUSFroxiecluster = 9, obsolete
     WUSFprotected = 10,
     WUSFtotalthortime = 11,
     WUSFwildwuid = 12,

+ 3 - 4
common/workunit/workunit.ipp

@@ -169,7 +169,6 @@ protected:
     mutable CriticalSection crit;
     mutable Owned<IWUQuery> query;
     mutable Owned<IWUWebServicesInfo> webServicesInfo;
-    mutable Owned<IWURoxieQueryInfo> roxieQueryInfo;
     mutable Owned<IWorkflowItemIterator> workflowIterator;
     mutable bool workflowIteratorCached;
     mutable bool resultsCached;
@@ -214,7 +213,7 @@ public:
     virtual bool aborting() const;
     virtual void forceReload() {};
     virtual WUAction getAction() const;
-    virtual IStringVal& getActionEx(IStringVal & str) const;
+    virtual const char *queryActionDesc() const;
     virtual IStringVal & getApplicationValue(const char * application, const char * propname, IStringVal & str) const;
     virtual int getApplicationValueInt(const char * application, const char * propname, int defVal) const;
     virtual IConstWUAppValueIterator & getApplicationValues() const;
@@ -271,7 +270,6 @@ public:
     virtual IConstWUStatisticIterator & getStatistics(const IStatisticsFilter * filter) const;
     virtual IConstWUStatistic * getStatistic(const char * creator, const char * scope, StatisticKind kind) const;
     virtual IConstWUWebServicesInfo * getWebServicesInfo() const;
-    virtual IConstWURoxieQueryInfo * getRoxieQueryInfo() const;
     virtual IStringVal & getXmlParams(IStringVal & params, bool hidePasswords) const;
     virtual const IPropertyTree *getXmlParams() const;
     virtual unsigned __int64 getHash() const;
@@ -311,6 +309,7 @@ public:
     virtual IConstWULibrary * getLibraryByName(const char * name) const;
     virtual unsigned getDebugAgentListenerPort() const;
     virtual IStringVal & getDebugAgentListenerIP(IStringVal &ip) const;
+    virtual unsigned getTotalThorTime() const;
 
     void clearExceptions();
     void commit();
@@ -361,7 +360,7 @@ public:
     IWUGraph * updateGraph(const char * name);
     IWUQuery * updateQuery();
     IWUWebServicesInfo* updateWebServicesInfo(bool create);
-    IWURoxieQueryInfo* updateRoxieQueryInfo(const char *wuid, const char *roxieClusterName);
+
     IWUPlugin * updatePluginByName(const char * name);
     IWULibrary * updateLibraryByName(const char * name);
     virtual IWUResult * updateResultByName(const char * name);

+ 1 - 5
dali/sasha/saarch.cpp

@@ -96,7 +96,6 @@ void WUiterate(ISashaCommand *cmd, const char *mask)
     const char *priority = cmd->queryPriority();
     const char *fileread = cmd->queryFileRead();
     const char *filewritten = cmd->queryFileWritten();
-    const char *roxiecluster = cmd->queryRoxieCluster();
     const char *eclcontains = cmd->queryEclContains();
     const char *cmdname = cmd->queryDfuCmdName();
     unsigned start = cmd->getStart(); 
@@ -189,9 +188,8 @@ void WUiterate(ISashaCommand *cmd, const char *mask)
                                 bool haspriority = priority&&*priority;
                                 bool hasfileread = fileread&&*fileread;
                                 bool hasfilewritten = filewritten&&*filewritten;
-                                bool hasroxiecluster = roxiecluster&&*roxiecluster;
                                 bool haseclcontains = eclcontains&&*eclcontains;
-                                if ((cmd->getAction()==SCA_GET)||haswusoutput||hasowner||hasstate||hascluster||hasjobname||hascommand||(hasoutput&&inrange)||haspriority||hasfileread||hasfilewritten||hasroxiecluster||haseclcontains) {
+                                if ((cmd->getAction()==SCA_GET)||haswusoutput||hasowner||hasstate||hascluster||hasjobname||hascommand||(hasoutput&&inrange)||haspriority||hasfileread||hasfilewritten||haseclcontains) {
                                     try {
                                         t.setown(createPTree(di2->query()));
                                         if (!t)
@@ -212,8 +210,6 @@ void WUiterate(ISashaCommand *cmd, const char *mask)
                                             continue;
                                         if (hasfilewritten&&!t->hasProp(tmppath.clear().appendf("Files/File[@name=~?\"%s\"]",filewritten).str()))
                                             continue;
-                                        if (hasroxiecluster&&!t->hasProp(tmppath.clear().appendf("RoxieQueryInfo[@roxieClusterName=~?\"%s\"]",roxiecluster).str()))
-                                            continue;
                                         if (haseclcontains&&!t->hasProp(tmppath.clear().appendf("Query[Text=~?\"*%s*\"]",eclcontains).str()))
                                             continue;
                                     }

+ 0 - 2
dali/sasha/sacmd.hpp

@@ -78,8 +78,6 @@ interface ISashaCommand: extends IInterface
     virtual const char *queryFileRead() = 0;
     virtual void setFileWritten(const char *val) = 0;
     virtual const char *queryFileWritten() = 0;
-    virtual void setRoxieCluster(const char *val) = 0;
-    virtual const char *queryRoxieCluster() = 0;
     virtual void setEclContains(const char *val) = 0;
     virtual const char *queryEclContains() = 0;
     virtual bool WUSreply() = 0;    // if only one byte is WUSstatus

+ 2 - 2
esp/scm/ws_workunits.ecm

@@ -334,7 +334,7 @@ ESPresponse [exceptions_inline] WUDeployWorkunitResponse
 ESPrequest [nil_remove] WUQueryRequest
 {
     string Wuid;
-    [min_ver("1.01")] string Type;  //archieved or non-archieved
+    [min_ver("1.01")] string Type;  //archived or non-archived
     string Cluster;
     [min_ver("1.08")] string RoxieCluster;
     string Owner;
@@ -367,7 +367,7 @@ ESPrequest [nil_remove] WUQueryRequest
 
 ESPresponse [nil_remove, exceptions_inline] WUQueryResponse
 {
-    [min_ver("1.01")] string Type("");  //archieved or non-archieved
+    [min_ver("1.01")] string Type("");  //archived or non-archived
     string Cluster;
     [min_ver("1.08")] string RoxieCluster;
     string Owner;

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

@@ -614,7 +614,6 @@ void WsWuInfo::getApplicationValues(IEspECLWorkunit &info, unsigned flags)
 
             Owned<IEspApplicationValue> t= createApplicationValue("","");
             t->setApplication(val.getApplication(buf).str());
-            t->setValue(val.getValue(buf).str());
             t->setName(val.getName(buf).str());
             t->setValue(val.getValue(buf).str());
             av.append(*t.getLink());
@@ -871,22 +870,6 @@ void WsWuInfo::legacyGetGraphTimingData(IArrayOf<IConstECLTimingData> &timingDat
     }
 }
 
-
-
-void WsWuInfo::getRoxieCluster(IEspECLWorkunit &info, unsigned flags)
-{
-    if (version > 1.06)
-    {
-        Owned<IConstWURoxieQueryInfo> roxieQueryInfo = cw->getRoxieQueryInfo();
-        if (roxieQueryInfo)
-        {
-            SCMStringBuffer roxieClusterName;
-            roxieQueryInfo->getRoxieClusterName(roxieClusterName);
-            info.setRoxieCluster(roxieClusterName.str());
-        }
-    }
-}
-
 void WsWuInfo::getEventScheduleFlag(IEspECLWorkunit &info)
 {
     info.setEventSchedule(0);
@@ -1005,8 +988,6 @@ void WsWuInfo::getCommon(IEspECLWorkunit &info, unsigned flags)
     cw->getTimeScheduled(dt);
     if(dt.isValid())
         info.setDateTimeScheduled(dt.getString(s).str());
-
-    getRoxieCluster(info, flags);
 }
 
 void WsWuInfo::getInfo(IEspECLWorkunit &info, unsigned flags)
@@ -1022,7 +1003,7 @@ void WsWuInfo::getInfo(IEspECLWorkunit &info, unsigned flags)
     info.setPriorityLevel(cw->getPriorityLevel());
     if (context.querySecManager())
         info.setScope(cw->queryWuScope());
-    info.setActionEx(cw->getActionEx(s).str());
+    info.setActionEx(cw->queryActionDesc());
     info.setDescription(cw->getDebugValue("description", s).str());
     if (version > 1.21)
         info.setXmlParams(cw->getXmlParams(s, true).str());

+ 0 - 1
esp/services/ws_workunits/ws_workunitsHelpers.hpp

@@ -166,7 +166,6 @@ public:
     void getGraphTimingData(IArrayOf<IConstECLTimingData> &timingData, unsigned flags);
     bool getFileSize(const char* fileName, const char* IPAddress, offset_t& fileSize);
 
-    void getRoxieCluster(IEspECLWorkunit &info, unsigned flags);
     void getWorkflow(IEspECLWorkunit &info, unsigned flags);
 
     void getHelpFiles(IConstWUQuery* query, WUFileType type, IArrayOf<IEspECLHelpFile>& helpers);

+ 40 - 15
esp/services/ws_workunits/ws_workunitsService.cpp

@@ -1728,8 +1728,6 @@ void doWUQueryWithSort(IEspContext &context, IEspWUQueryRequest & req, IEspWUQue
             sortorder = WUSFjob;
         else if (strieq(sortby, "Cluster"))
             sortorder = WUSFcluster;
-        else if (strieq(sortby, "RoxieCluster"))
-            sortorder = WUSFroxiecluster;
         else if (strieq(sortby, "Protected"))
             sortorder = WUSFprotected;
         else if (strieq(sortby, "State"))
@@ -1763,8 +1761,6 @@ void doWUQueryWithSort(IEspContext &context, IEspWUQueryRequest & req, IEspWUQue
 
     addWUQueryFilter(filters, filterCount, filterbuf, req.getWuid(), WUSFwildwuid);
     addWUQueryFilter(filters, filterCount, filterbuf, req.getCluster(), WUSFcluster);
-    if(version > 1.07)
-        addWUQueryFilter(filters, filterCount, filterbuf, req.getRoxieCluster(), WUSFroxiecluster);
     addWUQueryFilter(filters, filterCount, filterbuf, req.getLogicalFile(), (WUSortField) (WUSFfileread | WUSFnocase));
     addWUQueryFilter(filters, filterCount, filterbuf, req.getOwner(), (WUSortField) (WUSFuser | WUSFnocase));
     addWUQueryFilter(filters, filterCount, filterbuf, req.getJobname(), (WUSortField) (WUSFjob | WUSFnocase));
@@ -1812,18 +1808,49 @@ void doWUQueryWithSort(IEspContext &context, IEspWUQueryRequest & req, IEspWUQue
             continue;
         }
 
-        const char* wuid = cw.queryWuid();
-        if (!looksLikeAWuid(wuid, 'W'))
-        {
-            numWUs--;
-            continue;
-        }
         actualCount++;
         Owned<IEspECLWorkunit> info = createECLWorkunit("","");
-        WsWuInfo winfo(context, wuid);
-        winfo.getCommon(*info, 0);
+        info->setWuid(cw.queryWuid());
+        info->setProtected(cw.isProtected() ? 1 : 0);
+        info->setJobname(cw.queryJobName());
+        info->setOwner(cw.queryUser());
+        info->setCluster(cw.queryClusterName());
+        SCMStringBuffer s;
+        // info.setSnapshot(cw->getSnapshot(s).str());
+        info->setStateID(cw.getState());
+        info->setState(cw.queryStateDesc());
+        unsigned totalThorTimeMS = cw.getTotalThorTime();
+        StringBuffer totalThorTimeStr;
+        formatDuration(totalThorTimeStr, totalThorTimeMS);
+        if (version > 1.52)
+            info->setTotalClusterTime(totalThorTimeStr.str());
+        else
+            info->setTotalThorTime(totalThorTimeStr.str());
+        //if (cw->isPausing())
+        //    info.setIsPausing(true);
+        // getEventScheduleFlag(info);
+        WsWuDateTime dt;
+        cw.getTimeScheduled(dt);
+        if(dt.isValid())
+            info->setDateTimeScheduled(dt.getString(s).str());
         if (version >= 1.55)
-            winfo.getApplicationValues(*info, WUINFO_IncludeApplicationValues);
+        {
+            IArrayOf<IEspApplicationValue> av;
+            Owned<IConstWUAppValueIterator> app(&cw.getApplicationValues());
+            ForEach(*app)
+            {
+                IConstWUAppValue& val=app->query();
+                SCMStringBuffer buf;
+
+                Owned<IEspApplicationValue> t= createApplicationValue("","");
+                t->setApplication(val.getApplication(buf).str());
+                t->setName(val.getName(buf).str());
+                t->setValue(val.getValue(buf).str());
+                av.append(*t.getLink());
+
+            }
+            info->setApplicationValues(av);
+        }
         results.append(*info.getClear());
     }
 
@@ -2166,8 +2193,6 @@ bool CWsWorkunitsEx::onWUQuery(IEspContext &context, IEspWUQueryRequest & req, I
         StringBuffer basicQuery;
         addToQueryString(basicQuery, "State", req.getState());
         addToQueryString(basicQuery, "Cluster", req.getCluster());
-        if (version > 1.07)
-            addToQueryString(basicQuery, "RoxieCluster", req.getRoxieCluster());
         addToQueryString(basicQuery, "Owner", req.getOwner());
         addToQueryString(basicQuery, "StartDate", req.getStartDate());
         addToQueryString(basicQuery, "EndDate", req.getEndDate());

+ 23 - 8
plugins/cassandra/cassandraembed.cpp

@@ -3095,13 +3095,18 @@ static const CassandraXmlMapping workunitsMappings [] =
     {"clustername", "text", "@clusterName", stringColumnMapper},
     {"jobname", "text", "@jobName", stringColumnMapper},
     {"priorityclass", "text", "@priorityClass", stringColumnMapper},
-    {"protected", "boolean", "@protected", boolColumnMapper},
     {"wuScope", "text", "@scope", stringColumnMapper},
     {"submitID", "text", "@submitID", stringColumnMapper},
     {"state", "text", "@state", stringColumnMapper},
 
+    {"action", "text", "Action", stringColumnMapper},
+    {"protected", "boolean", "@protected", boolColumnMapper},
+    {"scheduled", "text", "@timeScheduled", stringColumnMapper},   // Should store as a date?
+    {"totalThorTime", "int", "@totalThorTime", intColumnMapper},
+    {"appvalues", "map<text, text>", "@Application@", subTreeMapColumnMapper}, // MORE - change to a custom map to make searchable
+
     {"debug", "map<text, text>", "Debug", simpleMapColumnMapper},
-    {"attributes", "map<text, text>", "@wuid@clusterName@jobName@priorityClass@protected@scope@submitID@state@", attributeMapColumnMapper},  // name is the suppression list, note trailing @
+    {"attributes", "map<text, text>", "@wuid@clusterName@jobName@priorityClass@protected@scope@submitID@state@timeScheduled@totalThorTime@", attributeMapColumnMapper},  // name is the suppression list, note trailing @
     {"graphs", "map<text, text>", "Graphs", graphMapColumnMapper}, // MORE - make me lazy...
     {"plugins", "list<text>", "Plugins", pluginListColumnMapper},
     {"query", "text", "Query/Text", queryTextColumnMapper},        // MORE - make me lazy...
@@ -3111,8 +3116,8 @@ static const CassandraXmlMapping workunitsMappings [] =
 
     // These are catchalls for anything not processed above or in a child table
 
-    {"elements", "map<text, text>", "@Debug@Exceptions@Graphs@Results@Statistics@Plugins@Query@Variables@Temporaries@Workflow@", elementMapColumnMapper},  // name is the suppression list, note trailing @
-    {"subtrees", "map<text, text>", "@Application@Process@Tracing@", subTreeMapColumnMapper},  // name is the INCLUSION list, note trailing @
+    {"elements", "map<text, text>", "@Action@Application@Debug@Exceptions@Graphs@Results@Statistics@Plugins@Query@Variables@Temporaries@Workflow@", elementMapColumnMapper},  // name is the suppression list, note trailing @
+    {"subtrees", "map<text, text>", "@Process@Tracing@", subTreeMapColumnMapper},  // name is the INCLUSION list, note trailing @
 
     { NULL, "workunits", "((partition), wuid)|CLUSTERING ORDER BY (wuid DESC)", stringColumnMapper}
 };
@@ -3124,10 +3129,15 @@ static const CassandraXmlMapping workunitInfoMappings [] =  // A cut down versio
     {"clustername", "text", "@clusterName", stringColumnMapper},
     {"jobname", "text", "@jobName", stringColumnMapper},
     {"priorityclass", "text", "@priorityClass", stringColumnMapper},
-    {"protected", "boolean", "@protected", boolColumnMapper},
     {"wuScope", "text", "@scope", stringColumnMapper},
     {"submitID", "text", "@submitID", stringColumnMapper},
     {"state", "text", "@state", stringColumnMapper},
+
+    {"action", "text", "Action", stringColumnMapper},
+    {"protected", "boolean", "@protected", boolColumnMapper},
+    {"scheduled", "text", "@timeScheduled", stringColumnMapper},   // Should store as a date?
+    {"totalThorTime", "int", "@totalThorTime", intColumnMapper},
+    {"appvalues", "map<text, text>", "@Application@", subTreeMapColumnMapper}, // MORE - change to a custom map to make searchable
     { NULL, "workunits", "((partition), wuid)|CLUSTERING ORDER BY (wuid DESC)", stringColumnMapper}
 };
 
@@ -3142,14 +3152,19 @@ static const CassandraXmlMapping searchMappings [] =
     {"clustername", "text", "@clusterName", stringColumnMapper},
     {"jobname", "text", "@jobName", stringColumnMapper},
     {"priorityclass", "text", "@priorityClass", stringColumnMapper},
-    {"protected", "boolean", "@protected", boolColumnMapper},
     {"scope", "text", "@scope", stringColumnMapper},
     {"submitID", "text", "@submitID", stringColumnMapper},
     {"state", "text", "@state", stringColumnMapper},
-    { NULL, "workunitsSearch", "((xpath, fieldPrefix), fieldValue, wuid)", stringColumnMapper}
+
+    {"action", "text", "Action", stringColumnMapper},
+    {"protected", "boolean", "@protected", boolColumnMapper},
+    {"scheduled", "text", "@timeScheduled", stringColumnMapper},   // Should store as a date?
+    {"totalThorTime", "int", "@totalThorTime", intColumnMapper},
+    {"appvalues", "map<text, text>", "@Application@", subTreeMapColumnMapper}, // MORE - change to a custom map to make searchable
+{ NULL, "workunitsSearch", "((xpath, fieldPrefix), fieldValue, wuid)", stringColumnMapper}
 };
 
-// The fields we can search by. These presently match the fields in the basic workunit info that is returned from a search, though there's no technical reason why they have to...
+// The fields we can search by. These are a subset of the fields in the basic workunit info that is returned from a search
 
 const char * searchPaths[] = { "@submitID", "@clusterName", "@jobName", "@priorityClass", "@protected", "@scope", "@state", NULL};
 

+ 2 - 7
plugins/workunitservices/workunitservices.cpp

@@ -355,7 +355,6 @@ public:
                     const char *priority,
                     const char *fileread,
                     const char *filewritten,
-                    const char *roxiecluster,
                     const char *ecl
 
     ) : user(_user), namelo(_namelo), namehi(_namehi)
@@ -391,8 +390,6 @@ public:
             query.appendf("[FilesRead/File/@name=~?\"%s\"]",fileread);
         if (filewritten&&*filewritten) 
             query.appendf("[Files/File/@name=~?\"%s\"]",filewritten);
-        if (roxiecluster&&*roxiecluster) 
-            query.appendf("[RoxieQueryInfo/@roxieClusterName=~?\"%s\"]",roxiecluster);
         if (ecl&&*ecl)
             query.appendf("[Query/Text=?~\"*%s*\"]",ecl);
         conn.setown(querySDS().connect("WorkUnits", myProcessSession(), 0, SDS_LOCK_TIMEOUT));
@@ -507,7 +504,7 @@ WORKUNITSERVICES_API void wsWorkunitList(
     const char *priority,
     const char *fileread,
     const char *filewritten,
-    const char *roxiecluster,
+    const char *roxiecluster,  // Not in use - retained for compatibility only
     const char *eclcontains,
     bool online,
     bool archived 
@@ -541,8 +538,6 @@ WORKUNITSERVICES_API void wsWorkunitList(
                 cmd->setFileRead(fileread);
             if (filewritten&&*filewritten)
                 cmd->setFileWritten(filewritten);
-            if (roxiecluster&&*roxiecluster)
-                cmd->setRoxieCluster(roxiecluster);
             if (eclcontains&&*eclcontains)
                 cmd->setEclContains(eclcontains);
             Owned<INode> sashanode = createINode(sashaeps.item(i));
@@ -562,7 +557,7 @@ WORKUNITSERVICES_API void wsWorkunitList(
         }
     }
     if (online) {
-        Owned<COnlineWorkunitIterator> oniter = new COnlineWorkunitIterator(ctx->queryUserDescriptor(),lowwuid,highwuid,username,cluster,jobname,state,priority,fileread,filewritten,roxiecluster,eclcontains);
+        Owned<COnlineWorkunitIterator> oniter = new COnlineWorkunitIterator(ctx->queryUserDescriptor(),lowwuid,highwuid,username,cluster,jobname,state,priority,fileread,filewritten,eclcontains);
         ForEach(*oniter) {
             if (!oniter->serialize(mb)) 
                 throw MakeStringException(-1,"WORKUNITSERVICES: Result buffer overflowed");

+ 1 - 1
plugins/workunitservices/workunitservices.ipp

@@ -71,7 +71,7 @@ inline bool serializeWUSrow(IPropertyTree &pt,MemoryBuffer &mb, bool isonline)
     fixedAppend(mb,24,pt.queryName());
     varAppend(mb,64,pt,"@submitID");
     varAppend(mb,64,pt,"@clusterName");
-    varAppend(mb,64,pt,"RoxieQueryInfo/@roxieClusterName");
+    varAppend(mb,64,pt,"RoxieQueryInfo/@roxieClusterName"); // No longer likely to be present but retain for compatibility (for now - this needs rewriting to not hit dali directly anyway!)
     varAppend(mb,256,pt,"@jobName");
     fixedAppend(mb,10,pt,"@state");
     fixedAppend(mb,7,pt,"@priorityClass");