IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26915


Ignore:
Timestamp:
Feb 11, 2010, 3:01:34 PM (16 years ago)
Author:
bills
Message:

In addtool -definebyquery prevent queuing a new addRun if one already exists
for the given exposure in the target dvo database

Location:
trunk/ippTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/share/addtool_find_cam_id.sql

    r25789 r26915  
    66JOIN rawExp
    77    USING(exp_id)
     8LEFT JOIN (SELECT exp_id       AS added_exp_id,
     9                  addRun.dvodb AS previous_dvodb
     10           FROM addRun
     11           JOIN camRun USING(cam_id)
     12           JOIN chipRun USING(chip_id)
     13          ) as foo
     14     ON exp_id = added_exp_id
     15     -- hook for qualifying the join on the previous_dvodb
     16     AND %s
    817WHERE
    918    camRun.state = 'full'
     19    AND added_exp_id IS NULL
     20    -- addtool adds checks on exposure being added to the dvodb previously
  • trunk/ippTools/src/addtool.c

    r26911 r26915  
    9999    PXOPT_COPY_S64(config->args, where,  "-cam_id",    "camRun.cam_id", "==");
    100100    pxAddLabelSearchArgs (config, where, "-label",     "camRun.label", "=="); // define using camRun label
     101    pxAddLabelSearchArgs (config, where, "-data_group","camRun.data_group", "=="); // define using camRun label
    101102    PXOPT_COPY_STR(config->args, where,  "-reduction", "camRun.reduction", "==");
    102103
     
    119120
    120121    // find the cam_id of all the exposures that we want to queue up.
    121     psString query = pxDataGet("addtool_find_cam_id.sql");
    122     if (!query) {
     122    psString bare_query = pxDataGet("addtool_find_cam_id.sql");
     123    if (!bare_query) {
    123124        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    124125        psFree(where);
    125126        return false;
    126127    }
     128
     129    // prevent queueing an addRun if a given exposure has already been added to
     130    // the given dvo database
     131    psString dvodb_string = NULL;
     132    if (dvodb) {
     133        // user supplied dvodb
     134        psStringAppend(&dvodb_string, "(previous_dvodb = '%s')", dvodb);
     135    } else {
     136        // inherit dvodb from camRun, avoid matching NULL
     137        psStringAppend(&dvodb_string, "(camRun.dvodb IS NOT NULL AND previous_dvodb = camRun.dvodb)");
     138    }
     139    // Take the bare query and add the dvodb selector
     140    psString query = NULL;
     141    psStringAppend(&query, bare_query, dvodb_string);
     142    psFree(dvodb_string);
     143    psFree(bare_query);
    127144
    128145    // use psDBGenerateWhereConditionSQL because the SQL ends in a WHERE
     
    131148        psStringAppend(&query, " AND %s", whereClause);
    132149        psFree(whereClause);
     150    } else {
     151        psError(PS_ERR_UNKNOWN, true, "search parameters are required");
     152        return false;
    133153    }
    134154    psFree(where);
  • trunk/ippTools/src/addtoolConfig.c

    r26911 r26915  
    5252    pxcamSetSearchArgs(definebyqueryArgs);
    5353    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by camRun label", NULL);
     54    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by camRun data_group", NULL);
    5455    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction",          0, "search by camRun reduction class", NULL);
    5556    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-destreaked",           0, "only queue destreaked runs", false);
Note: See TracChangeset for help on using the changeset viewer.