IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 11, 2011, 4:29:48 PM (15 years ago)
Author:
watersc1
Message:

Trying to merge back into trunk.

Location:
branches/czw_branch/20101203
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20101203

  • branches/czw_branch/20101203/ippTools/src/disttool.c

    r29067 r30586  
    857857    psFree(where);
    858858
     859    psStringAppend(&query, "\nORDER BY priority DESC, dist_id");
     860
    859861    // treat limit == 0 as "no limit"
    860862    if (limit) {
  • branches/czw_branch/20101203/ippTools/src/dqstatstool.c

    r28427 r30586  
    9292  }
    9393  else {
    94     psStringAppend(&query, " AND (invalid IS NULL OR invalid = 1) ");
     94    psStringAppend(&query, " AND (warp_id IS NOT NULL AND invalid IS NULL) ");
    9595  }
    9696
     
    402402
    403403    if (psMetadataLookupStr(&status,enginedef,"COLNAME")&&
    404         isfinite(psMetadataLookupF32(&status,enginedef,"MINIMUM"))&&
    405         isfinite(psMetadataLookupF32(&status,enginedef,"MAXIMUM"))) {
     404        (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"STRICT") == 0)&&
     405        (isfinite(psMetadataLookupF32(&status,enginedef,"MINIMUM"))&&
     406         isfinite(psMetadataLookupF32(&status,enginedef,"MAXIMUM")))) {
    406407      psArrayAdd(decisionRules,decisionRules->n,enginedef);
     408    }
     409    else if (psMetadataLookupStr(&status,enginedef,"COLNAME")&&
     410             (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"CDF") == 0)&&
     411             (isfinite(psMetadataLookupF32(&status,enginedef,"CDF00"))&&
     412              isfinite(psMetadataLookupF32(&status,enginedef,"CDF50"))&&
     413              isfinite(psMetadataLookupF32(&status,enginedef,"CDF100")))) {
     414      psArrayAdd(decisionRules,decisionRules->n, enginedef);
     415    }
     416    else if (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"UNUSED") == 0) {
    407417    }
    408418    else {
     
    637647    // Calculate if this exposure was "good" or not.
    638648    bool accept = true;
     649    psF32 quality = 1.0;
    639650    for (long j = 0; j < decisionRules->n; j++) {
    640651      psMetadata *rule = decisionRules->data[j];
     
    644655        psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column name");
    645656        return(false);
    646       }     
    647       psF32 min_value  = psMetadataLookupF32(&status,rule,"MINIMUM");
    648       if (!status) {
    649         psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find min value for %s",colname);
    650         return(false);
    651       }     
    652       psF32 max_value  = psMetadataLookupF32(&status,rule,"MAXIMUM");
    653       if (!status) {
    654         psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find max value for %s",colname);
    655         return(false);
    656       }
    657       psString filter = psMetadataLookupStr(&status,rule,"FILTER");
    658       if (!status) {
    659         status = true;
    660       }
    661       if (filter) {
    662         psString imfilter = psMetadataLookupStr(&status,tableRow,"FILTER");
    663         if (strcmp(filter,imfilter) != 0) {
    664           continue;
    665         }
    666657      }
    667658      // Not happy with this being set to a F32. Can this ever be something else?
    668659      psF32 value      = psMetadataLookupF32(&status,tableRow,colname);
    669660      if (!status) {
    670         psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column %s (%f %f %f) in compare with rule.",colname,min_value,max_value,value);
     661        psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column %s (%f) in compare with rule.",
     662                colname,value);
    671663        psFree(colNames);
    672664        psFree(colTypes);
     
    677669        return(false);
    678670      }
    679       if ((value > max_value)||(value < min_value)) {
    680         accept = false;
    681       }     
     671      psString filter = psMetadataLookupStr(&status,rule,"FILTER");
     672      if (!status) {
     673        status = true;
     674      }
     675      if (filter) {
     676        psString imfilter = psMetadataLookupStr(&status,tableRow,"FILTER");
     677        if (strcmp(filter,imfilter) != 0) {
     678          continue;
     679        }
     680      }
     681     
     682      if (strcmp(psMetadataLookupStr(&status,rule,"RULETYPE"),"STRICT") == 0) {
     683        psF32 min_value  = psMetadataLookupF32(&status,rule,"MINIMUM");
     684        if (!status) {
     685          psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find min value for %s",colname);
     686          return(false);
     687        }     
     688        psF32 max_value  = psMetadataLookupF32(&status,rule,"MAXIMUM");
     689        if (!status) {
     690          psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find max value for %s",colname);
     691          return(false);
     692        }
     693
     694        if ((value > max_value)||(value < min_value)) {
     695          accept = false;
     696        }
     697      } // End STRICT min/max rule parsing
     698      else if (strcmp(psMetadataLookupStr(&status,rule,"RULETYPE"),"CDF") == 0) {
     699        // I'm just going to implement a quick linear interpolation over the points that exist.
     700        psF32 min_value,max_value = 99;
     701        psF32 min_cdf = 0.0,max_cdf = 1.0;
     702        psF32 cdf;
     703        psF32 try[22] = {0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,
     704                         0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,0.99,1.00};
     705        int i;
     706        int done = 0;
     707        status = true;
     708        min_value = psMetadataLookupF32(&status,rule,"CDF00");
     709        min_cdf   = 0.0;
     710        if (!isfinite(value)) {
     711          quality = 0.0;
     712          continue;
     713        }
     714        if (!status) {
     715          status = true;
     716          psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find CDF00 value for %s",colname);
     717        }
     718        if (value < min_value) {
     719          if (quality > min_cdf) {
     720            quality = 0.0;
     721            continue;
     722          }
     723        }
     724
     725        for (i = 1; i < 22; i++) {
     726          psString label = psStringCopy("");
     727          psStringAppend(&label,"CDF%02d",(int) (100 * try[i]));
     728         
     729          max_value = psMetadataLookupF32(&status,rule,label);
     730          max_cdf   = try[i];
     731          if (!status) {
     732            status = true;
     733            psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find %s value for %s",label,colname);
     734          }
     735          if ((value < max_value)&&(value > min_value)) {
     736            cdf = ((value - min_value) * max_cdf + (max_value - value) * min_cdf) / (max_value - min_value);
     737            //      fprintf(stderr,"value: %f %f %f %f %f %f %d %d %f\n",value,quality,min_cdf,min_value,max_cdf,max_value, value < max_value, value > min_value,cdf);
     738            if (quality > cdf) {
     739              quality = cdf;
     740              done = 1;
     741              i = 25;
     742            }
     743          }
     744          min_value = max_value;
     745          min_cdf = max_cdf;
     746        }
     747        if (done) {
     748          continue;
     749        }
     750        // Reached end of array without finding the value;
     751        if (value > min_value) {
     752          if (quality > min_cdf) {
     753            quality = 1.0;
     754          }
     755        }
     756
     757
     758      } // End CDF rule parsing
    682759    }
    683760    bool success;
     
    695772      return(false);
    696773    }
     774    success = psMetadataAddF32(tableRow,PS_LIST_TAIL,"QUALITY",0,"",quality);
     775    if (!success) {
     776      psError(PS_ERR_UNKNOWN,false, "Error adding exposure quality to fits table row.");
     777      psFree(colNames);
     778      psFree(colTypes);
     779      psFree(contents);
     780      psFree(query);
     781      psFree(outTable);
     782      psFree(statsoutput);
     783      psFree(statIter);
     784      psFree(tableRow);
     785      return(false);
     786    }
    697787
    698788    // Add the row to the table array.
  • branches/czw_branch/20101203/ippTools/src/magicdstool.c

    r30118 r30586  
    11151115    psString queryFile = NULL;
    11161116    if (state) {
    1117         if (! strcmp(state, "new") ) {
     1117        if (! strcmp(state, "new") || !strcmp(state, "goto_restored")) {
    11181118            queryFile = "magicdstool_revertdestreakedfile.sql";
    11191119        } else if (!strcmp(state, "update")) {
     
    17241724    PXOPT_LOOKUP_STR(component, config->args, "-component", false, false);
    17251725    PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
     1726    PXOPT_LOOKUP_STR(recoveryroot, config->args, "-set_recoveryroot", false, false);
    17261727
    17271728    psString query = pxDataGet("magicdstool_setfiletoupdate.sql");
     
    17341735    if (label) {
    17351736        psStringAppend(&setHook, "\n , magicDSRun.label = '%s'", label);
     1737    }
     1738    if (recoveryroot) {
     1739        psStringAppend(&setHook, "\n , magicDSRun.recoveryroot = '%s'", recoveryroot);
    17361740    }
    17371741
  • branches/czw_branch/20101203/ippTools/src/magicdstoolConfig.c

    r30118 r30586  
    230230    psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-component", 0, "define component", NULL);
    231231    psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-set_label", 0, "set new label", NULL);
     232    psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-set_recoveryroot", 0, "define new recovery directory", NULL);
    232233
    233234    // -destreakedfile
  • branches/czw_branch/20101203/ippTools/src/magictool.c

    r29625 r30586  
    4949static bool censorrunMode(pxConfig *config);
    5050static bool exposureMode(pxConfig *config);
     51static bool setgotocleanedMode(pxConfig *config);
     52static bool tocleanupMode(pxConfig *config);
     53static bool setworkdirstateMode(pxConfig *config);
    5154
    5255static bool setmagicRunState(pxConfig *config, psS64 magic_id, const char *state, psString setString);
     
    8992        MODECASE(MAGICTOOL_MODE_CENSORRUN,           censorrunMode);
    9093        MODECASE(MAGICTOOL_MODE_EXPOSURE,            exposureMode);
     94        MODECASE(MAGICTOOL_MODE_SETGOTOCLEANED,      setgotocleanedMode);
     95        MODECASE(MAGICTOOL_MODE_TOCLEANUP,           tocleanupMode);
     96        MODECASE(MAGICTOOL_MODE_SETWORKDIRSTATE,     setworkdirstateMode);
    9197        default:
    9298            psAbort("invalid option (this should not happen)");
     
    621627    PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "==");
    622628    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    623     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     629    pxAddLabelSearchArgs (config, where, "-label", "magicRun.label", "==");
    624630
    625631    psString query = psStringCopy("UPDATE magicRun SET fault = 0 WHERE state = 'new' AND fault != 0");
     
    829835    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    830836
    831     // look for "inputs" that need to processed
    832     psString query = pxDataGet("magictool_toprocess_inputs.sql");
    833     if (!query) {
    834         psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
    835         return false;
    836     }
    837 
    838837    psString whereString = NULL;
    839838    if (psListLength(where->list)) {
     
    844843    psFree(where);
    845844
    846     psStringAppend(&query, "\nORDER BY priority DESC, magic_id");
    847 
    848     // treat limit == 0 as "no limit"
    849     if (limit) {
    850         // cut limit in half
    851         // hack to prevent pending leaf nodes from blocking branch nodes
    852         psString limitString = psDBGenerateLimitSQL((limit + 1) / 2);
    853         psStringAppend(&query, " %s", limitString);
    854         psFree(limitString);
    855     }
    856 
    857     if (!p_psDBRunQueryF(config->dbh, query, whereString, whereString)) {
    858         psError(PS_ERR_UNKNOWN, false, "database error");
    859         psFree(whereString);
    860         psFree(query);
    861         return false;
    862     }
    863     psFree(query);
    864 
    865     psArray *output = p_psDBFetchResult(config->dbh);
    866     if (!output) {
    867         psErrorCode err = psErrorCodeLast();
    868         switch (err) {
    869             case PS_ERR_DB_CLIENT:
    870                 psError(PXTOOLS_ERR_SYS, false, "database error");
    871             case PS_ERR_DB_SERVER:
    872                 psError(PXTOOLS_ERR_PROG, false, "database error");
    873             default:
    874                 psError(PXTOOLS_ERR_PROG, false, "unknown error");
    875         }
    876 
    877         return false;
    878     }
    879     if (!psArrayLength(output)) {
    880         psTrace("magictool", PS_LOG_INFO, "no rows found");
    881     }
    882 
    883     if (limit) {
    884         if (psArrayLength(output) >= limit) {
    885             // we've found enough (note that limit was applied to the query so '> limit' won't happen)
    886             // negative simple so the default is true
    887             if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) {
    888                 psError(PS_ERR_UNKNOWN, false, "failed to print array");
    889                 psFree(output);
    890                 return false;
    891             }
    892             psFree(output);
    893             return true;
    894         }
    895     }
    896 
    897     // look for tree nodes that need to be processed
     845    // First look for branch nodes that need to be processed.
     846    // These get priority over skycells because they are from runs
     847    // that are already in progress and there are fewer of them.
     848    // When we looked for skycells first we got starved.
    898849
    899850    // first find incomplete magicRuns
    900     query = pxDataGet("magictool_toprocess_runs.sql");
     851    psString query = pxDataGet("magictool_toprocess_runs.sql");
    901852    if (!query) {
    902853        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     
    904855    }
    905856
    906     // we limit the query even though it is cheap (only magic_id is selected)
    907 
    908     // XXX: if the first 1000 unfinished magicRuns have no ready nodes
    909     // that haven't faulted, later runs won't get returned even though
    910     // they have work to do. When we used a limit of 100 we actually ran
    911     // into this problem. Since we're using labels a limit of 1000 will
    912     // probably be ok.
     857    // Find outstanding magicRuns in new state.
     858    // We limit the query, but this is problematic. In practice do
     859    // we need to?
     860    // XXX: If the first 1000 magicRuns have no branch nodes ready
     861    // but higher runs do we they won't be noticed.
     862    // Perhaps have this limit be an argument.
    913863    {
    914864        psString limitString = psDBGenerateLimitSQL( 1000 );
     
    940890        return false;
    941891    }
     892
    942893    if (!psArrayLength(magicRuns)) {
     894        // no pending magicRuns nothing to do
    943895        psTrace("magictool", PS_LOG_INFO, "no rows found");
    944         psFree(magicRuns);
    945896        return true;
    946897    }
    947 
    948     query = pxDataGet("magictool_toprocess_tree.sql");
     898    psArray *output = psArrayAllocEmpty(100);
     899
     900    {
     901        query = pxDataGet("magictool_toprocess_tree.sql");
     902        if (!query) {
     903            psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     904            return false;
     905        }
     906
     907        for (psS64 index = 0; index < psArrayLength(magicRuns); index++) {
     908            if (limit && (psArrayLength(output) >= limit)) {
     909                break;
     910            }
     911            bool status;
     912            psS64 magic_id = psMetadataLookupS64(&status, magicRuns->data[index], "magic_id");
     913            if (!status) {
     914                psAbort("failed to lookup value for magic_id column");
     915            }
     916
     917            whereString = NULL;
     918            psStringAppend(&whereString, "\nAND (magic_id = %" PRId64 ")", magic_id);
     919            if (!p_psDBRunQueryF(config->dbh, query, whereString )) {
     920                psError(PS_ERR_UNKNOWN, false, "database error");
     921                psFree(whereString);
     922                psFree(query);
     923                return false;
     924            }
     925            psFree(whereString);
     926            psArray *magicTree = p_psDBFetchResult(config->dbh);
     927            if (!magicTree) {
     928                psErrorCode err = psErrorCodeLast();
     929                switch (err) {
     930                    case PS_ERR_DB_CLIENT:
     931                        psError(PXTOOLS_ERR_SYS, false, "database error");
     932                    case PS_ERR_DB_SERVER:
     933                        psError(PXTOOLS_ERR_PROG, false, "database error");
     934                    default:
     935                        psError(PXTOOLS_ERR_PROG, false, "unknown error");
     936                }
     937
     938                return false;
     939            }
     940            psS64 length = psArrayLength(magicTree);
     941            if (!length) {
     942                psTrace("magictool", PS_LOG_INFO, "no rows found for magic_id %" PRId64, magic_id);
     943                psFree(magicTree);
     944                continue;
     945            }
     946
     947            psHash *forest = psHashAlloc(length);
     948
     949            // convert the array of metadata into a pxTree structure
     950            for (long i = 0; i < length; i++) {
     951                bool status;
     952                psString node = psMetadataLookupStr(&status, magicTree->data[i], "node");
     953                if (!status) {
     954                    psAbort("failed to lookup value for node column");
     955                }
     956
     957                psString dep = psMetadataLookupStr(&status, magicTree->data[i], "dep");
     958                if (!status) {
     959                    psAbort("failed to lookup value for dep column");
     960                }
     961
     962                pxTreeBuilder(forest, node, dep, magicTree->data[i]);
     963
     964            }
     965
     966            // find the root of the tree
     967            pxNode *root = psMemIncrRefCounter(psHashLookup(forest, "root"));
     968            psFree(forest);
     969            //    pxTreePrint(stdout, root);
     970
     971            // crawl through the tree and looking for nodes with children that are all
     972            // "done"
     973            pxTreeCrawl(root, findReadyNodes, output);
     974            psFree(root);
     975            psFree(magicTree);
     976        }
     977
     978        int len = psArrayLength(output);
     979        if (len) {
     980            if (limit) {
     981                if (limit < psArrayLength(output)) {
     982                    // truncate the array
     983                    long arrayLength = psArrayLength(output);
     984                    for (long i = arrayLength - 1; i >= limit; i--) {
     985                        psArrayRemoveIndex(output, i);
     986                    }
     987                    // negative simple so the default is true
     988                    if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) {
     989                        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     990                        psFree(output);
     991                        return false;
     992                    }
     993                    psFree(output);
     994                    return true;
     995                } else {
     996                    limit -= len;
     997                }
     998            }
     999        }
     1000    }
     1001
     1002    // look for "inputs" (skycells) that need to processed
     1003    query = pxDataGet("magictool_toprocess_inputs.sql");
    9491004    if (!query) {
    9501005        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     
    9521007    }
    9531008
    954     for (psS64 index = 0; index < psArrayLength(magicRuns); index++) {
    955         if (limit && (psArrayLength(output) >= limit)) {
    956             break;
    957         }
    958         bool status;
    959         psS64 magic_id = psMetadataLookupS64(&status, magicRuns->data[index], "magic_id");
    960         if (!status) {
    961             psAbort("failed to lookup value for magic_id column");
    962         }
    963 
    964         whereString = NULL;
    965         psStringAppend(&whereString, "\nAND (magic_id = %" PRId64 ")", magic_id);
    966         if (!p_psDBRunQueryF(config->dbh, query, whereString )) {
    967             psError(PS_ERR_UNKNOWN, false, "database error");
    968             psFree(whereString);
    969             psFree(query);
    970             return false;
    971         }
     1009    psStringAppend(&query, "\nORDER BY priority DESC, magic_id");
     1010
     1011    // treat limit == 0 as "no limit"
     1012    if (limit) {
     1013        psString limitString = psDBGenerateLimitSQL(limit);
     1014        psStringAppend(&query, " %s", limitString);
     1015        psFree(limitString);
     1016    }
     1017
     1018    if (!p_psDBRunQueryF(config->dbh, query, whereString, whereString)) {
     1019        psError(PS_ERR_UNKNOWN, false, "database error");
    9721020        psFree(whereString);
    973         psArray *magicTree = p_psDBFetchResult(config->dbh);
    974         if (!magicTree) {
    975             psErrorCode err = psErrorCodeLast();
    976             switch (err) {
    977                 case PS_ERR_DB_CLIENT:
    978                     psError(PXTOOLS_ERR_SYS, false, "database error");
    979                 case PS_ERR_DB_SERVER:
    980                     psError(PXTOOLS_ERR_PROG, false, "database error");
    981                 default:
    982                     psError(PXTOOLS_ERR_PROG, false, "unknown error");
    983             }
    984 
    985             return false;
    986         }
    987         psS64 length = psArrayLength(magicTree);
    988         if (!length) {
    989             psTrace("magictool", PS_LOG_INFO, "no rows found for magic_id %" PRId64, magic_id);
    990             psFree(magicTree);
    991             continue;
    992         }
    993 
    994         psHash *forest = psHashAlloc(length);
    995 
    996         // convert the array of metadata into a pxTree structure
    997         for (long i = 0; i < length; i++) {
    998             bool status;
    999             psString node = psMetadataLookupStr(&status, magicTree->data[i], "node");
    1000             if (!status) {
    1001                 psAbort("failed to lookup value for node column");
    1002             }
    1003 
    1004             psString dep = psMetadataLookupStr(&status, magicTree->data[i], "dep");
    1005             if (!status) {
    1006                 psAbort("failed to lookup value for dep column");
    1007             }
    1008 
    1009             pxTreeBuilder(forest, node, dep, magicTree->data[i]);
    1010 
    1011         }
    1012 
    1013         // find the root of the tree
    1014         pxNode *root = psMemIncrRefCounter(psHashLookup(forest, "root"));
    1015         psFree(forest);
    1016         //    pxTreePrint(stdout, root);
    1017 
    1018         // crawl through the tree and looking for nodes with children that are all
    1019         // "done"
    1020         pxTreeCrawl(root, findReadyNodes, output);
    1021         psFree(root);
    1022         psFree(magicTree);
    1023     }
    1024 
     1021        psFree(query);
     1022        return false;
     1023    }
     1024    psFree(query);
     1025
     1026    psArray *skycellOutput = p_psDBFetchResult(config->dbh);
     1027    if (!skycellOutput) {
     1028        psErrorCode err = psErrorCodeLast();
     1029        switch (err) {
     1030            case PS_ERR_DB_CLIENT:
     1031                psError(PXTOOLS_ERR_SYS, false, "database error");
     1032            case PS_ERR_DB_SERVER:
     1033                psError(PXTOOLS_ERR_PROG, false, "database error");
     1034            default:
     1035                psError(PXTOOLS_ERR_PROG, false, "unknown error");
     1036        }
     1037
     1038        return false;
     1039    }
     1040    // merge the arrays so that we can print them all at once
     1041    if (psArrayLength(skycellOutput)) {
     1042        int len = psArrayLength(skycellOutput);
     1043        for (int i=0; i < len; i++) {
     1044            psArrayAdd(output, 0, skycellOutput->data[i]);
     1045        }
     1046    }
     1047    psFree(skycellOutput);
    10251048    if (psArrayLength(output)) {
    1026         if (limit && (limit < psArrayLength(output))) {
    1027             // truncate the array
    1028             long arrayLength = psArrayLength(output);
    1029             for (long i = arrayLength - 1; i >= limit; i--) {
    1030                 psArrayRemoveIndex(output, i);
    1031             }
    1032         }
    1033         // negative simple so the default is true
    10341049        if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) {
    10351050            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     
    10371052            return false;
    10381053        }
    1039     }
    1040 
     1054    } else {
     1055        psTrace("magictool", PS_LOG_INFO, "no rows found");
     1056    }
    10411057    psFree(output);
    1042 
    10431058    return true;
    10441059}
     
    16221637    return true;
    16231638}
     1639static bool setgotocleanedMode(pxConfig *config)
     1640{
     1641    PS_ASSERT_PTR_NON_NULL(config, false);
     1642
     1643    psMetadata *where = psMetadataAlloc();
     1644    PXOPT_COPY_S64(config->args, where, "-magic_id", "magicRun.magic_id", "==");
     1645    PXOPT_COPY_S64(config->args, where, "-exp_id", "magicRun.exp_id", "==");
     1646    PXOPT_COPY_STR(config->args, where, "-label", "magicRun.label", "LIKE");
     1647    PXOPT_COPY_STR(config->args, where, "-data_group", "magicRun.data_group", "LIKE");
     1648
     1649    PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);
     1650
     1651    psString query = psStringCopy("UPDATE magicRun SET workdir_state = 'goto_cleaned'\n");
     1652    if (set_label) {
     1653        psStringAppend(&query, ", label = '%s'", set_label);
     1654    }
     1655    // This mode doubles as a revert function for cleanup errors
     1656    PXOPT_LOOKUP_BOOL(clearfault, config->args, "-clearfault", false);
     1657    if (!clearfault) {
     1658        psStringAppend(&query, "WHERE workdir_state = 'dirty'");
     1659    } else {
     1660        psStringAppend(&query, "WHERE workdir_state = 'error_cleaned'");
     1661    }
     1662    psStringAppend(&query, "\nAND (magicRun.state = 'full' OR magicRun.state = 'drop')");
     1663
     1664    // Require search parameters unless we're just clearing faults
     1665    if (psListLength(where->list)) {
     1666        psString clause = psDBGenerateWhereConditionSQL(where, NULL);
     1667        psStringAppend(&query, "\nAND %s", clause);
     1668        psFree(clause);
     1669        psFree(where);
     1670    } else if ( !clearfault) {
     1671        psError(PS_ERR_UNKNOWN, false, "search parameters are required");
     1672        psFree(where);
     1673        return false;
     1674    }
     1675
     1676    if (!p_psDBRunQuery(config->dbh, query)) {
     1677        psError(PS_ERR_UNKNOWN, false, "database error");
     1678        psFree(query);
     1679        return false;
     1680    }
     1681    psFree(query);
     1682
     1683    return true;
     1684}
     1685
     1686static bool setworkdirstateMode(pxConfig *config)
     1687{
     1688    PS_ASSERT_PTR_NON_NULL(config, false);
     1689
     1690    // required
     1691    PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false);
     1692    PXOPT_LOOKUP_STR(workdir_state, config->args, "-set_workdir_state", true, false);
     1693
     1694    if (strcmp(workdir_state, "cleaned") && strcmp(workdir_state, "error_cleaned")) {
     1695        psError(PS_ERR_UNKNOWN, true, "%s is not a valid value for workdir_state", workdir_state);
     1696        return false;
     1697    }
     1698   
     1699    psString query = NULL;
     1700    psStringAppend(&query, "UPDATE magicRun SET workdir_state = '%s' WHERE magic_id = %" PRId64, workdir_state, magic_id);
     1701
     1702    if (!p_psDBRunQuery(config->dbh, query)) {
     1703        psError(PS_ERR_UNKNOWN, false, "database error");
     1704        psFree(query);
     1705        return false;
     1706    }
     1707    psFree(query);
     1708
     1709    return true;
     1710}
     1711static bool tocleanupMode(pxConfig *config)
     1712{
     1713    PS_ASSERT_PTR_NON_NULL(config, false);
     1714
     1715    psMetadata *where = psMetadataAlloc();
     1716    PXOPT_COPY_S64(config->args, where, "-magic_id", "magicRun.magic_id", "==");
     1717    pxAddLabelSearchArgs (config, where, "-label", "magicRun.label", "==");
     1718    pxAddLabelSearchArgs (config, where, "-data_group", "magicRun.data_group", "==");
     1719
     1720    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     1721    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     1722
     1723    psString query = pxDataGet("magictool_tocleanup.sql");
     1724    if (!query) {
     1725        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     1726        return false;
     1727    }
     1728
     1729    if (psListLength(where->list)) {
     1730        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     1731        psStringAppend(&query, " AND %s", whereClause);
     1732        psFree(whereClause);
     1733    }
     1734    psFree(where);
     1735
     1736    psStringAppend(&query, "\nORDER BY priority DESC, magic_id");
     1737
     1738    // treat limit == 0 as "no limit"
     1739    if (limit) {
     1740        psString limitString = psDBGenerateLimitSQL(limit);
     1741        psStringAppend(&query, " %s", limitString);
     1742        psFree(limitString);
     1743    }
     1744
     1745    if (!p_psDBRunQuery(config->dbh, query)) {
     1746        psError(PS_ERR_UNKNOWN, false, "database error");
     1747        psFree(query);
     1748        return false;
     1749    }
     1750    psFree(query);
     1751
     1752    psArray *output = p_psDBFetchResult(config->dbh);
     1753    if (!output) {
     1754        psErrorCode err = psErrorCodeLast();
     1755        switch (err) {
     1756            case PS_ERR_DB_CLIENT:
     1757                psError(PXTOOLS_ERR_SYS, false, "database error");
     1758            case PS_ERR_DB_SERVER:
     1759                psError(PXTOOLS_ERR_PROG, false, "database error");
     1760            default:
     1761                psError(PXTOOLS_ERR_PROG, false, "unknown error");
     1762        }
     1763
     1764        return false;
     1765    }
     1766    if (!psArrayLength(output)) {
     1767        psTrace("magictool", PS_LOG_INFO, "no rows found");
     1768        psFree(output);
     1769        return true;
     1770    }
     1771
     1772    if (psArrayLength(output)) {
     1773        // negative simple so the default is true
     1774        if (!ippdbPrintMetadatas(stdout, output, "tocleanup", !simple)) {
     1775            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     1776            psFree(output);
     1777            return false;
     1778        }
     1779    }
     1780
     1781    psFree(output);
     1782
     1783    return true;
     1784}
  • branches/czw_branch/20101203/ippTools/src/magictool.h

    r27982 r30586  
    4343    MAGICTOOL_MODE_CENSORRUN,
    4444    MAGICTOOL_MODE_EXPOSURE,
     45    MAGICTOOL_MODE_SETGOTOCLEANED,
     46    MAGICTOOL_MODE_TOCLEANUP,
     47    MAGICTOOL_MODE_SETWORKDIRSTATE,
    4548} MAGICtoolMode;
    4649
  • branches/czw_branch/20101203/ippTools/src/magictoolConfig.c

    r29495 r30586  
    114114    psMetadataAddS64(reverttreeArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magictool ID", 0);
    115115    psMetadataAddS16(reverttreeArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0);
    116     psMetadataAddStr(reverttreeArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL);
     116    psMetadataAddStr(reverttreeArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by label", NULL);
    117117
    118118    // -inputs
     
    178178    psMetadataAddBool(exposureArgs, PS_LIST_TAIL, "-inverse", 0, "select the inverse subtraction?", false);
    179179    psMetadataAddBool(exposureArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
     180
     181    // -setgotocleaned
     182    psMetadata *setgotocleanedArgs = psMetadataAlloc();
     183    psMetadataAddS64(setgotocleanedArgs, PS_LIST_TAIL, "-magic_id", 0, "select by magictool ID", 0);
     184    psMetadataAddS64(setgotocleanedArgs, PS_LIST_TAIL, "-exp_id", 0, "select by exposure ID)", 0);
     185    psMetadataAddStr(setgotocleanedArgs, PS_LIST_TAIL, "-label",  0, "select by label", NULL);
     186    psMetadataAddStr(setgotocleanedArgs, PS_LIST_TAIL, "-data_group",  0, "select by data_group", NULL);
     187    psMetadataAddStr(setgotocleanedArgs, PS_LIST_TAIL, "-set_label",  0, "set new label", NULL);
     188    psMetadataAddBool(setgotocleanedArgs, PS_LIST_TAIL, "-clearfault",  0, "clear cleanup errors", NULL);
     189
     190    // -tocleanup
     191    psMetadata *tocleanupArgs = psMetadataAlloc();
     192    psMetadataAddS64(tocleanupArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magic ID", 0);
     193    psMetadataAddStr(tocleanupArgs, PS_LIST_TAIL, "-label",    PS_META_DUPLICATE_OK, "search by label", NULL);
     194    psMetadataAddStr(tocleanupArgs, PS_LIST_TAIL, "-data_group",    PS_META_DUPLICATE_OK, "search by label", NULL);
     195    psMetadataAddU64(tocleanupArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0);
     196    psMetadataAddBool(tocleanupArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
     197
     198    // -setworkdirstate
     199    psMetadata *setworkdirstateArgs = psMetadataAlloc();
     200    psMetadataAddS64(setworkdirstateArgs, PS_LIST_TAIL, "-magic_id", 0, "select by magictool ID (required)", 0);
     201    psMetadataAddStr(setworkdirstateArgs, PS_LIST_TAIL, "-set_workdir_state", 0, "new workdir_state (required)", 0);
    180202
    181203    psFree(now);
     
    202224    PXOPT_ADD_MODE("-censorrun",           "", MAGICTOOL_MODE_CENSORRUN,           censorrunArgs);
    203225    PXOPT_ADD_MODE("-exposure",            "", MAGICTOOL_MODE_EXPOSURE,            exposureArgs);
     226    PXOPT_ADD_MODE("-setgotocleaned",      "", MAGICTOOL_MODE_SETGOTOCLEANED,      setgotocleanedArgs);
     227    PXOPT_ADD_MODE("-tocleanup",           "", MAGICTOOL_MODE_TOCLEANUP,           tocleanupArgs);
     228    PXOPT_ADD_MODE("-setworkdirstate",     "", MAGICTOOL_MODE_SETWORKDIRSTATE,     setworkdirstateArgs);
    204229
    205230    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
  • branches/czw_branch/20101203/ippTools/src/pstamptool.c

    r30118 r30586  
    134134    PXOPT_LOOKUP_STR(label,       config->args, "-set_label",         false, false);
    135135    PXOPT_LOOKUP_S32(pollInterval, config->args, "-set_poll_interval",false, false);
     136    PXOPT_LOOKUP_BOOL(no_magic, config->args, "-set_no_magic", false);
     137
     138    bool need_magic = ! no_magic;
    136139
    137140    if (!pstampDataStoreInsert(config->dbh,
     
    143146            outProduct,
    144147            uri,
    145             pollInterval
     148            pollInterval,
     149            need_magic
    146150        )) {
    147151        psError(PS_ERR_UNKNOWN, false, "database error");
  • branches/czw_branch/20101203/ippTools/src/pstamptoolConfig.c

    r30118 r30586  
    5151    psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-set_label",        0, "define datastore label", NULL);
    5252    psMetadataAddS32(adddatastoreArgs, PS_LIST_TAIL, "-set_poll_interval", 0, "define datastore poll interval (seconds)", 60);
     53    psMetadataAddBool(adddatastoreArgs,PS_LIST_TAIL, "-set_no_magic",   0, "set magic not required", true);
    5354
    5455    // -datastore
  • branches/czw_branch/20101203/ippTools/src/pubtool.c

    r30118 r30586  
    167167    PXOPT_COPY_STR(config->args, diffWhere, "-filter", "rawExp.filter", "LIKE");
    168168    PXOPT_COPY_STR(config->args, diffWhere, "-obs_mode", "rawExp.obs_mode", "LIKE");
     169    PXOPT_COPY_STR(config->args, diffWhere, "-comment", "rawExp.comment", "LIKE");
    169170
    170171    PXOPT_COPY_S64(config->args, camWhere, "-client_id", "client_id", "==");
  • branches/czw_branch/20101203/ippTools/src/pubtoolConfig.c

    r30118 r30586  
    6666    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "set and search by label", NULL);
    6767    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by data_group", NULL);
     68    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-comment", 0, "search by comment", NULL);
    6869    psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_begin", 0, "search for exposures by time (>=)", NULL);
    6970    psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL);
  • branches/czw_branch/20101203/ippTools/src/pztool.c

    r29982 r30586  
    4747static bool advanceMode(pxConfig *config);
    4848
     49static bool updatepzexpMode(pxConfig *config);
     50static bool updatenewexpMode(pxConfig *config);
     51
    4952// static bool copydoneCompleteExp(pxConfig *config);
    5053static psArray *pzGetPendingCameras(pxConfig *config);
     
    8386        MODECASE(PZTOOL_MODE_TOADVANCE, toadvanceMode);
    8487        MODECASE(PZTOOL_MODE_ADVANCE, advanceMode);
     88        MODECASE(PZTOOL_MODE_UPDATEPZEXP, updatepzexpMode);
     89        MODECASE(PZTOOL_MODE_UPDATENEWEXP, updatenewexpMode);
    8590        default:
    8691            psAbort("invalid option (this should not happen)");
     
    294299
    295300    psMetadata *where = psMetadataAlloc();
    296     PXOPT_COPY_STR(config->args, where,  "-exp_name",     "exp_name", "==");
    297     PXOPT_COPY_STR(config->args, where,  "-inst",         "camera", "==");
    298     PXOPT_COPY_STR(config->args, where,  "-telescope",    "telescope", "==");
    299     PXOPT_COPY_STR(config->args, where,  "-exp_type",     "exp_type", "==");
     301    PXOPT_COPY_STR(config->args, where,  "-exp_name",      "exp_name",  "==");
     302    PXOPT_COPY_STR(config->args, where,  "-inst",          "camera",    "==");
     303    PXOPT_COPY_STR(config->args, where,  "-telescope",     "telescope", "==");
     304    PXOPT_COPY_STR(config->args, where,  "-exp_type",      "exp_type",  "==");
     305    PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs",   ">=");
     306    PXOPT_COPY_TIME(config->args, where, "-dateobs_end",   "dateobs",   "<=");
    300307
    301308    PXOPT_LOOKUP_BOOL(desc, config->args, "-desc", false);
     
    325332
    326333        if (psListLength(where->list)) {
    327             psString whereClause = psDBGenerateWhereConditionSQL(where, "pzDownloadImfile");
     334            psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    328335            psStringAppend(&query, " AND %s", whereClause);
    329336            psFree(whereClause);
     
    889896            || (strncmp(state, "stop", 5) == 0)
    890897            || (strncmp(state, "reg", 4) == 0)
     898            || (strncmp(state, "drop", 5) == 0)
    891899        )
    892900    ) {
     
    905913}
    906914
     915static bool updatepzexpMode(pxConfig *config)
     916{
     917  PS_ASSERT_PTR_NON_NULL(config, false);
     918  PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false);
     919  PXOPT_LOOKUP_STR(camera,   config->args, "-inst",   true, false);
     920  PXOPT_LOOKUP_STR(telescope,config->args, "-telescope",true, false);
     921  PXOPT_LOOKUP_STR(state,    config->args, "-set_state",true, false);
     922
     923  if (!pzDownloadExpSetState(config,exp_name,camera,telescope,state)) {
     924    psError(PS_ERR_UNKNOWN, false, "failed to change state for %s:%s:%s", exp_name, camera, telescope);
     925    return false;
     926  }
     927  return true;
     928}
     929 
     930 
     931static bool updatenewexpMode(pxConfig *config)
     932{
     933    PS_ASSERT_PTR_NON_NULL(config, false);
     934
     935    psMetadata *where = psMetadataAlloc();
     936    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     937    PXOPT_COPY_STR(config->args, where,  "-exp_name", "tmp_exp_name", "==");
     938
     939    PXOPT_LOOKUP_STR(new_state, config->args, "-set_state", true, false);
     940
     941    if (strcmp(new_state, "drop") && strcmp(new_state, "run") && strcmp(new_state, "wait")) {
     942        psError(PXTOOLS_ERR_ARGUMENTS, true, "%s is not a valid value for -set_state", new_state);
     943        psFree(where);
     944        return false;
     945    }
     946
     947    if (psListLength(where->list) < 1) {
     948        psFree(where);
     949        psError(PXTOOLS_ERR_CONFIG, false, "-exp_name or -exp_id is required");
     950        return false;
     951    }
     952
     953    psString query = NULL;
     954    psStringAppend(&query, "UPDATE newExp SET state = '%s'", new_state);
     955
     956    psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     957    psStringAppend(&query, "\nWHERE %s", whereClause);
     958
     959    psFree(whereClause);
     960    psFree(where);
     961
     962    if (!p_psDBRunQuery(config->dbh, query)) {
     963        psError(PS_ERR_UNKNOWN, false, "database error");
     964        psFree(query);
     965        return false;
     966    }
     967    psFree(query);
     968
     969    return true;
     970}
     971
     972
     973
    907974
    908975#if 0
  • branches/czw_branch/20101203/ippTools/src/pztool.h

    r23497 r30586  
    3636    PZTOOL_MODE_CLEARCOMMONFAULTS,
    3737    PZTOOL_MODE_TOADVANCE,
    38     PZTOOL_MODE_ADVANCE
     38    PZTOOL_MODE_ADVANCE,
     39    PZTOOL_MODE_UPDATEPZEXP,
     40    PZTOOL_MODE_UPDATENEWEXP,
    3941} pztoolMode;
    4042
  • branches/czw_branch/20101203/ippTools/src/pztoolConfig.c

    r27082 r30586  
    7676    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL);
    7777    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL);
     78    psMetadataAddTime(pendingimfileArgs, PS_LIST_TAIL, "-dateobs_begin", 0,  "search for exposures by time (>=)", NULL);
     79    psMetadataAddTime(pendingimfileArgs, PS_LIST_TAIL, "-dateobs_end", 0,  "search for exposures by time (<=)", NULL);
    7880    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_type", 0,            "define exposure type", NULL);
    7981    psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-desc", 0,            "sort ouput in descending format", false);
     
    154156    psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-label",  0,     "define the label for the chip stage", NULL);
    155157
     158    // -updatepzexp
     159    psMetadata *updatepzexpArgs = psMetadataAlloc();
     160    psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-exp_name",   0,            "search by exposure name (required)", NULL);
     161    psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-inst",       0,            "search by camera (required)", NULL);
     162    psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-telescope",  0,            "search by telescope (required)", NULL);
     163    psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-set_state",  0,            "define new state (required)", NULL);
     164   
     165    // -updatenewexp
     166    psMetadata *updatenewexpArgs = psMetadataAlloc();
     167    psMetadataAddS64(updatenewexpArgs, PS_LIST_TAIL, "-exp_id",   0,            "search by exposure ID", 0);
     168
     169    psMetadataAddStr(updatenewexpArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL);
     170    psMetadataAddStr(updatenewexpArgs, PS_LIST_TAIL, "-set_state", 0,            "define new state (required)", NULL);
     171
    156172    psMetadata *argSets = psMetadataAlloc();
    157173    psMetadata *modes = psMetadataAlloc();
     
    169185    PXOPT_ADD_MODE("-toadvance",          "", PZTOOL_MODE_TOADVANCE,    toadvanceArgs);
    170186    PXOPT_ADD_MODE("-advance",          "", PZTOOL_MODE_ADVANCE,    advanceArgs);
     187    PXOPT_ADD_MODE("-updatepzexp",     "", PZTOOL_MODE_UPDATEPZEXP, updatepzexpArgs);
     188    PXOPT_ADD_MODE("-updatenewexp",    "", PZTOOL_MODE_UPDATENEWEXP,updatenewexpArgs);
    171189
    172190    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
  • branches/czw_branch/20101203/ippTools/src/regtool.c

    r30118 r30586  
    5151static bool updatebyqueryMode(pxConfig *config);
    5252
     53static bool checkstatusMode(pxConfig *config);
     54
    5355static bool exportrunMode(pxConfig *config);
    5456static bool importrunMode(pxConfig *config);
     
    7476        // imfile
    7577        MODECASE(REGTOOL_MODE_PENDINGIMFILE,         pendingimfileMode);
    76         MODECASE(REGTOOL_MODE_CHECKBURNTOOLIMFILE,   checkburntoolimfileMode);
    77         MODECASE(REGTOOL_MODE_PENDINGBURNTOOLIMFILE, pendingburntoolimfileMode);
     78        MODECASE(REGTOOL_MODE_CHECKBURNTOOLIMFILE,   checkburntoolimfileMode);
     79        MODECASE(REGTOOL_MODE_PENDINGBURNTOOLIMFILE, pendingburntoolimfileMode);
    7880        MODECASE(REGTOOL_MODE_ADDPROCESSEDIMFILE,    addprocessedimfileMode);
    7981        MODECASE(REGTOOL_MODE_PROCESSEDIMFILE,       processedimfileMode);
     
    9092        MODECASE(REGTOOL_MODE_FINISHCOMPRESSEXP,     finishcompressexpMode);
    9193        MODECASE(REGTOOL_MODE_CLEARDUPEXP,           cleardupexpMode);
     94        MODECASE(REGTOOL_MODE_CHECKSTATUS,           checkstatusMode);
    9295        MODECASE(REGTOOL_MODE_EXPORTRUN,             exportrunMode);
    9396        MODECASE(REGTOOL_MODE_IMPORTRUN,             importrunMode);
     
    9598            psAbort("invalid option (this should not happen)");
    9699    }
    97 
     100    psTrace("regtool",9,"Attempting to free config\n");
    98101    psFree(config);
    99102    pmConfigDone();
     
    180183}
    181184
     185 
     186 
     187
    182188static bool checkburntoolimfileMode(pxConfig *config)
    183189{
     
    187193  PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false);
    188194  PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
    189   PXOPT_LOOKUP_STR(date,     config->args, "-date", true, false);
     195  PXOPT_LOOKUP_STR(dateobs_begin,     config->args, "-dateobs_begin", true, false);
     196  PXOPT_LOOKUP_STR(dateobs_end,     config->args, "-dateobs_end", true, false);
    190197  PXOPT_LOOKUP_S32(valid_burntool, config->args, "-valid_burntool", true, false);
    191198  // optional
     
    201208  psFree(query);
    202209  query = rep;
     210
     211  // convert regular class_id format to summitImfile.class_id format
     212  rep = psStringCopy(class_id);
     213  psFree(class_id);
     214  class_id = rep;
     215 
     216  psStringSubstitute(&class_id,"ota","XY");
    203217 
    204218  psStringSubstitute(&query,exp_name,"@EXP_NAME@");
    205219  psStringSubstitute(&query,class_id,"@CLASS_ID@");
    206   psStringSubstitute(&query,date,"@DATE@");
    207 
    208   fprintf(stderr,"%s",query);
     220  psStringSubstitute(&query,dateobs_begin,"@DATEOBS_BEGIN@");
     221  psStringSubstitute(&query,dateobs_end,"@DATEOBS_END@");
     222
     223  // fprintf(stderr,"%s",query);
    209224
    210225  if (!p_psDBRunQuery(config->dbh, query)) {
     
    215230  }
    216231  psFree(query);
    217  
     232
    218233  psArray *output = p_psDBFetchResult(config->dbh);
    219234  if (!output) {
     
    227242      psError(PXTOOLS_ERR_PROG, false, "unknown error");
    228243    }
    229    
     244
    230245    return false;
    231246  }
    232247  if (!psArrayLength(output)) {
    233248    psTrace("regtool", PS_LOG_INFO, "no rows found");
    234     psFree(output);
    235249    return true;
    236250  }
     
    242256    psMetadata *row = output->data[i];
    243257
     258    if (strcasecmp(psMetadataLookupStr(NULL,row,"download_state"),"drop") == 0) {
     259      continue;
     260    }
     261   
    244262    if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)||
    245         (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {
     263        (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {
    246264      ok_to_burn = false;
    247265    }
     
    255273      already_burned = false;
    256274    }
    257    
     275
    258276    if (previous_uri) {
    259277      psMetadataAddStr(row,PS_LIST_TAIL,"previous_uri",PS_META_REPLACE,"",previous_uri);
     
    264282    previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri"));
    265283  }
    266  
     284
    267285  // negate simple so the default is true
    268286  if (!ippdbPrintMetadatas(stdout, output, "regBurntoolImfile", !simple)) {
     
    271289    return false;
    272290  }
    273  
     291
    274292  psFree(output);
    275  
     293
    276294
    277295  return(true);
    278  
     296
    279297}
    280298
     
    284302
    285303  // required
    286   PXOPT_LOOKUP_STR(date,     config->args, "-date", true, false);
     304  PXOPT_LOOKUP_STR(dateobs_begin,     config->args, "-dateobs_begin", true, false);
     305  PXOPT_LOOKUP_STR(dateobs_end,     config->args, "-dateobs_end", true, false);
    287306  PXOPT_LOOKUP_S32(valid_burntool, config->args, "-valid_burntool", true, false);
    288307  // optional
     
    297316  psFree(query);
    298317  query = rep;
    299  
    300   psStringSubstitute(&query,date,"@DATE@");
    301 
    302   //  fprintf(stderr,"%s",query);
     318
     319  psStringSubstitute(&query,dateobs_begin,"@DATEOBS_BEGIN@");
     320  psStringSubstitute(&query,dateobs_end,"@DATEOBS_END@");
     321
     322  // fprintf(stderr,"%s",query);
    303323
    304324  if (!p_psDBRunQuery(config->dbh, query)) {
     
    309329  }
    310330  psFree(query);
    311  
     331
    312332  psArray *output = p_psDBFetchResult(config->dbh);
    313333  if (!output) {
     
    321341      psError(PXTOOLS_ERR_PROG, false, "unknown error");
    322342    }
    323    
     343
    324344    return false;
    325345  }
     346
     347  // fprintf (stderr, "found %ld rows\n", output->n);
    326348  if (!psArrayLength(output)) {
    327349    psTrace("regtool", PS_LOG_INFO, "no rows found");
     
    337359  psString this_class_id = NULL;
    338360  psArray *results = psArrayAllocEmpty(60); // List of suggested imfiles to burntool.
    339  
     361
    340362  for (long i = 0; i < output->n; i++) {
    341363    psMetadata *row = output->data[i];
    342364
     365    if (strcasecmp(psMetadataLookupStr(NULL,row,"download_state"),"drop") == 0) {
     366      continue;
     367    }
     368
     369    bool status = false;
     370    char *tmp_id = psMetadataLookupStr(&status,row,"summit_class_id");
     371    if (!status) {
     372      //      fprintf (stderr, "incomplete on %s\n", psMetadataLookupStr(NULL,row,"exp_name"));
     373        continue;
     374    }
     375
    343376    // Add the information about this row and the previous, if it exists.
    344377    // Write the class_id stuff for debugging.
    345     this_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
    346     psStringSubstitute(&this_class_id,"XY","ota");
     378    // this_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
     379    this_class_id = psStringCopy(tmp_id);
     380
    347381    psMetadataAddStr(row,PS_LIST_TAIL,"this_class_id",PS_META_REPLACE,"",this_class_id);
     382
    348383    if (previous_class_id) {
    349384      psMetadataAddStr(row,PS_LIST_TAIL,"previous_class_id",PS_META_REPLACE,"",previous_class_id);
     
    353388      continue;
    354389    }
     390
     391    if (0 && !strcmp(this_class_id, "ota44")) {
     392        printf("STAT 1: %s (%d %d) %d %d %d\n",
     393               this_class_id,
     394               ok_to_burn, already_burned,
     395               psMetadataLookupS32(NULL,row,"burntool_state"),
     396               psMetadataLookupS32(NULL,row,"is_registered"),
     397               psMetadataLookupS32(NULL,row,"is_downloaded"));
     398    }
     399
    355400    // Determine if we've crossed a class_id boundary, as this resets the bits.
    356401    if (previous_class_id) {
    357402      if (strcmp(this_class_id,previous_class_id) != 0) {
    358         ok_to_burn = true;
    359         already_burned = true;
    360         previous_uri = NULL;
     403        ok_to_burn = true;
     404        already_burned = true;
     405        previous_uri = NULL;
     406        //      fprintf (stderr, "crossed boundary: %s : %s to %s\n", psMetadataLookupStr(NULL,row,"exp_name"), previous_class_id, this_class_id);
    361407      }
    362408    }
     
    364410    // Write the URIs as well.
    365411    this_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Duplicate, but helpful for my debugging.
    366     psMetadataAddStr(row,PS_LIST_TAIL,"this_uri",PS_META_REPLACE,"",this_uri); 
     412    psMetadataAddStr(row,PS_LIST_TAIL,"this_uri",PS_META_REPLACE,"",this_uri);
    367413    if (previous_uri) {
    368414      psMetadataAddStr(row,PS_LIST_TAIL,"previous_uri",PS_META_REPLACE,"",previous_uri);
     
    372418    // Convert bits of the SQL query into booleans describing the data state
    373419    if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)||
    374         (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {
    375       //      printf("I claim this isn't downloaded or registered? %s %s\n",this_uri,this_class_id);
    376       ok_to_burn = false;
     420        (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {
     421      // printf("I claim this isn't downloaded or registered? %s %s\n",this_uri,this_class_id);
     422        ok_to_burn = false;
    377423    }
    378424    if (already_burned == false) {
    379       //      printf("already_burned looks false %s %s\n",this_uri,this_class_id);
    380       ok_to_burn = false;
     425        // printf("already_burned looks false %s %s\n",this_uri,this_class_id);
     426        ok_to_burn = false;
    381427    }
    382428    if (abs(psMetadataLookupS32(NULL,row,"burntool_state")) == valid_burntool) {
     
    391437    // Check the uri for this exposure
    392438    if (!this_uri) {
    393         ok_to_burn = false;
    394         already_burned = false;
    395 
    396         // Save this round for next round.
    397         psFree(previous_class_id);
    398         psFree(previous_uri);
    399         previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
    400         psStringSubstitute(&previous_class_id,"XY","ota");
    401         previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
    402         continue;
    403     }     
    404 
    405     //    printf("STATUS: %s %s %s %s (%d %d) %d %d %d\n",this_uri,previous_uri,this_class_id,previous_class_id,ok_to_burn,already_burned,psMetadataLookupS32(NULL,row,"burntool_state"),psMetadataLookupS32(NULL,row,"is_registered"),psMetadataLookupS32(NULL,row,"is_downloaded"));
    406 
    407     // If the state of this imfile is not "pending_burntool" then we can't burn it.
     439        ok_to_burn = false;
     440        already_burned = false;
     441
     442        //      fprintf (stderr, "missing uri: %s %s\n", psMetadataLookupStr(NULL,row,"exp_name"), this_class_id);
     443
     444        // Save this round for next round.
     445        psFree(previous_class_id);
     446        psFree(previous_uri);
     447        previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id"));
     448        psStringSubstitute(&previous_class_id,"ota","XY");
     449        previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.
     450        continue;
     451    }
     452
     453    if (0 && !strcmp(this_class_id, "ota44")) {
     454        printf("STATUS: %s %s %s %s (%d %d) %d %d %d\n",this_uri,previous_uri,this_class_id,previous_class_id,ok_to_burn,already_burned,psMetadataLookupS32(NULL,row,"burntool_state"),psMetadataLookupS32(NULL,row,"is_registered"),psMetadataLookupS32(NULL,row,"is_downloaded"));
     455    }
     456    // If the state of this imfile is not "pending_burntool" then we can't burn it.
    408457    if (!ignore_state) {
    409458      psString imfile_state = psMetadataLookupStr(NULL,row,"imfile_state");
    410459
    411460      if (!imfile_state) { // imfile state is NULL, so we probably aren't registered.
    412         ok_to_burn = false;
    413 
    414         // Save this round for next round.
    415         psFree(previous_class_id);
    416         psFree(previous_uri);
    417         previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
    418         psStringSubstitute(&previous_class_id,"XY","ota");
    419         previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
    420         continue;
     461        ok_to_burn = false;
     462
     463        // fprintf (stderr, "missing imfile_state: %s %s\n", psMetadataLookupStr(NULL,row,"exp_name"), this_class_id);
     464
     465        // Save this round for next round.
     466        psFree(previous_class_id);
     467        psFree(previous_uri);
     468        previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id"));
     469        psStringSubstitute(&previous_class_id,"ota","XY");
     470        previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.
     471        continue;
    421472      }
    422       if (strcmp("pending_burntool",imfile_state) != 0) { // Probably the state is full, do not twiddle states 
    423         // Save this round for next round.
    424         psFree(previous_class_id);
    425         psFree(previous_uri);
    426         previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
    427         psStringSubstitute(&previous_class_id,"XY","ota");
    428         previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
    429         continue;
     473      if (strcmp("pending_burntool",imfile_state) != 0) { // Probably the state is full, do not twiddle states
     474
     475          if (0 && strcmp(imfile_state, "full")) {
     476              fprintf (stderr, "not pending nor full: %s %s %s\n", psMetadataLookupStr(NULL,row,"exp_name"), this_class_id, imfile_state);
     477          }
     478
     479        // Save this round for next round.
     480        psFree(previous_class_id);
     481        psFree(previous_uri);
     482        previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id"));
     483        psStringSubstitute(&previous_class_id,"ota","XY");
     484        previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.
     485        continue;
    430486      }
    431487    }
    432    
     488
    433489    // Determine if we've already suggested an entry for this ota, and if not, copy this
    434490    // suggestion into our output result list.
     
    437493      psFree(previous_class_id);
    438494      psFree(previous_uri);
    439       previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
    440       psStringSubstitute(&previous_class_id,"XY","ota");
    441       previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.       
     495      previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id"));
     496      psStringSubstitute(&previous_class_id,"ota","XY");
     497      previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.
    442498      continue;
    443499    }
     
    448504    psFree(previous_class_id);
    449505    psFree(previous_uri);
    450     previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id"));
    451     psStringSubstitute(&previous_class_id,"XY","ota");
    452     previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.         
    453   }
    454  
     506    previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id"));
     507    psStringSubstitute(&previous_class_id,"ota","XY");
     508    previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round.
     509  }
     510
    455511  // negate simple so the default is true
    456512  if (!ippdbPrintMetadatas(stdout, results, "regPendingBurntoolImfile", !simple)) {
     
    460516    return false;
    461517  }
    462  
     518
    463519  psFree(output);
    464520  psFree(results);
    465  
     521
    466522
    467523  return(true);
    468  
    469 }
    470 
    471      
     524
     525}
     526
     527
    472528
    473529static bool addprocessedimfileMode(pxConfig *config)
     
    545601    PXOPT_LOOKUP_STR(md5sum, config->args, "-md5sum", false, false);
    546602    PXOPT_LOOKUP_BOOL(video_cells, config->args, "-video_cells", false);
    547    
     603
    548604    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    549605    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
     
    618674        bytes,
    619675        md5sum,
    620         video_cells,
    621         0   // burntool_state
     676        0,   // burntool_state
     677        video_cells
    622678    )) {
    623679        psError(PS_ERR_UNKNOWN, false, "database error");
     
    771827        psStringAppend(&query, " AND %s", whereClause);
    772828        psFree(whereClause);
    773     } else {
    774         psFree(where);
    775         psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
    776         return false;
    777829    }
    778830    psFree(where);
     
    806858    PXOPT_LOOKUP_STR(set_state, config->args, "-set_state", false, false);
    807859
    808     if ((fault == INT16_MAX) && !isfinite(burntool_state) && !(set_state)) {
     860    if ((fault == INT16_MAX) && (burntool_state == INT16_MAX) && !set_state) {
    809861        psError(PS_ERR_UNKNOWN, false, "one of -fault or -burntool_state or -set_state must be selected");
    810862        return false;
    811863    }
    812     if ((fault != INT16_MAX) && isfinite(burntool_state)) {
     864    if ((fault != INT16_MAX) && (burntool_state != INT16_MAX)) {
    813865        psError(PS_ERR_UNKNOWN, false, "only one of -fault or -burntool_state must be selected");
    814866        return false;
     
    13121364    if (!pxchipQueueByExpTag(config,
    13131365                exp_id,
    1314                              chip_workdir,
     1366                             chip_workdir,
    13151367                label,
    1316                              data_group,
    1317                              dist_group,
     1368                             data_group,
     1369                             dist_group,
    13181370                reduction,
    13191371                NULL,       // expgroup
     
    18311883}
    18321884
     1885static bool checkstatusMode(pxConfig *config)
     1886{
     1887  PS_ASSERT_PTR_NON_NULL(config,false);
     1888
     1889  // required
     1890  PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
     1891  // Conditionally required
     1892  PXOPT_LOOKUP_STR(dateobs_begin, config->args, "-dateobs_begin", false, false);
     1893  PXOPT_LOOKUP_STR(dateobs_end,   config->args, "-dateobs_end",   false, false);
     1894  PXOPT_LOOKUP_STR(date,          config->args, "-date",          false, false);
     1895  PXOPT_LOOKUP_BOOL(simple,       config->args, "-simple",        false);
     1896
     1897  psString query = pxDataGet("regtool_checkstatus.sql");
     1898  if (!query) {
     1899    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     1900    return false;
     1901  }
     1902  psString rep = psStringCopy(query);
     1903  psFree(query);
     1904  query = rep;
     1905  psStringSubstitute(&class_id,"ota","XY");
     1906  psStringSubstitute(&query,class_id,"@CLASS_ID@");
     1907   
     1908  if (!date) {
     1909    if (!dateobs_begin || !dateobs_end) {
     1910      psError(PXTOOLS_ERR_CONFIG, false, "Either -date or -dateobs_begin -dateobs_end is required");
     1911      psFree(query);
     1912      return false;
     1913    }
     1914    psStringAppend(&query," AND summitExp.dateobs >= '%s' AND summitExp.dateobs <= '%s' ",
     1915                   dateobs_begin,dateobs_end);
     1916  }
     1917  else {
     1918    psStringAppend(&query," AND summitExp.dateobs >= '%sT00:00:00' AND summitExp.dateobs <= '%sT23:59:59' ",
     1919                   date,date);
     1920  }
     1921
     1922  psStringAppend(&query," ORDER BY summitExp.dateobs ");
     1923 
     1924  if (!p_psDBRunQuery(config->dbh, query)) {
     1925    // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms)
     1926    psError(PXTOOLS_ERR_PROG, false, "database error");
     1927    psFree(query);
     1928    return false;
     1929  }
     1930  psFree(query);
     1931
     1932  psArray *output = p_psDBFetchResult(config->dbh);
     1933  if (!output) {
     1934    psErrorCode err = psErrorCodeLast();
     1935    switch (err) {
     1936    case PS_ERR_DB_CLIENT:
     1937      psError(PXTOOLS_ERR_SYS, false, "database error");
     1938    case PS_ERR_DB_SERVER:
     1939      psError(PXTOOLS_ERR_PROG, false, "database error");
     1940    default:
     1941      psError(PXTOOLS_ERR_PROG, false, "unknown error");
     1942    }
     1943
     1944    return false;
     1945  }
     1946  if (!psArrayLength(output)) {
     1947    psTrace("regtool", PS_LOG_INFO, "no rows found");
     1948    return true;
     1949  }
     1950
     1951  if (!ippdbPrintMetadatas(stdout, output, "regCheckStatus", !simple)) {
     1952    psError(PXTOOLS_ERR_PROG, false, "failed to print array");
     1953    psFree(output);
     1954    return false;
     1955  }
     1956
     1957  psFree(output);
     1958
     1959  return(true);
     1960}
     1961
    18331962bool exportrunMode(pxConfig *config)
    18341963{
  • branches/czw_branch/20101203/ippTools/src/regtool.h

    r29908 r30586  
    4141    REGTOOL_MODE_PENDINGCOMPRESSIMFILE,
    4242    REGTOOL_MODE_FINISHCOMPRESSEXP,
     43    REGTOOL_MODE_CHECKSTATUS,
    4344    REGTOOL_MODE_EXPORTRUN,
    4445    REGTOOL_MODE_IMPORTRUN
  • branches/czw_branch/20101203/ippTools/src/regtoolConfig.c

    r30014 r30586  
    5757    ADD_OPT(Str,  checkburntoolimfileArgs, "-exp_name",       "define the exp_name (required)",         NULL);
    5858    ADD_OPT(Str,  checkburntoolimfileArgs, "-class_id",       "define class ID (required)",         NULL);
    59     ADD_OPT(Str,  checkburntoolimfileArgs, "-date",           "select the date to process (required)", NULL);
     59    ADD_OPT(Str,  checkburntoolimfileArgs, "-dateobs_begin",  "set the earliest summit dateobs to consider (required)", NULL);
     60    ADD_OPT(Str,  checkburntoolimfileArgs, "-dateobs_end",    "set the latest summit dateobs to consider (required)", NULL);
    6061    ADD_OPT(S32,  checkburntoolimfileArgs, "-valid_burntool", "define the good burntool value (required)", 0);
    6162    ADD_OPT(Str,  checkburntoolimfileArgs, "-inst",           "define the camera name",     NULL);
     
    6566    // -pendingburntoolimfile
    6667    psMetadata *pendingburntoolimfileArgs = psMetadataAlloc();
    67     ADD_OPT(Str,  pendingburntoolimfileArgs, "-date",           "select the date to process (required)", NULL);
     68    ADD_OPT(Str,  pendingburntoolimfileArgs, "-dateobs_begin",  "set the earliest summit dateobs to consider (required)", NULL);
     69    ADD_OPT(Str,  pendingburntoolimfileArgs, "-dateobs_end",    "set the latest summit dateobs to consider (required)", NULL);
    6870    ADD_OPT(S32,  pendingburntoolimfileArgs, "-valid_burntool", "define the good burntool value (required)", 0);
    6971    ADD_OPT(Bool, pendingburntoolimfileArgs, "-simple",    "use the simple output format",          false);
    7072    ADD_OPT(Bool, pendingburntoolimfileArgs, "-ignore_state",   "ignore the data_state when deciding what to work on",  false);
    7173    ADD_OPT(U64,  pendingburntoolimfileArgs, "-limit",     "limit result set to N items",  0);
    72    
     74
    7375    // -addprocessedimfile
    7476    psMetadata *addprocessedimfileArgs = psMetadataAlloc();
     
    178180    ADD_OPT(S64, revertprocessedimfileArgs, "-exp_id_begin",  "search by exposure ID", 0);
    179181    ADD_OPT(S64, revertprocessedimfileArgs, "-exp_id_end",    "search by exposure ID", 0);
     182    // This argument is not used but is needed because the task uses add.poll.args
     183    ADD_OPT(U64, revertprocessedimfileArgs, "-limit",     "for compatability not used", 0);
    180184
    181185    // -updateprocessedimfile
     
    415419    psMetadataAddBool(finishcompressexpArgs, PS_LIST_TAIL, "-simple", 0,   "use the simple output format", false);
    416420    psMetadataAddU64(finishcompressexpArgs, PS_LIST_TAIL, "-limit",   0,   "limit result set to N items", 0);
     421
     422    // -checkstatus
     423    psMetadata *checkstatusArgs = psMetadataAlloc();
     424    ADD_OPT(Str, checkstatusArgs, "-dateobs_begin", "set the earlist summit dateobs to consider", NULL);
     425    ADD_OPT(Str, checkstatusArgs, "-dateobs_end", "set the latest summit dateobs to consider", NULL);
     426    ADD_OPT(Str, checkstatusArgs, "-date", "use default observing extent and look over entire night", NULL);
     427    ADD_OPT(Str, checkstatusArgs, "-class_id",    "define class ID (required)", NULL);
     428    ADD_OPT(Bool, checkstatusArgs, "-simple",    "use the simple output format", false);
    417429   
    418430    psMetadata *argSets = psMetadataAlloc();
     
    435447    PXOPT_ADD_MODE("-pendingcompressimfile",   "", REGTOOL_MODE_PENDINGCOMPRESSIMFILE, pendingcompressimfileArgs);
    436448    PXOPT_ADD_MODE("-finishcompressexp",       "", REGTOOL_MODE_FINISHCOMPRESSEXP, finishcompressexpArgs);
     449    PXOPT_ADD_MODE("-checkstatus",             "", REGTOOL_MODE_CHECKSTATUS, checkstatusArgs);
    437450    PXOPT_ADD_MODE("-exportrun",            "export run for import on other database", REGTOOL_MODE_EXPORTRUN, exportrunArgs);
    438451    PXOPT_ADD_MODE("-importrun",            "import run from metadata file",           REGTOOL_MODE_IMPORTRUN, importrunArgs);
  • branches/czw_branch/20101203/ippTools/src/stacktool.c

    r29418 r30586  
    497497            psError(PS_ERR_UNKNOWN, false, "database error");
    498498            psFree(output);
    499             psFree(run);
    500499            psFree(insert);
    501500            psFree(list);
     
    517516          psError(PS_ERR_UNKNOWN, false, "database error");
    518517          psFree(output);
    519           psFree(run);
    520518          psFree(insert);
    521519          psFree(list);
Note: See TracChangeset for help on using the changeset viewer.