Browse Source

Merge pull request #6641 from ghalliday/issue12573

HPCC-12573 Report a more helpful error message running an uncompiled wu

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 10 years ago
parent
commit
86a17c172a
4 changed files with 16 additions and 0 deletions
  1. 2 0
      ecl/eclagent/eclagent.cpp
  2. 11 0
      roxie/ccd/ccdquery.cpp
  3. 1 0
      roxie/roxie/roxie.hpp
  4. 2 0
      thorlcr/master/thgraphmanager.cpp

+ 2 - 0
ecl/eclagent/eclagent.cpp

@@ -1824,6 +1824,8 @@ void EclAgent::doProcess()
                 w->addProcess("EclAgent", agentTopology->queryProp("@name"), GetCurrentProcessId(), logname.str());
 
             eclccCodeVersion = w->getCodeVersion();
+            if (eclccCodeVersion == 0)
+                throw makeStringException(0, "Attempting to execute a workunit that hasn't been compiled");
             if (checkVersion && ((eclccCodeVersion > ACTIVITY_INTERFACE_VERSION) || (eclccCodeVersion < MIN_ACTIVITY_INTERFACE_VERSION)))
                 failv(0, "Workunit was compiled for eclagent interface version %d, this eclagent requires version %d..%d", eclccCodeVersion, MIN_ACTIVITY_INTERFACE_VERSION, ACTIVITY_INTERFACE_VERSION);
             if(noRetry && (w->getState() == WUStateFailed))

+ 11 - 0
roxie/ccd/ccdquery.cpp

@@ -124,6 +124,15 @@ public:
         SCMStringBuffer dllName;
         Owned<IConstWUQuery> q = wu->getQuery();
         q->getQueryDllName(dllName);
+        if (dllName.length() == 0)
+        {
+            SCMStringBuffer wuid;
+            wu->getWuid(wuid);
+            if (wu->getCodeVersion() == 0)
+                throw makeStringExceptionV(ROXIE_MISSING_DLL, "Attempting to load workunit %s that hasn't been compiled", wuid.str());
+            else
+                throw makeStringExceptionV(ROXIE_MISSING_DLL, "Attempting to load workunit %s with no associated dll", wuid.str());
+        }
         return getQueryDll(dllName.str(), false);
     }
     virtual HelperFactory *getFactory(const char *helperName) const
@@ -1608,6 +1617,8 @@ static void checkWorkunitVersionConsistency(const IQueryDll *dll)
 {
     assertex(dll->queryWorkUnit());
     unsigned wuVersion = dll->queryWorkUnit()->getCodeVersion();
+    if (wuVersion == 0)
+        throw makeStringException(ROXIE_MISMATCH, "Attempting to execute a workunit that hasn't been compiled");
     if (wuVersion > ACTIVITY_INTERFACE_VERSION || wuVersion < MIN_ACTIVITY_INTERFACE_VERSION)
         throw MakeStringException(ROXIE_MISMATCH, "Workunit was compiled for eclhelper interface version %d, this roxie requires version %d..%d", wuVersion, MIN_ACTIVITY_INTERFACE_VERSION, ACTIVITY_INTERFACE_VERSION);
 

+ 1 - 0
roxie/roxie/roxie.hpp

@@ -83,6 +83,7 @@
 #define ROXIE_CLIENT_CLOSED         ROXIE_ERROR_START+61
 #define ROXIE_ABORT_ERROR           ROXIE_ERROR_START+62
 #define ROXIE_OPT_REPORTING         ROXIE_ERROR_START+63
+#define ROXIE_MISSING_DLL           ROXIE_ERROR_START+64
 
 
 

+ 2 - 0
thorlcr/master/thgraphmanager.cpp

@@ -500,6 +500,8 @@ void CJobManager::run()
             workunit.setown(factory->openWorkUnit(wuid, false));
             if (!workunit) // check workunit is available and ready to run.
                 throw MakeStringException(0, "Could not locate workunit %s", wuid);
+            if (workunit->getCodeVersion() == 0)
+                throw makeStringException(0, "Attempting to execute a workunit that hasn't been compiled");
             if ((workunit->getCodeVersion() > ACTIVITY_INTERFACE_VERSION) || (workunit->getCodeVersion() < MIN_ACTIVITY_INTERFACE_VERSION))
                 throw MakeStringException(0, "Workunit was compiled for eclagent interface version %d, this thor requires version %d..%d", workunit->getCodeVersion(), MIN_ACTIVITY_INTERFACE_VERSION, ACTIVITY_INTERFACE_VERSION);
             allDone = doit(workunit, graphName, agentep);