IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11811


Ignore:
Timestamp:
Feb 14, 2007, 4:06:52 PM (19 years ago)
Author:
jhoblitt
Message:

finalize p5tool

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r11789 r11811  
    131131    }
    132132
     133    // get the assigned p5_id
     134    run->p5_id = psDBLastInsertID(config->dbh);
     135
    133136    bool simple = false;
    134137    {
     
    297300    psString query = psStringCopy(
    298301        "SELECT\n"
    299         "   p4Scfile.*\n"
     302        "   p4Scfile.*,\n"
     303        "   p5InputScfile.template\n"
    300304        " FROM p5Run\n"
    301305        " JOIN p5InputScfile\n"
    302306        "   USING(p5_id)\n"
    303307        " JOIN p4Scfile\n"
    304         "   ON p5InputScile.p4_id      = p4Scfile.p4_id\n"
    305         "   ON p5InputScile.skycell_id = p4Scfile.skycell_id\n"
    306         "   ON p5InputScile.tess_id    = p4Scfile.tess_id\n"
    307         "   ON p5InputScile.exp_tag    = p4Scfile.exp_tag\n"
    308         "   ON p5InputScile.p3_version = p4Scfile.p3_versiong\n"
     308        "   ON p5InputScfile.p4_id      = p4Scfile.p4_id\n"
     309        "  AND p5InputScfile.skycell_id = p4Scfile.skycell_id\n"
     310        "  AND p5InputScfile.tess_id    = p4Scfile.tess_id\n"
     311        "  AND p5InputScfile.exp_tag    = p4Scfile.exp_tag\n"
     312        "  AND p5InputScfile.p3_version = p4Scfile.p3_version\n"
    309313        " WHERE\n"
    310314        "   p5Run.state = 'run'\n"
     
    389393    // find all rawImfiles matching the default query
    390394    psString query = psStringCopy(
    391         "SELECT\n"
    392         "   p4Scfile.*\n"
     395        "SELECT DISTINCT\n"
     396        "   p5Run.p5_id\n"
    393397        " FROM p5Run\n"
    394398        " JOIN p5InputScfile\n"
    395399        "   USING(p5_id)\n"
    396400        " JOIN p4Scfile\n"
    397         "   ON p5InputScile.p4_id      = p4Scfile.p4_id\n"
    398         "   ON p5InputScile.skycell_id = p4Scfile.skycell_id\n"
    399         "   ON p5InputScile.tess_id    = p4Scfile.tess_id\n"
    400         "   ON p5InputScile.exp_tag    = p4Scfile.exp_tag\n"
    401         "   ON p5InputScile.p3_version = p4Scfile.p3_versiong\n"
     401        "   ON p5InputScfile.p4_id      = p4Scfile.p4_id\n"
     402        "  AND p5InputScfile.skycell_id = p4Scfile.skycell_id\n"
     403        "  AND p5InputScfile.tess_id    = p4Scfile.tess_id\n"
     404        "  AND p5InputScfile.exp_tag    = p4Scfile.exp_tag\n"
     405        "  AND p5InputScfile.p3_version = p4Scfile.p3_version\n"
    402406        " LEFT JOIN p5DiffScfile\n"
    403         "   USING(p5_id, skycell_id, tess_id, exp_tag, p3_version)\n"
     407        "   ON p5InputScfile.p5_id      = p5DiffScfile.p5_id\n"
     408        "  AND p5InputScfile.skycell_id = p5DiffScfile.skycell_id\n"
     409        "  AND p5InputScfile.tess_id    = p5DiffScfile.tess_id\n"
    404410        " WHERE\n"
    405411        "   p5Run.state = 'run'\n"
    406         "   AND p4DiffScfile.p5_id IS NULL\n"
    407         "   AND p4DiffScfile.skycell_id IS NULL\n"
    408         "   AND p4DiffScfile.tess_id IS NULL\n"
    409         "   AND p4DiffScfile.exp_tag IS NULL\n"
    410         "   AND p4DiffScfile.p3_version IS NULL\n"
     412        "   AND p5DiffScfile.p5_id IS NULL\n"
     413        "   AND p5DiffScfile.skycell_id IS NULL\n"
     414        "   AND p5DiffScfile.tess_id IS NULL\n"
    411415    );
    412416
     
    511515    }
    512516
    513     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    514     if (!status) {
    515         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    516         return false;
    517     }
    518     if (!exp_tag) {
    519         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    520         return false;
    521     }
    522 
    523517    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    524518    if (!status) {
     
    531525    }
    532526
    533     // defaults to 0
    534     psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version");
    535     if (!status) {
    536         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");
    537         return false;
    538     }
    539 
    540527    // optional
    541528    psF64 bg = psMetadataLookupF64(&status, config->args, "-bg");
     
    552539
    553540
    554     // XXX need to validate that this coresponds to an p4InputImfile
    555541    if (!p5DiffScfileInsert(config->dbh,
    556542            (psS32)atoi(p5_id),
    557543            skycell_id,
    558544            tess_id,
    559             exp_tag,
    560             p3_version,
    561545            uri,
    562546            bg,
     
    587571        "   p5DiffScfile.*\n"
    588572        " FROM p5Run\n"
    589         " JOIN p5Scfile\n"
     573        " JOIN p5DiffScfile\n"
    590574        "   USING(p5_id)\n"
    591575        " WHERE\n"
     
    657641}
    658642
    659 static bool setp5RunState(pxConfig *config, const char *p4_id, const char *state)
    660 {
    661     PS_ASSERT_PTR_NON_NULL(p4_id, false);
     643static bool setp5RunState(pxConfig *config, const char *p5_id, const char *state)
     644{
     645    PS_ASSERT_PTR_NON_NULL(p5_id, false);
    662646    PS_ASSERT_PTR_NON_NULL(state, false);
    663647
     
    670654    ) {
    671655        psError(PS_ERR_UNKNOWN, false,
    672                 "invalid p4Run state: %s", state);
    673         return false;
    674     }
    675 
    676     char *query = "UPDATE p4Run SET state = '%s' WHERE p4_id = '%s'";
    677     if (!p_psDBRunQuery(config->dbh, query, state, p4_id)) {
     656                "invalid p5Run state: %s", state);
     657        return false;
     658    }
     659
     660    char *query = "UPDATE p5Run SET state = '%s' WHERE p5_id = '%s'";
     661    if (!p_psDBRunQuery(config->dbh, query, state, p5_id)) {
    678662        psError(PS_ERR_UNKNOWN, false,
    679                 "failed to change state for p4_id %s", p4_id);
    680         return false;
    681     }
    682 
    683     return true;
    684 }
     663                "failed to change state for p5_id %s", p5_id);
     664        return false;
     665    }
     666
     667    return true;
     668}
  • trunk/ippTools/src/difftoolConfig.c

    r11789 r11811  
    127127    psMetadataAddStr(adddiffscfileArgs, PS_LIST_TAIL, "-tess_id",  0,
    128128            "define tessellation ID (required)", NULL);
    129     psMetadataAddStr(adddiffscfileArgs, PS_LIST_TAIL, "-exp_tag", 0,
    130             "define exposure tag (required)", NULL);
    131     psMetadataAddS32(adddiffscfileArgs, PS_LIST_TAIL, "-p3_version", 0,
    132             "define phase 3 version of exposure tag (required)", 0);
    133129    psMetadataAddStr(adddiffscfileArgs, PS_LIST_TAIL, "-uri", 0,
    134130            "define URI of file (required)", 0);
     
    146142    psMetadataAddStr(diffscfileArgs, PS_LIST_TAIL, "-tess_id",  0,
    147143            "define tessellation ID (required)", NULL);
    148     psMetadataAddStr(diffscfileArgs, PS_LIST_TAIL, "-exp_tag", 0,
    149             "define exposure tag (required)", NULL);
    150     psMetadataAddS32(diffscfileArgs, PS_LIST_TAIL, "-p3_version", 0,
    151             "define phase 3 version of exposure tag (required)", 0);
    152144    psMetadataAddU64(diffscfileArgs, PS_LIST_TAIL, "-limit",  0,
    153145            "limit result set to N items", 0);
     
    249241    psString str = NULL;
    250242    bool status = false;
     243    if ((str = psMetadataLookupStr(&status, config->args, "-p5_id"))) {
     244        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p5_id", 0, "==", (psS32)atoi(str))) {
     245            psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");
     246            goto FAIL;
     247        }
     248    }
     249}
     250{
     251    psString str = NULL;
     252    bool status = false;
    251253    if ((str = psMetadataLookupStr(&status, config->args, "-p4_id"))) {
    252254        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p4_id", 0, "==", (psS32)atoi(str))) {
Note: See TracChangeset for help on using the changeset viewer.