Ver código fonte

Merge pull request #9982 from afishbeck/eclRunNonexistFile

HPCC-17589 Improve parameter and workunit state checking in ecl-run

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 anos atrás
pai
commit
097f5acffd

+ 1 - 1
common/workunit/workunit.cpp

@@ -782,7 +782,7 @@ void setEnum(IPropertyTree *p, const char *propname, int value, const mapEnums *
 
 static int getEnum(const char *v, const mapEnums *map)
 {
-    if (v)
+    if (v && *v)
     {
         while (map->str)
         {

+ 2 - 2
ecl/eclcmd/eclcmd_common.cpp

@@ -743,9 +743,9 @@ bool EclCmdWithEclTarget::finalizeOptions(IProperties *globals)
         exit(1); //not really a usage error
     }
 
-    if ((optObj.type==eclObjSource || optObj.type==eclObjArchive) && optTargetCluster.isEmpty())
+    if ((optObj.type==eclObjSource || optObj.type==eclObjArchive || optObj.type==eclObjQuery) && optTargetCluster.isEmpty())
     {
-        fprintf(stderr, "\nTarget must be specified when source is ECL Source or Archive\n");
+        fprintf(stderr, "\nTarget and source must be specified for ECL file, Query, or Archive\n");
         return false;
     }
 

+ 6 - 1
ecl/eclcmd/eclcmd_core.cpp

@@ -807,6 +807,9 @@ public:
     {
         switch (state)
         {
+        case WUStateUnknown:
+        case WUStateArchived:
+        case WUStateAborting:
         case WUStateCompleted:
         case WUStateFailed:
         case WUStateAborted:
@@ -878,11 +881,13 @@ public:
         int ret = outputMultiExceptionsEx(resp->getExceptions());
 
         StringBuffer respwuid(resp->getWuid());
+        if (!respwuid.length()) //everything below requires workunit
+            return ret;
         if (optVerbose && respwuid.length() && !streq(wuid.str(), respwuid.str()))
             fprintf(stdout, "As %s\n", respwuid.str());
         WUState state = getWorkUnitState(resp->getState());
         if (optPoll && !isFinalState(state))
-            return pollForResults(client, wuid);
+            return pollForResults(client, respwuid);
 
         switch (state)
         {