IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 17, 2009, 4:40:53 PM (17 years ago)
Author:
eugene
Message:

convert -label options to multi where appropriate; fix definebyquery (was not passing along tess_id, reduction, etc from newExp, only supplied values or NULL)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/chiptool.c

    r23873 r23919  
    125125    psMetadata *where = psMetadataAlloc();
    126126    pxchipGetSearchArgs (config, where); // rawExp only
    127     PXOPT_COPY_STR(config->args, where, "-label", "rawExp.label", "LIKE");
     127    pxAddLabelSearchArgs (config, where, "-label", "newExp.label", "LIKE");
    128128
    129129    // psListLength(where->list) is at least 1 because exp_type defaults to "object"
     
    219219    }
    220220
     221
     222# define GET_VALUE(PTYPE,CTYPE,VALUE,NAME)                              \
     223    PTYPE VALUE;                                                        \
     224    { bool status;                                                      \
     225        VALUE = psMetadataLookup##CTYPE(&status, md, NAME);             \
     226        if (!status) {                                                  \
     227            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for %s", NAME); \
     228            psFree(output);                                             \
     229            return false;                                               \
     230        } }
     231
    221232    // loop over our list of exp_ids
    222233    for (long i = 0; i < psArrayLength(output); i++) {
    223234        psMetadata *md = output->data[i];
    224235
    225         bool status;
    226         psS64 exp_id = psMetadataLookupS64(&status, md, "exp_id");
    227         if (!status) {
    228             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
     236        rawExpRow *row = rawExpObjectFromMetadata(md);
     237        if (!row) {
     238            psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into chipRun");
    229239            psFree(output);
    230240            return false;
    231241        }
    232         //
     242
     243        GET_VALUE (psS64,    S64, exp_id,        "exp_id");
     244        GET_VALUE (psString, Str, raw_workdir,   "workdir");
     245        GET_VALUE (psString, Str, raw_label,     "label");
     246        GET_VALUE (psString, Str, raw_reduction, "reduction");
     247        // GET_VALUE (psString, Str, raw_expgroup,  "expgroup");
     248        GET_VALUE (psString, Str, raw_dvodb,     "dvodb");
     249        GET_VALUE (psString, Str, raw_tess_id,   "tess_id");
     250        GET_VALUE (psString, Str, raw_end_stage, "end_stage");
     251
     252        if (!row->exp_id) {
     253            psError(PS_ERR_UNKNOWN, false, "failed to find value for exp_id");
     254            psFree(output);
     255            return false;
     256        }
     257
    233258        // queue the exp
    234         if (!pxchipQueueByExpTag(config, exp_id, workdir, label, reduction, expgroup, dvodb, tess_id, end_stage)) {
     259        if (!pxchipQueueByExpTag(config,
     260                                 exp_id,
     261                                 workdir     ? workdir   : raw_workdir,
     262                                 label       ? label     : raw_label,
     263                                 reduction   ? reduction : raw_reduction,
     264                                 // expgroup    ? expgroup  : raw_expgroup,
     265                                 // XXX how does expgroup get defined?
     266                                 expgroup,
     267                                 dvodb       ? dvodb     : raw_dvodb,
     268                                 tess_id     ? tess_id   : raw_tess_id,
     269                                 end_stage   ? end_stage : raw_end_stage
     270                                 )) {
    235271            if (!psDBRollback(config->dbh)) {
    236272                psError(PS_ERR_UNKNOWN, false, "database error");
     
    260296    pxchipGetSearchArgs (config, where); // rawExp, chipRun
    261297    PXOPT_COPY_S64(config->args,  where, "-chip_id", "chipRun.chip_id", "==");
     298    // we only allow a single label to match (do not use pxAddLabelSearchArgs here)
    262299    PXOPT_COPY_STR(config->args,  where, "-label",   "chipRun.label",   "==");
    263300    PXOPT_COPY_STR(config->args,  where, "-state",   "chipRun.state",   "==");
     
    312349    pxchipGetSearchArgs (config, where); //chipRun, rawExp
    313350    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
    314     PXOPT_COPY_STR(config->args, where, "-label", "chipRun.label", "==");
     351    pxAddLabelSearchArgs (config, where, "-label", "chipRun.label", "==");
    315352
    316353    psString query = pxDataGet("chiptool_pendingimfile.sql");
     
    563600    PXOPT_COPY_STR(config->args, where, "-class_id", "chipProcessedImfile.class_id", "==");
    564601    PXOPT_COPY_STR(config->args, where, "-reduction", "chipRun.reduction", "==");
    565     PXOPT_COPY_STR(config->args, where, "-label", "chipRun.label", "LIKE");
     602    pxAddLabelSearchArgs (config, where, "-label", "chipRun.label", "LIKE");
    566603    PXOPT_COPY_S32(config->args, where, "-magicked", "chipRun.magicked", "==");
    567604
     
    639676    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
    640677    PXOPT_COPY_STR(config->args, where, "-class_id", "chipProcessedImfile.class_id", "==");
    641     PXOPT_COPY_STR(config->args, where, "-label", "chipRun.label", "LIKE");
     678    // require a single label
     679    PXOPT_COPY_STR(config->args, where, "-label", "chipRun.label", "==");
    642680    PXOPT_COPY_STR(config->args, where, "-reduction", "chipRun.reduction", "==");
    643681    PXOPT_COPY_S16(config->args, where, "-fault", "chipProcessedImfile.fault", "==");
     
    865903
    866904    psMetadata *where = psMetadataAlloc();
    867     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     905    pxAddLabelSearchArgs (config, where, "-label", "label", "==");
    868906
    869907    psString query = pxDataGet("chiptool_pendingcleanuprun.sql");
     
    929967        PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
    930968    }
    931     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     969    pxAddLabelSearchArgs (config, where, "-label", "label", "==");
    932970
    933971    psString query = pxDataGet("chiptool_pendingcleanupimfile.sql");
     
    10571095
    10581096    psMetadata *where = psMetadataAlloc();
    1059     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     1097    pxAddLabelSearchArgs (config, where, "-label", "label", "==");
    10601098    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
    10611099
     
    11181156
    11191157    psMetadata *where = psMetadataAlloc();
    1120     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     1158    pxAddLabelSearchArgs (config, where, "-label", "label", "==");
    11211159
    11221160    // look for completed chipPendingExp
Note: See TracChangeset for help on using the changeset viewer.