IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 26, 2010, 11:18:32 AM (16 years ago)
Author:
bills
Message:

add -use_alternate to -definebyquery args. Remove selection by magic_ds_id. Not needed made things more complex

File:
1 edited

Legend:

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

    r27235 r27459  
    137137
    138138    // optional
    139     PXOPT_LOOKUP_S64(magic_ds_id, config->args, "-magic_ds_id",  false, false);
     139    PXOPT_LOOKUP_BOOL(use_alternate, config->args, "-use_alternate", false);
    140140    PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false);
    141141    PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);
     
    145145    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    146146
    147     PXOPT_LOOKUP_BOOL(dry_run, config->args, "-dry_run", false);
     147    PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
     148
     149    if (use_alternate) {
     150        if (strcmp(stage, "raw")) {
     151            psError(PXTOOLS_ERR_SYS, true, "alternate inputs only supported for raw stage");
     152            return false;
     153        }
     154        if (no_magic) {
     155            psError(PXTOOLS_ERR_SYS, true, "no_magic forbidden with alternate inputs");
     156            return false;
     157        }
     158    }
    148159
    149160    // select arguments
     
    161172    psString runJoinStr = NULL;
    162173    if (!strcmp(stage, "raw")) {
    163         magicRunType = "rawExp";
    164         runJoinStr = "rawExp.exp_id";
     174        if (! use_alternate ) {
     175            magicRunType = "rawExp";
     176            runJoinStr = "rawExp.exp_id";
     177        } else {
     178            magicRunType = "camRun";
     179            runJoinStr = "camRun.exp_id";
     180        }
    165181        query = pxDataGet("disttool_definebyquery_raw.sql");
    166182        if (!query) {
     
    170186        }
    171187
    172         // for raw stage we select by chipRun.label because raw labels typically aren't set
     188        // for raw stage we select by camRun.label and dist_group because rawExp doesn't have those columns
    173189        if (label) {
    174             psStringAppend(&query, " AND (chipRun.label = '%s')", label);
     190            psStringAppend(&query, " AND (camRun.label = '%s')", label);
    175191        }
    176192        if (dist_group) {
    177             psStringAppend(&query, " AND (chipRun.dist_group = '%s')", dist_group);
     193            psStringAppend(&query, " AND (camRun.dist_group = '%s')", dist_group);
    178194        }
    179195    } else if (!strcmp(stage, "chip")) {
     
    301317    }
    302318
     319    if (!strcmp(stage, "raw")) {
     320        if (!no_magic) {
     321            psStringAppend(&query, " AND (magicDSRun.re_place = %d)", !use_alternate);
     322            psStringAppend(&query, " AND (camRun.state = 'full')");
     323        }
     324    }
     325
    303326    if (psListLength(where->list)) {
    304327        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     
    311334
    312335    if (!no_magic) {
    313         psStringAppend(&query, " AND (%s.magicked)", magicRunType);
    314 
    315         // is selecting by magic_ds_id really interesting?
     336        psStringAppend(&query, " AND (%s.magicked > 0)", magicRunType);
     337
     338#ifdef notdef
     339        // XXX: is selecting by magic_ds_id really interesting? I declare no
    316340        if (magic_ds_id) {
    317341            if (!runJoinStr) {
     
    324348            psStringAppend(&query, " AND (magicDSRun.state = 'full' AND magicDSRun.re_place AND (magicDSRun.magic_ds_id = %" PRId64 "))", magic_ds_id);
    325349        }
     350#endif
    326351    }
    327352
     
    352377
    353378
    354     if (dry_run) {
     379    if (pretend) {
    355380        if (!ippdbPrintMetadatas(stdout, output, "newdistRuns", true)) {
    356381            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     
    399424                clean,
    400425                no_magic,
     426                use_alternate,
    401427                "new",
    402428                NULL,    // time_stamp
Note: See TracChangeset for help on using the changeset viewer.