IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 14, 2009, 11:06:18 AM (17 years ago)
Author:
bills
Message:

Add data_group, dist_group, and note to the pipeline. These new columns will be used
for some of the tasks that label was used previously.

File:
1 edited

Legend:

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

    r25567 r25835  
    3232
    3333static bool definebyqueryMode(pxConfig *config);
    34 static bool definerunMode(pxConfig *config);
    3534static bool updaterunMode(pxConfig *config);
    3635static bool revertrunMode(pxConfig *config);
     
    7978    switch (config->mode) {
    8079        MODECASE(DISTTOOL_MODE_DEFINEBYQUERY, definebyqueryMode);
    81         MODECASE(DISTTOOL_MODE_DEFINERUN, definerunMode);
    8280        MODECASE(DISTTOOL_MODE_UPDATERUN, updaterunMode);
    8381        MODECASE(DISTTOOL_MODE_REVERTRUN, revertrunMode);
     
    123121}
    124122
    125 static bool definerunMode(pxConfig *config)
    126 {
    127     PS_ASSERT_PTR_NON_NULL(config, false);
    128 
    129     // required
    130     PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false);
    131     PXOPT_LOOKUP_S64(stage_id, config->args, "-stage_id",  true, false);
    132     PXOPT_LOOKUP_STR(outroot, config->args, "-outroot", true, false);
    133     PXOPT_LOOKUP_S64(target_id, config->args, "-target_id",  true, false);
    134 
    135     // optional
    136     PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false);
    137     PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false);
    138     PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);
    139 
    140     // TODO: check that stage has an expected value
    141     // XXX: all of the following concerns will be managed properly by definebyquery
    142 
    143     // TODO: should we check that stage_id actually exists for stage
    144     // in magicdstool we queue off of a magic_id so the stage_id, exp_id, and cam_id get looked up
    145     // when the run is queued
    146 
    147     if (!distRunInsert(config->dbh,
    148             0,          // dist_id
    149             target_id,
    150             stage,
    151             stage_id,
    152             0,
    153             set_label,
    154             outroot,
    155             clean,
    156             no_magic,
    157             "new",
    158             NULL,       // time_stamp
    159             0           // fault
    160             )) {
    161         psError(PS_ERR_UNKNOWN, false, "database error");
    162         return false;
    163     }
    164 
    165     return true;
    166 }
    167123
    168124static bool definebyqueryMode(pxConfig *config)
     
    178134    PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false);
    179135    PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);
     136    PXOPT_LOOKUP_STR(set_note, config->args, "-set_note", false, false);
     137
    180138    PXOPT_LOOKUP_S64(limit, config->args, "-limit", false, false);
    181139    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     
    191149
    192150    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     151    PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", false, false);
    193152
    194153    psString query = NULL;
     
    209168            psStringAppend(&query, " AND (chipRun.label = '%s')", label);
    210169        }
     170        if (dist_group) {
     171            psStringAppend(&query, " AND (chipRun.dist_group = '%s')", dist_group);
     172        }
    211173    } else if (!strcmp(stage, "chip")) {
    212174        magicRunType = "chipRun";
     
    222184            psStringAppend(&query, " AND (chipRun.label = '%s')", label);
    223185        }
     186        if (dist_group) {
     187            psStringAppend(&query, " AND (chipRun.dist_group = '%s')", dist_group);
     188        }
    224189    } else if (!strcmp(stage, "camera")) {
    225190        magicRunType = "camRun";    // This is used below to set the magicked business
     
    235200            psStringAppend(&query, " AND (camRun.label = '%s')", label);
    236201        }
     202        if (dist_group) {
     203            psStringAppend(&query, " AND (camRun.dist_group = '%s')", dist_group);
     204        }
    237205    } else if (!strcmp(stage, "fake")) {
    238206        magicRunType = "fakeRun";
     
    246214        if (label) {
    247215            psStringAppend(&query, " AND (fakeRun.label = '%s')", label);
     216        }
     217        if (dist_group) {
     218            psStringAppend(&query, " AND (fakeRun.dist_group = '%s')", dist_group);
    248219        }
    249220        // fake stage doesn't require magic
     
    262233            psStringAppend(&query, " AND (warpRun.label = '%s')", label);
    263234        }
     235        if (dist_group) {
     236            psStringAppend(&query, " AND (warpRun.dist_group = '%s')", dist_group);
     237        }
    264238
    265239    } else if (!strcmp(stage, "diff")) {
     
    276250            psStringAppend(&query, " AND (diffRun.label = '%s')", label);
    277251        }
     252        if (dist_group) {
     253            psStringAppend(&query, " AND (diffRun.dist_group = '%s')", dist_group);
     254        }
    278255
    279256    } else if (!strcmp(stage, "stack")) {
     
    288265        if (label) {
    289266            psStringAppend(&query, " AND (stackRun.label = '%s')", label);
     267        }
     268        if (dist_group) {
     269            psStringAppend(&query, " AND (stackRun.dist_group = '%s')", dist_group);
    290270        }
    291271        // stack stage doesn't require magic
     
    371351        psS64 magic_ds_id = psMetadataLookupS64(NULL, md, "magicked");
    372352        psS64 target_id = psMetadataLookupS64(NULL, md, "target_id");
    373         psString target_label = psMetadataLookupStr(NULL, md, "label");
     353        psString stage_label = psMetadataLookupStr(NULL, md, "label");
    374354        bool clean = psMetadataLookupBool(NULL, md, "clean");
    375355
     
    381361            new_label = set_label;
    382362        } else {
    383             new_label = target_label;
     363            new_label = stage_label;
    384364        }
    385365        distRunRow *row = distRunRowAlloc(
     
    395375                "new",
    396376                NULL,   // time_stamp
    397                 0       // fault
     377                0,       // fault
     378                set_note    // note does not propagate
    398379                );
    399380
     
    12391220
    12401221    // required
    1241     PXOPT_LOOKUP_STR(label, config->args, "-label", true, false);
     1222    PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", true, false);
    12421223    PXOPT_LOOKUP_STR(filter, config->args, "-filter", true, false);
    12431224    PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false);
     
    12501231    distTargetRow *row = distTargetRowAlloc(
    12511232            0,          // target_id
    1252             label,
     1233            dist_group,
    12531234            filter,
    12541235            stage,
     
    12871268    psMetadata *where = psMetadataAlloc();
    12881269    PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "==");
    1289     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     1270    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "==");
    12901271    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");
    12911272    PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
     
    13231304    psMetadata *where = psMetadataAlloc();
    13241305    PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "==");
    1325     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     1306    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE");
    13261307    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");
    13271308    PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
     
    15181499    PXOPT_LOOKUP_S64(target_id, config->args,    "-target_id", false, false);
    15191500    PXOPT_LOOKUP_STR(stage, config->args,        "-stage", false, false);
    1520     PXOPT_LOOKUP_STR(label, config->args,        "-label", false, false);
     1501    PXOPT_LOOKUP_STR(dist_group, config->args,   "-dist_group", false, false);
    15211502    PXOPT_LOOKUP_STR(filter, config->args,       "-filter", false, false);
    15221503    PXOPT_LOOKUP_BOOL(clean, config->args,       "-clean", false);
     
    15281509            error = true;
    15291510        }
    1530         if (!label) {
    1531             psError(PS_ERR_UNKNOWN, !error, "label is required if target_id is not supplied");
     1511        if (!dist_group) {
     1512            psError(PS_ERR_UNKNOWN, !error, "dist_group is required if target_id is not supplied");
    15321513            error = true;
    15331514        }
     
    15391520    // optional
    15401521    PXOPT_LOOKUP_S64(limit, config->args, "-limit", false, false);
    1541     PXOPT_LOOKUP_STR(state, config->args,        "-set_state", false, false);
     1522    PXOPT_LOOKUP_STR(state, config->args,  "-set_state", false, false);
    15421523    if (state) {
    15431524        if (strcmp(state, "enabled") && strcmp(state, "disabled")) {
     
    15551536    PXOPT_COPY_STR(config->args, where, "-dest_name", "rcDestination.name", "==");
    15561537    PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "==");
    1557     PXOPT_COPY_STR(config->args, where, "-label", "label", "LIKE");
     1538    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE");
    15581539    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE");
    15591540    PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
     
    16581639    PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "==");
    16591640    PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
    1660     PXOPT_COPY_STR(config->args, where, "-label", "label", "LIKE");
     1641    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE");
    16611642    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE");
    16621643    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
Note: See TracChangeset for help on using the changeset viewer.