IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12024 for trunk/ippTools/src


Ignore:
Timestamp:
Feb 23, 2007, 3:41:56 PM (19 years ago)
Author:
jhoblitt
Message:

s/p0/reg/g
s/p1/guide/g
s/p2/chip/g
s/p6/stack/g
s/p5/diff/g
s/p4/warp/g
s/p3/cam/g

Location:
trunk/ippTools/src
Files:
14 edited

Legend:

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

    r11997 r12024  
    9696    psString query = psStringCopy(
    9797            "SELECT"
    98             "   p3PendingExp.*,"
     98            "   camPendingExp.*,"
    9999            "   rawExp.camera,"
    100100            "   rawExp.workdir"
    101             " FROM p3PendingExp"
     101            " FROM camPendingExp"
    102102            " JOIN rawExp"
    103103            "   USING(exp_tag)"
    104             " LEFT JOIN p3ProcessedExp"
     104            " LEFT JOIN camProcessedExp"
    105105            "   USING(exp_tag)"
    106             " LEFT JOIN p3Mask"
    107             "   ON p3PendingExp.label = p3Mask.label"
     106            " LEFT JOIN camMask"
     107            "   ON camPendingExp.label = camMask.label"
    108108            " WHERE"
    109             "   p3ProcessedExp.exp_tag IS NULL"
    110             "   AND p3Mask.label IS NULL"
     109            "   camProcessedExp.exp_tag IS NULL"
     110            "   AND camMask.label IS NULL"
    111111    );
    112112
    113113    if (config->where) {
    114         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p3PendingExp");
     114        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "camPendingExp");
    115115        psStringAppend(&query, " AND %s", whereClause);
    116116        psFree(whereClause);
     
    138138    if (!psArrayLength(output)) {
    139139        // XXX check psError here
    140         psError(PS_ERR_UNKNOWN, false, "no p3PendingExp rows found");
     140        psError(PS_ERR_UNKNOWN, false, "no camPendingExp rows found");
    141141        psFree(output);
    142142        return true;
     
    154154
    155155    // negate simple so the default is true
    156     if (!ippdbPrintMetadatas(stdout, output, "p3PendingExp", !simple)) {
     156    if (!ippdbPrintMetadatas(stdout, output, "camPendingExp", !simple)) {
    157157        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    158158        psFree(output);
     
    171171    psString query = psStringCopy(
    172172            "SELECT"
    173             "   p2ProcessedImfile.*,"
     173            "   chipProcessedImfile.*,"
    174174            "   rawExp.camera,"   
    175175            "   rawExp.workdir"   
    176             " FROM p3PendingExp"
    177             " JOIN p2ProcessedImfile"
    178             "   USING(exp_tag, p2_version)"
     176            " FROM camPendingExp"
     177            " JOIN chipProcessedImfile"
     178            "   USING(exp_tag, chip_version)"
    179179            " JOIN rawExp"
    180180            "   USING(exp_tag)"
    181             " LEFT JOIN p3ProcessedExp"
     181            " LEFT JOIN camProcessedExp"
    182182            "   USING(exp_tag)"
    183             " LEFT JOIN p3Mask"
    184             "   ON p3PendingExp.label = p3Mask.label"
     183            " LEFT JOIN camMask"
     184            "   ON camPendingExp.label = camMask.label"
    185185            " WHERE"
    186             "   p3ProcessedExp.exp_tag IS NULL"
    187             "   AND p3Mask.label IS NULL"
     186            "   camProcessedExp.exp_tag IS NULL"
     187            "   AND camMask.label IS NULL"
    188188    );
    189189
    190190    if (config->where) {
    191         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p2ProcessedImfile");
     191        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipProcessedImfile");
    192192        psStringAppend(&query, " AND %s", whereClause);
    193193        psFree(whereClause);
     
    208208    if (!psArrayLength(output)) {
    209209        // XXX check psError here
    210         psError(PS_ERR_UNKNOWN, false, "no pending p2ProcessedImfile rows found");
     210        psError(PS_ERR_UNKNOWN, false, "no pending chipProcessedImfile rows found");
    211211        psFree(output);
    212212        return true;
     
    224224
    225225    // negate simple so the default is true
    226     if (!ippdbPrintMetadatas(stdout, output, "p2ProcessedImfile", !simple)) {
     226    if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
    227227        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    228228        psFree(output);
     
    362362
    363363    psString query = psStringCopy(
    364         "SELECT p3PendingExp.*"
    365         " FROM p3PendingExp"
    366         " LEFT JOIN p3ProcessedExp"
     364        "SELECT camPendingExp.*"
     365        " FROM camPendingExp"
     366        " LEFT JOIN camProcessedExp"
    367367        "   USING(exp_tag)"
    368368        " WHERE"
    369         "   p3ProcessedExp.exp_tag IS NULL"
    370         "   AND p3PendingExp.exp_tag = '%s'"
     369        "   camProcessedExp.exp_tag IS NULL"
     370        "   AND camPendingExp.exp_tag = '%s'"
    371371    );
    372372
     
    384384    }
    385385    if (!psArrayLength(output)) {
    386         psError(PS_ERR_UNKNOWN, false, "no p3PendingExp rows found");
     386        psError(PS_ERR_UNKNOWN, false, "no camPendingExp rows found");
    387387        psFree(output);
    388388        return true;
     
    390390
    391391    // start a transaction so we don't end up with an exp_tag is both
    392     // p3PendingExp & p3ProcessedExp
     392    // camPendingExp & camProcessedExp
    393393    if (!psDBTransaction(config->dbh)) {
    394394        psError(PS_ERR_UNKNOWN, false, "database error");
     
    397397    }
    398398
    399     p3PendingExpRow *pendingRow = p3PendingExpObjectFromMetadata(output->data[0]);
     399    camPendingExpRow *pendingRow = camPendingExpObjectFromMetadata(output->data[0]);
    400400    psFree(output);
    401     // create a new p3ProcessedImfile object
    402     p3ProcessedExpRow *row = p3ProcessedExpRowAlloc(
     401    // create a new camProcessedImfile object
     402    camProcessedExpRow *row = camProcessedExpRowAlloc(
    403403        exp_tag,
    404         pendingRow->p3_version,
    405         pendingRow->p2_version,
     404        pendingRow->cam_version,
     405        pendingRow->chip_version,
    406406        pendingRow->label,
    407407        uri,
     
    422422    );
    423423
    424     // insert the new row into the p3ProcessedImfile table
    425     if (!p3ProcessedExpInsertObject(config->dbh, row)) {
     424    // insert the new row into the camProcessedImfile table
     425    if (!camProcessedExpInsertObject(config->dbh, row)) {
    426426        // rollback
    427427        if (!psDBRollback(config->dbh)) {
     
    435435    psFree(row);
    436436
    437     // delete the p3PendingExp row from the database
    438     if (!p3PendingExpDeleteObject(config->dbh, pendingRow)) {
     437    // delete the camPendingExp row from the database
     438    if (!camPendingExpDeleteObject(config->dbh, pendingRow)) {
    439439        // rollback
    440440        if (!psDBRollback(config->dbh)) {
     
    448448    psFree(pendingRow);
    449449
    450     // point of no return for p3PendingExp -> p3ProcessedExp
     450    // point of no return for camPendingExp -> camProcessedExp
    451451    if (!psDBCommit(config->dbh)) {
    452452        psError(PS_ERR_UNKNOWN, false, "database error");
     
    476476    psString query = psStringCopy(
    477477            "SELECT"
    478             "   p3ProcessedExp.*,"
     478            "   camProcessedExp.*,"
    479479            "   rawExp.camera,"
    480480            "   rawExp.workdir"
    481             " FROM p3ProcessedExp"
     481            " FROM camProcessedExp"
    482482            " JOIN rawExp"
    483483            "   USING(exp_tag)"   
    484484            " WHERE"
    485             "   p3ProcessedExp.exp_tag IS NOT NULL"
     485            "   camProcessedExp.exp_tag IS NOT NULL"
    486486    );
    487487
     
    494494    if (faulted) {
    495495        // list only faulted rows
    496         psStringAppend(&query, " %s", "AND p3ProcessedExp.fault != 0");
     496        psStringAppend(&query, " %s", "AND camProcessedExp.fault != 0");
    497497    } else {
    498498        // don't list faulted rows
    499         psStringAppend(&query, " %s", "AND p3ProcessedExp.fault = 0");
     499        psStringAppend(&query, " %s", "AND camProcessedExp.fault = 0");
    500500    }
    501501
     
    521521    if (!psArrayLength(output)) {
    522522        // XXX check psError here
    523         psError(PS_ERR_UNKNOWN, false, "no p3ProcessedExp rows found");
     523        psError(PS_ERR_UNKNOWN, false, "no camProcessedExp rows found");
    524524        psFree(output);
    525525        return true;
     
    537537
    538538    // negate simple so the default is true
    539     if (!ippdbPrintMetadatas(stdout, output, "p3ProcessedExp", !simple)) {
     539    if (!ippdbPrintMetadatas(stdout, output, "camProcessedExp", !simple)) {
    540540        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    541541        psFree(output);
     
    560560    }
    561561
    562     if (!pxSetFaultCode(config->dbh, "p3ProcessedExp", config->where, code)) {
     562    if (!pxSetFaultCode(config->dbh, "camProcessedExp", config->where, code)) {
    563563        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    564564        return false;
     
    584584    }
    585585
    586     if (!p3MaskInsert(config->dbh, label)) {
     586    if (!camMaskInsert(config->dbh, label)) {
    587587        psError(PS_ERR_UNKNOWN, false, "database error");
    588588        return false;
     
    596596    PS_ASSERT_PTR_NON_NULL(config, false);
    597597
    598     psString query = psStringCopy("SELECT * FROM p3Mask");
     598    psString query = psStringCopy("SELECT * FROM camMask");
    599599
    600600    if (!p_psDBRunQuery(config->dbh, query)) {
     
    612612    if (!psArrayLength(output)) {
    613613        // XXX check psError here
    614         psError(PS_ERR_UNKNOWN, false, "no p3Mask rows found");
     614        psError(PS_ERR_UNKNOWN, false, "no camMask rows found");
    615615        psFree(output);
    616616        return true;
     
    628628
    629629    // negative simple so the default is true
    630     if (!ippdbPrintMetadatas(stdout, output, "p3Mask", !simple)) {
     630    if (!ippdbPrintMetadatas(stdout, output, "camMask", !simple)) {
    631631        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    632632        psFree(output);
     
    654654    }
    655655
    656     char *query = "DELETE FROM p3Mask WHERE label = '%s'";
     656    char *query = "DELETE FROM camMask WHERE label = '%s'";
    657657
    658658    if (!p_psDBRunQuery(config->dbh, query, label)) {
  • trunk/ippTools/src/camtoolConfig.c

    r11997 r12024  
    4848    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
    4949            "search by exposure ID", NULL);
    50     psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-p2_version", 0,
    51             "search for exposures with this p2 version", -1);
    52     psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-p3_version", 0,
    53             "search for exposures with this p3 version", -1);
     50    psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-chip_version", 0,
     51            "search for exposures with this chip version", -1);
     52    psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-cam_version", 0,
     53            "search for exposures with this cam version", -1);
    5454    psMetadataAddU64(pendingexpArgs, PS_LIST_TAIL, "-limit",  0,
    5555        "limit result set to N items", 0);
     
    107107    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
    108108            "search by exposure ID", NULL);
    109     psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-p2_version", 0,
    110             "search for exposures with this p2 version", -1);
    111     psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-p3_version", 0,
    112             "search for exposures with this p3 version", -1);
     109    psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-chip_version", 0,
     110            "search for exposures with this chip version", -1);
     111    psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-cam_version", 0,
     112            "search for exposures with this cam version", -1);
    113113    psMetadataAddU64(processedexpArgs, PS_LIST_TAIL, "-limit",  0,
    114114        "limit result set to N items", 0);
  • trunk/ippTools/src/chiptool.c

    r11997 r12024  
    11/*
    2  * p2tool.c
     2 * chiptool.c
    33 *
    44 * Copyright (C) 2006  Joshua Hoblitt
     
    3838static bool unblockMode(pxConfig *config);
    3939
    40 static p2ProcessedImfileRow *p2PendingToProcessedImfile(pxConfig *config, p2PendingImfileRow *imfile);
    41 static p2ProcessedExpRow *p2PendingToProcessedExp(pxConfig *config, p2PendingExpRow *pendingExp);
    42 static p3PendingExpRow *p2PendingToP3PendingExp(pxConfig *config, p2PendingExpRow *pendingExp);
    43 static bool p2ProcessedCompleteExp(pxConfig *config);
     40static chipProcessedImfileRow *chipPendingToProcessedImfile(pxConfig *config, chipPendingImfileRow *imfile);
     41static chipProcessedExpRow *chipPendingToProcessedExp(pxConfig *config, chipPendingExpRow *pendingExp);
     42static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp);
     43static bool chipProcessedCompleteExp(pxConfig *config);
    4444
    4545# define MODECASE(caseName, func) \
     
    166166    // XXX this does not work!!!
    167167    psString query = psStringCopy(
    168             "INSERT INTO p2PendingExp\n"
     168            "INSERT INTO chipPendingExp\n"
    169169            "   SElECT\n"
    170170            "       exp_tag,\n"
    171171            "       'my recipe',\n"  // recipe
    172             "       255\n"         // p1_version
    173             "       255\n"         // p2_version
     172            "       255\n"         // guide_version
     173            "       255\n"         // chip_version
    174174            "       %s\n"
    175175            "   FROM rawExp"
    176             "   LEFT JOIN p2ProcessedExp"
     176            "   LEFT JOIN chipProcessedExp"
    177177            "       USING(exp_tag)"
    178178            "   WHERE"
     
    200200    if (!psArrayLength(output)) {
    201201        // XXX check psError here
    202         psError(PS_ERR_UNKNOWN, false, "no p2PendingImfile rows found");
     202        psError(PS_ERR_UNKNOWN, false, "no chipPendingImfile rows found");
    203203        psFree(output);
    204204        return false;
     
    220220
    221221    // XXX does this need to be constrained so that it won't return any results
    222     // if a match p2PendingExp hasn't been registered?
     222    // if a match chipPendingExp hasn't been registered?
    223223    psString query = psStringCopy(
    224224            "SELECT"
    225             "   p2PendingImfile.*,"
     225            "   chipPendingImfile.*,"
    226226            "   rawExp.camera,"
    227227            "   rawExp.workdir"
    228             " FROM p2PendingImfile"
    229             " JOIN p2PendingExp"
     228            " FROM chipPendingImfile"
     229            " JOIN chipPendingExp"
    230230            "   USING(exp_tag)"
    231231            " JOIN rawExp"
    232232            "   USING(exp_tag)"
    233             " LEFT JOIN p2Mask"
    234             "   ON p2PendingExp.label = p2Mask.label"
     233            " LEFT JOIN chipMask"
     234            "   ON chipPendingExp.label = chipMask.label"
    235235            " WHERE"
    236             "   p2Mask.label IS NULL"
     236            "   chipMask.label IS NULL"
    237237        );
    238238
    239239    if (config->where) {
    240         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p2PendingImfile");
     240        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipPendingImfile");
    241241        psStringAppend(&query, " AND %s", whereClause);
    242242        psFree(whereClause);
     
    264264    if (!psArrayLength(output)) {
    265265        // XXX check psError here
    266         psError(PS_ERR_UNKNOWN, false, "no p2PendingImfile rows found");
     266        psError(PS_ERR_UNKNOWN, false, "no chipPendingImfile rows found");
    267267        psFree(output);
    268268        return true;
     
    280280
    281281    // negative simple so the default is true
    282     if (!ippdbPrintMetadatas(stdout, output, "p2PendingImfile", !simple)) {
     282    if (!ippdbPrintMetadatas(stdout, output, "chipPendingImfile", !simple)) {
    283283        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    284284        psFree(output);
     
    296296    PS_ASSERT_PTR_NON_NULL(config, false);
    297297
    298     // select * from p2ProcessedImfiles
     298    // select * from chipProcessedImfiles
    299299    // where
    300     // exp_tag & class_id are not in p2PendingImfile
     300    // exp_tag & class_id are not in chipPendingImfile
    301301
    302302    // add the completed imfile to
    303     // the p2ProcessedeImfile tables
     303    // the chipProcessedeImfile tables
    304304    // remove corresponding entries from the
    305     // p2PendingImfile table
    306     // check to see if any p2PendingExps have no
    307     // associated p2PendingImfiles
    308     // if so move the p2PendingExp(s) to p2ProcessedExp
     305    // chipPendingImfile table
     306    // check to see if any chipPendingExps have no
     307    // associated chipPendingImfiles
     308    // if so move the chipPendingExp(s) to chipProcessedExp
    309309
    310310    psString query = psStringCopy(
    311311        "SELECT DISTINCT"
    312         "   p2PendingImfile.*"
    313         " FROM p2PendingImfile "
    314         " LEFT JOIN p2ProcessedImfile"
     312        "   chipPendingImfile.*"
     313        " FROM chipPendingImfile "
     314        " LEFT JOIN chipProcessedImfile"
    315315        "   USING(exp_tag, class_id)"
    316316        " WHERE"
    317         "  p2ProcessedImfile.exp_tag IS NULL"
    318         "  AND p2ProcessedImfile.class_id IS NULL"
     317        "  chipProcessedImfile.exp_tag IS NULL"
     318        "  AND chipProcessedImfile.class_id IS NULL"
    319319        );
    320320    {
     
    349349        }
    350350
    351         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p2PendingImfile");
     351        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipPendingImfile");
    352352        psFree(where);
    353353        if (whereClause) {
     
    371371    if (!psArrayLength(output)) {
    372372        // XXX check psError here
    373         psError(PS_ERR_UNKNOWN, false, "no p2PendingImfile rows found");
     373        psError(PS_ERR_UNKNOWN, false, "no chipPendingImfile rows found");
    374374        psFree(output);
    375375        return false;
     
    384384    }
    385385
    386     // insert into p2ProcessedImfile
    387     // remove p2PendingImfile entry
     386    // insert into chipProcessedImfile
     387    // remove chipPendingImfile entry
    388388    for (long i = 0; i < psArrayLength(output); i++) {
    389389        psMetadata *row = output->data[i];
    390         // convert metadata into a p2PendingImfile object
    391         p2PendingImfileRow *object = p2PendingImfileObjectFromMetadata(row);
    392         // convert p2PendingImfile object into a p2ProcessedImfile object
    393         p2ProcessedImfileRow *imfile = p2PendingToProcessedImfile(config, object);
     390        // convert metadata into a chipPendingImfile object
     391        chipPendingImfileRow *object = chipPendingImfileObjectFromMetadata(row);
     392        // convert chipPendingImfile object into a chipProcessedImfile object
     393        chipProcessedImfileRow *imfile = chipPendingToProcessedImfile(config, object);
    394394        if (!imfile) {
    395395            // rollback
     
    397397                psError(PS_ERR_UNKNOWN, false, "database error");
    398398            }
    399             psError(PS_ERR_UNKNOWN, false, "failed to convert p2PendingImfile to p2ProcessedImfile");
     399            psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingImfile to chipProcessedImfile");
    400400            psFree(object);
    401401            psFree(output);
    402402            return false;
    403403        }
    404         // insert p2ProccessedImfile object into the database
    405         if (!p2ProcessedImfileInsertObject(config->dbh, imfile)) {
     404        // insert chipProccessedImfile object into the database
     405        if (!chipProcessedImfileInsertObject(config->dbh, imfile)) {
    406406            // rollback
    407407            if (!psDBRollback(config->dbh)) {
     
    415415        }
    416416        psFree(imfile);
    417         // delete the p2PendingImfile object from the database
    418         if (!p2PendingImfileDeleteObject(config->dbh, object)) {
     417        // delete the chipPendingImfile object from the database
     418        if (!chipPendingImfileDeleteObject(config->dbh, object)) {
    419419            // there must be atleast 1 Imfile to get this far
    420420            // rollback
     
    437437    // migration can't happen.
    438438
    439     if (!p2ProcessedCompleteExp(config)) {
     439    if (!chipProcessedCompleteExp(config)) {
    440440        // rollback
    441441        if (!psDBRollback(config->dbh)) {
     
    446446    }
    447447
    448     // point of no return for p2PendingImfile -> p2ProcessedImfile
    449     // point of no return for p2PendingExp -> p2ProcessedExp
     448    // point of no return for chipPendingImfile -> chipProcessedImfile
     449    // point of no return for chipPendingExp -> chipProcessedExp
    450450    if (!psDBCommit(config->dbh)) {
    451451        psError(PS_ERR_UNKNOWN, false, "database error");
     
    475475
    476476    // XXX does this need to be constrained so that it won't return any results
    477     // if a match p2PendingExp hasn't been registered?
     477    // if a match chipPendingExp hasn't been registered?
    478478    psString query = psStringCopy(
    479479            "SELECT"
    480             "   p2ProcessedImfile.*,"
     480            "   chipProcessedImfile.*,"
    481481            "   rawExp.camera,"
    482482            "   rawExp.workdir"
    483             " FROM p2ProcessedImfile"
     483            " FROM chipProcessedImfile"
    484484            " JOIN rawExp"
    485485            "   USING(exp_tag)"
    486486            " WHERE "
    487             "   p2ProcessedImfile.exp_tag is NOT NULL" // bogus test -- just here so there there is a 'WHERE' stmt to append conditionals too
     487            "   chipProcessedImfile.exp_tag is NOT NULL" // bogus test -- just here so there there is a 'WHERE' stmt to append conditionals too
    488488        );
    489489
    490490    if (config->where) {
    491         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p2ProcessedImfile");
     491        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipProcessedImfile");
    492492        psStringAppend(&query, " AND %s", whereClause);
    493493        psFree(whereClause);
     
    496496    if (faulted) {
    497497        // list only faulted rows
    498         psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault != 0");
     498        psStringAppend(&query, " %s", "AND chipProcessedImfile.fault != 0");
    499499    } else {
    500500        // don't list faulted rows
    501         psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault = 0");
     501        psStringAppend(&query, " %s", "AND chipProcessedImfile.fault = 0");
    502502    }
    503503
     
    523523    if (!psArrayLength(output)) {
    524524        // XXX check psError here
    525         psError(PS_ERR_UNKNOWN, false, "no p2ProcessedImfile rows found");
     525        psError(PS_ERR_UNKNOWN, false, "no chipProcessedImfile rows found");
    526526        psFree(output);
    527527        return true;
     
    539539
    540540    // negative simple so the default is true
    541     if (!ippdbPrintMetadatas(stdout, output, "p2ProcessedImfile", !simple)) {
     541    if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
    542542        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    543543        psFree(output);
     
    562562    }
    563563
    564     if (!pxSetFaultCode(config->dbh, "p2ProcessedImfile", config->where, code)) {
     564    if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", config->where, code)) {
    565565        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    566566        return false;
     
    586586    }
    587587
    588     if (!p2MaskInsert(config->dbh, label)) {
     588    if (!chipMaskInsert(config->dbh, label)) {
    589589        psError(PS_ERR_UNKNOWN, false, "database error");
    590590        return false;
     
    599599    PS_ASSERT_PTR_NON_NULL(config, false);
    600600
    601     psString query = psStringCopy("SELECT * FROM p2Mask");
     601    psString query = psStringCopy("SELECT * FROM chipMask");
    602602
    603603    if (!p_psDBRunQuery(config->dbh, query)) {
     
    615615    if (!psArrayLength(output)) {
    616616        // XXX check psError here
    617         psError(PS_ERR_UNKNOWN, false, "no p2Mask rows found");
     617        psError(PS_ERR_UNKNOWN, false, "no chipMask rows found");
    618618        psFree(output);
    619619        return true;
     
    631631
    632632    // negative simple so the default is true
    633     if (!ippdbPrintMetadatas(stdout, output, "p2Mask", !simple)) {
     633    if (!ippdbPrintMetadatas(stdout, output, "chipMask", !simple)) {
    634634        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    635635        psFree(output);
     
    658658    }
    659659
    660     char *query = "DELETE FROM p2Mask WHERE label = '%s'";
     660    char *query = "DELETE FROM chipMask WHERE label = '%s'";
    661661
    662662    if (!p_psDBRunQuery(config->dbh, query, label)) {
     
    670670
    671671
    672 static bool p2ProcessedCompleteExp(pxConfig *config)
     672static bool chipProcessedCompleteExp(pxConfig *config)
    673673{
    674674    PS_ASSERT_PTR_NON_NULL(config, false);
    675675
    676     // look for completed p2PendingExp
    677     // migrate them to p2ProccessedExp & p3PendingExp
    678 
    679     // select * from p2PendingExp
    680     // where exp_tag is not in p2ProcessedExp
    681     // where exp_tag is not in p2PendingImfile
    682     // where the number of entries in p2ProccessedImfile matches the .imfiles
     676    // look for completed chipPendingExp
     677    // migrate them to chipProccessedExp & camPendingExp
     678
     679    // select * from chipPendingExp
     680    // where exp_tag is not in chipProcessedExp
     681    // where exp_tag is not in chipPendingImfile
     682    // where the number of entries in chipProccessedImfile matches the .imfiles
    683683    // entry in rawExp
    684684    psString query = psStringCopy(
    685685        "SELECT DISTINCT"
    686         "   p2PendingExp.*,"
     686        "   chipPendingExp.*,"
    687687        "   rawExp.imfiles,"
    688         "   p2ProcessedImfile.class_id"
    689         " FROM p2PendingExp"
     688        "   chipProcessedImfile.class_id"
     689        " FROM chipPendingExp"
    690690        " JOIN rawExp"
    691         "   ON p2PendingExp.exp_tag = rawExp.exp_tag"
    692         " LEFT JOIN p2ProcessedExp"
    693         "   ON p2PendingExp.exp_tag = p2ProcessedExp.exp_tag"
    694         " LEFT JOIN p2PendingImfile"
    695         "   ON p2PendingExp.exp_tag = p2PendingImfile.exp_tag"
    696         " LEFT JOIN p2ProcessedImfile"
    697         "   ON p2PendingExp.exp_tag = p2ProcessedImfile.exp_tag"
     691        "   ON chipPendingExp.exp_tag = rawExp.exp_tag"
     692        " LEFT JOIN chipProcessedExp"
     693        "   ON chipPendingExp.exp_tag = chipProcessedExp.exp_tag"
     694        " LEFT JOIN chipPendingImfile"
     695        "   ON chipPendingExp.exp_tag = chipPendingImfile.exp_tag"
     696        " LEFT JOIN chipProcessedImfile"
     697        "   ON chipPendingExp.exp_tag = chipProcessedImfile.exp_tag"
    698698        " WHERE"
    699         "  p2ProcessedExp.exp_tag IS NULL"
    700         "  AND p2PendingImfile.exp_tag IS NULL"
    701         "  AND p2ProcessedImfile.exp_tag IS NOT NULL"
     699        "  chipProcessedExp.exp_tag IS NULL"
     700        "  AND chipPendingImfile.exp_tag IS NULL"
     701        "  AND chipProcessedImfile.exp_tag IS NOT NULL"
    702702        " GROUP BY"
    703         "   p2PendingExp.exp_tag"
    704         " HAVING rawExp.imfiles = COUNT(p2ProcessedImfile.class_id)"
     703        "   chipPendingExp.exp_tag"
     704        " HAVING rawExp.imfiles = COUNT(chipProcessedImfile.class_id)"
    705705        );
    706706
     
    719719    if (!psArrayLength(output)) {
    720720        // XXX check psError here
    721         psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");
     721        psError(PS_ERR_UNKNOWN, false, "no chipPendingExp rows found");
    722722        psFree(output);
    723723        return true;
    724724    }
    725725
    726     // insert into p2ProcessedExp
    727     // insert into p3PendingExp
    728     // remove p2PendingExp entry
     726    // insert into chipProcessedExp
     727    // insert into camPendingExp
     728    // remove chipPendingExp entry
    729729    for (long i = 0; i < psArrayLength(output); i++) {
    730730        psMetadata *row = output->data[i];
    731         // convert metadata into a p2PendingExp object
    732         p2PendingExpRow *object = p2PendingExpObjectFromMetadata(row);
     731        // convert metadata into a chipPendingExp object
     732        chipPendingExpRow *object = chipPendingExpObjectFromMetadata(row);
    733733        // do both *Exp type conversion first so we don't insert one and then
    734734        // have to rollback the change as the 2nd failed
    735         // convert p2PendingExp object into a p2ProcesseExp object
    736         p2ProcessedExpRow *processedExp = p2PendingToProcessedExp(config, object);
     735        // convert chipPendingExp object into a chipProcesseExp object
     736        chipProcessedExpRow *processedExp = chipPendingToProcessedExp(config, object);
    737737        if (!processedExp) {
    738             psError(PS_ERR_UNKNOWN, false, "failed to convert p2PendingExp to p2ProcessedExp");
     738            psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to chipProcessedExp");
    739739            psFree(object);
    740740            psFree(output);
    741741            return false;
    742742        }
    743         // convert p2PendingExp object into a p3PendingExp object
    744         p3PendingExpRow *pendingExp = p2PendingToP3PendingExp(config, object);
     743        // convert chipPendingExp object into a camPendingExp object
     744        camPendingExpRow *pendingExp = chipPendingTocamPendingExp(config, object);
    745745        if (!processedExp) {
    746             psError(PS_ERR_UNKNOWN, false, "failed to convert p2PendingExp to p3PendingExp");
     746            psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to camPendingExp");
    747747            psFree(processedExp);
    748748            psFree(object);
     
    750750            return false;
    751751        }
    752         // insert p2ProccessedExp object into the database
    753         if (!p2ProcessedExpInsertObject(config->dbh, processedExp)) {
     752        // insert chipProccessedExp object into the database
     753        if (!chipProcessedExpInsertObject(config->dbh, processedExp)) {
    754754            psError(PS_ERR_UNKNOWN, false, "database error");
    755755            psFree(processedExp);
     
    760760        }
    761761        psFree(processedExp);
    762         // insert p3PendingExp object into the database
    763         if (!p3PendingExpInsertObject(config->dbh, pendingExp)) {
     762        // insert camPendingExp object into the database
     763        if (!camPendingExpInsertObject(config->dbh, pendingExp)) {
    764764            psError(PS_ERR_UNKNOWN, false, "database error");
    765765            psFree(pendingExp);
     
    769769        }
    770770        psFree(pendingExp);
    771         // delete the p2PendingExp object from the database
    772         if (!p2PendingExpDeleteObject(config->dbh, object)) {
     771        // delete the chipPendingExp object from the database
     772        if (!chipPendingExpDeleteObject(config->dbh, object)) {
    773773            // there must be atleast 1 Imfile to get this far
    774774            psError(PS_ERR_UNKNOWN, false, "database error");
     
    786786
    787787
    788 static p2ProcessedImfileRow *p2PendingToProcessedImfile(pxConfig *config, p2PendingImfileRow *imfile)
     788static chipProcessedImfileRow *chipPendingToProcessedImfile(pxConfig *config, chipPendingImfileRow *imfile)
    789789{
    790790    PS_ASSERT_PTR_NON_NULL(config, NULL);
     
    850850    }
    851851
    852     return p2ProcessedImfileRowAlloc(
     852    return chipProcessedImfileRowAlloc(
    853853        imfile->exp_tag,
    854         imfile->p2_version,
    855         imfile->p1_version,
     854        imfile->chip_version,
     855        imfile->guide_version,
    856856        imfile->class_id,
    857857        recipe,
     
    867867
    868868
    869 static p2ProcessedExpRow *p2PendingToProcessedExp(pxConfig *config, p2PendingExpRow *pendingExp)
     869static chipProcessedExpRow *chipPendingToProcessedExp(pxConfig *config, chipPendingExpRow *pendingExp)
    870870{
    871871    PS_ASSERT_PTR_NON_NULL(pendingExp, NULL);
    872872 
    873     return p2ProcessedExpRowAlloc(
     873    return chipProcessedExpRowAlloc(
    874874        pendingExp->exp_tag,
    875         pendingExp->p2_version,
    876         pendingExp->p1_version,
     875        pendingExp->chip_version,
     876        pendingExp->guide_version,
    877877        pendingExp->label,
    878878        pendingExp->expgroup,
     
    882882
    883883
    884 static p3PendingExpRow *p2PendingToP3PendingExp(pxConfig *config, p2PendingExpRow *pendingExp)
     884static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp)
    885885{
    886886    PS_ASSERT_PTR_NON_NULL(pendingExp, NULL);
    887887
    888     return p3PendingExpRowAlloc(
     888    return camPendingExpRowAlloc(
    889889        pendingExp->exp_tag,
    890         0x0,        // p3 version
    891         pendingExp->p2_version,
     890        0x0,        // cam version
     891        pendingExp->chip_version,
    892892        pendingExp->label,
    893893        pendingExp->expgroup,
  • trunk/ippTools/src/dettool.c

    r11855 r12024  
    56955695    if (faulted) {
    56965696        // list only faulted rows
    5697         psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault != 0");
     5697        psStringAppend(&query, " %s", "AND detRunSummary.fault != 0");
    56985698    } else {
    56995699        // don't list faulted rows
    5700         psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault = 0");
     5700        psStringAppend(&query, " %s", "AND detRunSummary.fault = 0");
    57015701    }
    57025702
  • trunk/ippTools/src/dettoolConfig.c

    r11855 r12024  
    942942        int n = 0;
    943943        bool status = false;
    944         if ((n = psMetadataLookupS32(&status, config->args, "-p1_version"))) {
    945             if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p1_version", 0, "==", n)) {
    946                 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");
     944        if ((n = psMetadataLookupS32(&status, config->args, "-guide_version"))) {
     945            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "guide_version", 0, "==", n)) {
     946                psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version");
    947947                psFree(config);
    948948                return NULL;
  • trunk/ippTools/src/difftool.c

    r11997 r12024  
    3939static bool diffskyfileMode(pxConfig *config);
    4040
    41 static bool setp5RunState(pxConfig *config, const char *p4_id, const char *state);
     41static bool setdiffRunState(pxConfig *config, const char *warp_id, const char *state);
    4242
    4343# define MODECASE(caseName, func) \
     
    139139    }
    140140
    141     p5RunRow *run = p5RunRowAlloc(
     141    diffRunRow *run = diffRunRowAlloc(
    142142            0,          // ID
    143143            "reg",      // state
     
    150150    psFree(registered);
    151151    if (!run) {
    152         psError(PS_ERR_UNKNOWN, false, "failed to alloc p5Run object");
     152        psError(PS_ERR_UNKNOWN, false, "failed to alloc diffRun object");
    153153        return true;
    154154    }
    155     if (!p5RunInsertObject(config->dbh, run)) {
     155    if (!diffRunInsertObject(config->dbh, run)) {
    156156        psError(PS_ERR_UNKNOWN, false, "database error");
    157157        psFree(run);
     
    159159    }
    160160
    161     // get the assigned p5_id
    162     run->p5_id = psDBLastInsertID(config->dbh);
     161    // get the assigned diff_id
     162    run->diff_id = psDBLastInsertID(config->dbh);
    163163
    164164    bool simple = false;
     
    173173    }
    174174
    175     if (!p5RunPrintObject(stdout, run, !simple)) {
     175    if (!diffRunPrintObject(stdout, run, !simple)) {
    176176            psError(PS_ERR_UNKNOWN, false, "failed to print object");
    177177            psFree(run);
     
    190190
    191191    bool status = false;
    192     psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id");
    193     if (!status) {
    194         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p5_id");
    195         return false;
    196     }
    197     if (!p5_id) {
    198         psError(PS_ERR_UNKNOWN, true, "-p5_id is required");
     192    psString diff_id = psMetadataLookupStr(&status, config->args, "-diff_id");
     193    if (!status) {
     194        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -diff_id");
     195        return false;
     196    }
     197    if (!diff_id) {
     198        psError(PS_ERR_UNKNOWN, true, "-diff_id is required");
    199199        return false;
    200200    }
     
    212212    if (state) {
    213213        // set detRun.state to state
    214         return setp5RunState(config, p5_id, state);
     214        return setdiffRunState(config, diff_id, state);
    215215    }
    216216
     
    224224
    225225    bool status = false;
    226     psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id");
    227     if (!status) {
    228         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p5_id");
    229         return false;
    230     }
    231     if (!p5_id) {
    232         psError(PS_ERR_UNKNOWN, true, "-p5_id is required");
    233         return false;
    234     }
    235 
    236     psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
    237     if (!status) {
    238         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");
    239         return false;
    240     }
    241     if (!p5_id) {
    242         psError(PS_ERR_UNKNOWN, true, "-p5_id is required");
     226    psString diff_id = psMetadataLookupStr(&status, config->args, "-diff_id");
     227    if (!status) {
     228        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -diff_id");
     229        return false;
     230    }
     231    if (!diff_id) {
     232        psError(PS_ERR_UNKNOWN, true, "-diff_id is required");
     233        return false;
     234    }
     235
     236    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
     237    if (!status) {
     238        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id");
     239        return false;
     240    }
     241    if (!diff_id) {
     242        psError(PS_ERR_UNKNOWN, true, "-diff_id is required");
    243243        return false;
    244244    }
     
    277277    }
    278278
    279     // XXX need to validate the p4_id here
     279    // XXX need to validate the warp_id here
    280280    // XXX instead of validiting it here we should just use forgein key
    281281    // constrants
    282     if (!p5InputSkyfileInsert(config->dbh,
    283             (psS32)atoi(p5_id),
    284             (psS32)atoi(p4_id),
     282    if (!diffInputSkyfileInsert(config->dbh,
     283            (psS32)atoi(diff_id),
     284            (psS32)atoi(warp_id),
    285285            skycell_id,
    286286            tess_id,
     
    310310    psString query = psStringCopy(
    311311        "SELECT\n"
    312         "   p4Skyfile.*,\n"
    313         "   p5InputSkyfile.template\n"
    314         " FROM p5Run\n"
    315         " JOIN p5InputSkyfile\n"
    316         "   USING(p5_id)\n"
    317         " JOIN p4Skyfile\n"
    318         "   ON p5InputSkyfile.p4_id      = p4Skyfile.p4_id\n"
    319         "  AND p5InputSkyfile.skycell_id = p4Skyfile.skycell_id\n"
    320         "  AND p5InputSkyfile.tess_id    = p4Skyfile.tess_id\n"
     312        "   warpSkyfile.*,\n"
     313        "   diffInputSkyfile.template\n"
     314        " FROM diffRun\n"
     315        " JOIN diffInputSkyfile\n"
     316        "   USING(diff_id)\n"
     317        " JOIN warpSkyfile\n"
     318        "   ON diffInputSkyfile.warp_id      = warpSkyfile.warp_id\n"
     319        "  AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id\n"
     320        "  AND diffInputSkyfile.tess_id    = warpSkyfile.tess_id\n"
    321321        " WHERE\n"
    322         "   p5Run.state = 'run'\n"
     322        "   diffRun.state = 'run'\n"
    323323    );
    324324
    325325    if (config->where) {
    326         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p5InputSkyfile");
     326        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "diffInputSkyfile");
    327327        psStringAppend(&query, " AND %s", whereClause);
    328328        psFree(whereClause);
     
    358358    }
    359359    if (!psArrayLength(output)) {
    360         psError(PS_ERR_UNKNOWN, false, "no p5InputSkyfile rows found");
     360        psError(PS_ERR_UNKNOWN, false, "no diffInputSkyfile rows found");
    361361        psFree(output);
    362362        return true;
     
    375375    if (psArrayLength(output)) {
    376376        // negative simple so the default is true
    377         if (!ippdbPrintMetadatas(stdout, output, "p5InputSkyfile", !simple)) {
     377        if (!ippdbPrintMetadatas(stdout, output, "diffInputSkyfile", !simple)) {
    378378            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    379379            psFree(output);
     
    402402    psString query = psStringCopy(
    403403        "SELECT DISTINCT\n"
    404         "   p5Run.p5_id\n"
    405         " FROM p5Run\n"
    406         " JOIN p5InputSkyfile\n"
    407         "   USING(p5_id)\n"
    408         " JOIN p4Skyfile\n"
    409         "   ON p5InputSkyfile.p4_id      = p4Skyfile.p4_id\n"
    410         "  AND p5InputSkyfile.skycell_id = p4Skyfile.skycell_id\n"
    411         "  AND p5InputSkyfile.tess_id    = p4Skyfile.tess_id\n"
    412         " LEFT JOIN p5DiffSkyfile\n"
    413         "   ON p5InputSkyfile.p5_id      = p5DiffSkyfile.p5_id\n"
     404        "   diffRun.diff_id\n"
     405        " FROM diffRun\n"
     406        " JOIN diffInputSkyfile\n"
     407        "   USING(diff_id)\n"
     408        " JOIN warpSkyfile\n"
     409        "   ON diffInputSkyfile.warp_id      = warpSkyfile.warp_id\n"
     410        "  AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id\n"
     411        "  AND diffInputSkyfile.tess_id    = warpSkyfile.tess_id\n"
     412        " LEFT JOIN diffSkyfile\n"
     413        "   ON diffInputSkyfile.diff_id      = diffSkyfile.diff_id\n"
    414414        " WHERE\n"
    415         "   p5Run.state = 'run'\n"
    416         "   AND p5DiffSkyfile.p5_id IS NULL\n"
     415        "   diffRun.state = 'run'\n"
     416        "   AND diffSkyfile.diff_id IS NULL\n"
    417417    );
    418418
    419419    if (config->where) {
    420         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p5Skyfile");
     420        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "diffSkyfile");
    421421        psStringAppend(&query, " AND %s", whereClause);
    422422        psFree(whereClause);
     
    452452    }
    453453    if (!psArrayLength(output)) {
    454         psError(PS_ERR_UNKNOWN, false, "no p5Skyfile rows found");
     454        psError(PS_ERR_UNKNOWN, false, "no diffSkyfile rows found");
    455455        psFree(output);
    456456        return true;
     
    469469    if (psArrayLength(output)) {
    470470        // negative simple so the default is true
    471         if (!ippdbPrintMetadatas(stdout, output, "p5Skyfile", !simple)) {
     471        if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
    472472            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    473473            psFree(output);
     
    487487
    488488    bool status = false;
    489     psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id");
    490     if (!status) {
    491         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p5_id");
    492         return false;
    493     }
    494     if (!p5_id) {
    495         psError(PS_ERR_UNKNOWN, true, "-p5_id is required");
     489    psString diff_id = psMetadataLookupStr(&status, config->args, "-diff_id");
     490    if (!status) {
     491        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -diff_id");
     492        return false;
     493    }
     494    if (!diff_id) {
     495        psError(PS_ERR_UNKNOWN, true, "-diff_id is required");
    496496        return false;
    497497    }
     
    525525    }
    526526
    527     if (!p5DiffSkyfileInsert(config->dbh,
    528             (psS32)atoi(p5_id),
     527    if (!diffSkyfileInsert(config->dbh,
     528            (psS32)atoi(diff_id),
    529529            uri,
    530530            bg,
     
    538538    }
    539539
    540     if (!setp5RunState(config, p5_id, "stop")) {
     540    if (!setdiffRunState(config, diff_id, "stop")) {
    541541        if (!psDBRollback(config->dbh)) {
    542542            psError(PS_ERR_UNKNOWN, false, "database error");
     
    570570    psString query = psStringCopy(
    571571        "SELECT\n"
    572         "   p5Run.skycell_id,\n"
    573         "   p5Run.tess_id,\n"
    574         "   p5DiffSkyfile.*\n"
    575         " FROM p5Run\n"
    576         " JOIN p5DiffSkyfile\n"
    577         "   USING(p5_id)\n"
     572        "   diffRun.skycell_id,\n"
     573        "   diffRun.tess_id,\n"
     574        "   diffSkyfile.*\n"
     575        " FROM diffRun\n"
     576        " JOIN diffSkyfile\n"
     577        "   USING(diff_id)\n"
    578578        " WHERE\n"
    579         "   p5Run.state = 'run'\n"
     579        "   diffRun.state = 'run'\n"
    580580    );
    581581
    582582    if (config->where) {
    583         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p5DiffSkyfile");
     583        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "diffSkyfile");
    584584        psStringAppend(&query, " AND %s", whereClause);
    585585        psFree(whereClause);
     
    615615    }
    616616    if (!psArrayLength(output)) {
    617         psError(PS_ERR_UNKNOWN, false, "no p5DiffSkyfile rows found");
     617        psError(PS_ERR_UNKNOWN, false, "no diffSkyfile rows found");
    618618        psFree(output);
    619619        return true;
     
    632632    if (psArrayLength(output)) {
    633633        // negative simple so the default is true
    634         if (!ippdbPrintMetadatas(stdout, output, "p5DiffSkyfile", !simple)) {
     634        if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
    635635            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    636636            psFree(output);
     
    644644}
    645645
    646 static bool setp5RunState(pxConfig *config, const char *p5_id, const char *state)
    647 {
    648     PS_ASSERT_PTR_NON_NULL(p5_id, false);
     646static bool setdiffRunState(pxConfig *config, const char *diff_id, const char *state)
     647{
     648    PS_ASSERT_PTR_NON_NULL(diff_id, false);
    649649    PS_ASSERT_PTR_NON_NULL(state, false);
    650650
     
    657657    ) {
    658658        psError(PS_ERR_UNKNOWN, false,
    659                 "invalid p5Run state: %s", state);
    660         return false;
    661     }
    662 
    663     char *query = "UPDATE p5Run SET state = '%s' WHERE p5_id = '%s'";
    664     if (!p_psDBRunQuery(config->dbh, query, state, p5_id)) {
     659                "invalid diffRun state: %s", state);
     660        return false;
     661    }
     662
     663    char *query = "UPDATE diffRun SET state = '%s' WHERE diff_id = '%s'";
     664    if (!p_psDBRunQuery(config->dbh, query, state, diff_id)) {
    665665        psError(PS_ERR_UNKNOWN, false,
    666                 "failed to change state for p5_id %s", p5_id);
    667         return false;
    668     }
    669 
    670     return true;
    671 }
     666                "failed to change state for diff_id %s", diff_id);
     667        return false;
     668    }
     669
     670    return true;
     671}
  • trunk/ippTools/src/difftoolConfig.c

    r11997 r12024  
    6262    // -updaterun
    6363    psMetadata *updaterunArgs = psMetadataAlloc();
    64     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-p5_id", 0,
    65             "define p5 ID (required)", NULL);
     64    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-diff_id", 0,
     65            "define diff ID (required)", NULL);
    6666    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0,
    6767            "set state (required)", NULL);
     
    7575    // -addinputskyfile
    7676    psMetadata *addinputskyfileArgs = psMetadataAlloc();
    77     psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-p5_id", 0,
    78             "define p5 ID (required)", NULL);
    79     psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-p4_id", 0,
    80             "define p4 ID (required)", NULL);
     77    psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,
     78            "define diff ID (required)", NULL);
     79    psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-warp_id", 0,
     80            "define warp ID (required)", NULL);
    8181    psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0,
    8282            "define by skycell ID", NULL);
     
    9090    // -inputskyfile
    9191    psMetadata *inputskyfileArgs = psMetadataAlloc();
    92     psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-p5_id", 0,
    93             "search by p5 ID (required)", NULL);
    94     psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-p4_id", 0,
    95             "search by p4 ID (required)", NULL);
     92    psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,
     93            "search by diff ID (required)", NULL);
     94    psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-warp_id", 0,
     95            "search by warp ID (required)", NULL);
    9696    psMetadataAddStr(inputskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0,
    9797            "search by skycell ID", NULL);
     
    109109    // -todiffskyfile
    110110    psMetadata *todiffskyfileArgs = psMetadataAlloc();
    111     psMetadataAddStr(todiffskyfileArgs, PS_LIST_TAIL, "-p5_id", 0,
    112             "search by p5 ID", NULL);
     111    psMetadataAddStr(todiffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,
     112            "search by diff ID", NULL);
    113113    psMetadataAddU64(todiffskyfileArgs, PS_LIST_TAIL, "-limit",  0,
    114114            "limit result set to N items", 0);
     
    118118    // -adddiffskyfile
    119119    psMetadata *adddiffskyfileArgs = psMetadataAlloc();
    120     psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-p5_id", 0,
    121             "define p4 ID (required)", NULL);
     120    psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,
     121            "define warp ID (required)", NULL);
    122122    psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-uri", 0,
    123123            "define URI of file (required)", 0);
     
    129129    // -diffskyfile
    130130    psMetadata *diffskyfileArgs = psMetadataAlloc();
    131     psMetadataAddStr(diffskyfileArgs, PS_LIST_TAIL, "-p5_id", 0,
    132             "search by p4 ID", NULL);
     131    psMetadataAddStr(diffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,
     132            "search by warp ID", NULL);
    133133    psMetadataAddStr(diffskyfileArgs , PS_LIST_TAIL, "-skycell_id",  0,
    134134            "define skycell ID (required)", NULL);
     
    238238    psString str = NULL;
    239239    bool status = false;
    240     if ((str = psMetadataLookupStr(&status, config->args, "-p5_id"))) {
    241         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p5_id", 0, "==", (psS32)atoi(str))) {
    242             psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");
     240    if ((str = psMetadataLookupStr(&status, config->args, "-diff_id"))) {
     241        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "diff_id", 0, "==", (psS32)atoi(str))) {
     242            psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id");
    243243            psFree(config);
    244244            return NULL;
     
    249249    psString str = NULL;
    250250    bool status = false;
    251     if ((str = psMetadataLookupStr(&status, config->args, "-p4_id"))) {
    252         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p4_id", 0, "==", (psS32)atoi(str))) {
    253             psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");
     251    if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) {
     252        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS32)atoi(str))) {
     253            psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    254254            psFree(config);
    255255            return NULL;
  • trunk/ippTools/src/guidetool.c

    r11997 r12024  
    2929static bool pendingMode(pxConfig *config);
    3030static bool defineMode(pxConfig *config);
    31 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *exp);
     31static guidePendingExpRow *rawScienceToguidePendingExp(pxConfig *config, rawScienceExpRow *exp);
    3232
    3333int main(int argc, char **argv)
     
    6161    PS_ASSERT_PTR_NON_NULL(config, false);
    6262
    63     // return all p1PendingExp rows unless there CLI search options
    64     psArray *p1PendingExp = p1PendingExpSelectRowObjects(
     63    // return all guidePendingExp rows unless there CLI search options
     64    psArray *guidePendingExp = guidePendingExpSelectRowObjects(
    6565        config->dbh,
    6666        config->where ? config->where : NULL,
    6767        0
    6868    );
    69     if (!p1PendingExp) {
    70         psError(PS_ERR_UNKNOWN, false, "no p1PendingExp found");
     69    if (!guidePendingExp) {
     70        psError(PS_ERR_UNKNOWN, false, "no guidePendingExp found");
    7171        return false;
    7272    }
     
    7474    psMetadata *output = psMetadataAlloc();
    7575
    76     for (long i = 0; i < psArrayLength(p1PendingExp); i++) {
    77         psMetadata *md = p1PendingExpMetadataFromObject(p1PendingExp->data[i]);
    78         psMetadataAddMetadata(output, PS_LIST_TAIL, "p1PendingExp",
     76    for (long i = 0; i < psArrayLength(guidePendingExp); i++) {
     77        psMetadata *md = guidePendingExpMetadataFromObject(guidePendingExp->data[i]);
     78        psMetadataAddMetadata(output, PS_LIST_TAIL, "guidePendingExp",
    7979            PS_META_DUPLICATE_OK, NULL, md);
    8080        psFree(md);
     
    106106    }
    107107
    108     // insert the rawScienceExps into p1PendingExp
     108    // insert the rawScienceExps into guidePendingExp
    109109    // XXX for the being we're going to skip checking for duplicate entries
    110110    // XXX this will have to implimented unless duplicate key insertion
    111111    // XXX support is implimented in psDB
    112112    for (long i = 0; i < psArrayLength(rawScienceExps); i++) {
    113         p1PendingExpRow * new = rawScienceTop1PendingExp(
     113        guidePendingExpRow * new = rawScienceToguidePendingExp(
    114114                                            config, rawScienceExps->data[i]);
    115         if (!p1PendingExpInsertObject(config->dbh, new)) {
     115        if (!guidePendingExpInsertObject(config->dbh, new)) {
    116116            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    117117            return false;
     
    123123}
    124124
    125 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *exp)
     125static guidePendingExpRow *rawScienceToguidePendingExp(pxConfig *config, rawScienceExpRow *exp)
    126126{
    127127    PS_ASSERT_PTR_NON_NULL(config, NULL);
     
    184184    }
    185185
    186     return p1PendingExpRowAlloc(
     186    return guidePendingExpRowAlloc(
    187187        exp->exp_tag,
    188188        exp->camera,
  • trunk/ippTools/src/guidetoolConfig.c

    r11997 r12024  
    6666    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-recipe",  0,
    6767        "define recipe of interest", NULL);
    68     psMetadataAddS32(pendingArgs, PS_LIST_TAIL, "-p1_version",  0,
    69         "define p1_version of interest", 0);
     68    psMetadataAddS32(pendingArgs, PS_LIST_TAIL, "-guide_version",  0,
     69        "define guide_version of interest", 0);
    7070
    7171    // -define inputs
     
    8686    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-recipe",  0,
    8787        "define recipe of interest", NULL);
    88     psMetadataAddS32(defineArgs, PS_LIST_TAIL, "-p1_version",  0,
    89         "define p1_version of interest", 0);
     88    psMetadataAddS32(defineArgs, PS_LIST_TAIL, "-guide_version",  0,
     89        "define guide_version of interest", 0);
    9090
    9191    // find which mode we're running under
     
    182182    addWhereStr(stats);
    183183    addWhereStr(recipe);
    184     if ((n = psMetadataLookupS32(&status, config->args, "-p1_version"))) {
    185         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p1_version", 0, "==", n)) {
    186             psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");
     184    if ((n = psMetadataLookupS32(&status, config->args, "-guide_version"))) {
     185        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "guide_version", 0, "==", n)) {
     186            psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version");
    187187            exit(EXIT_FAILURE);
    188188        }
  • trunk/ippTools/src/pxtables.c

    r11985 r12024  
    5959    CREATE_TABLE(rawExpCreateTable);
    6060    CREATE_TABLE(rawImfileCreateTable);
    61     CREATE_TABLE(p1PendingExpCreateTable);
    62     CREATE_TABLE(p2PendingExpCreateTable);
    63     CREATE_TABLE(p2PendingImfileCreateTable);
    64     CREATE_TABLE(p2ProcessedExpCreateTable);
    65     CREATE_TABLE(p2ProcessedImfileCreateTable);
    66     CREATE_TABLE(p2MaskCreateTable);
    67     CREATE_TABLE(p3PendingExpCreateTable);
    68     CREATE_TABLE(p3ProcessedExpCreateTable);
    69     CREATE_TABLE(p3MaskCreateTable);
     61    CREATE_TABLE(guidePendingExpCreateTable);
     62    CREATE_TABLE(chipPendingExpCreateTable);
     63    CREATE_TABLE(chipPendingImfileCreateTable);
     64    CREATE_TABLE(chipProcessedExpCreateTable);
     65    CREATE_TABLE(chipProcessedImfileCreateTable);
     66    CREATE_TABLE(chipMaskCreateTable);
     67    CREATE_TABLE(camPendingExpCreateTable);
     68    CREATE_TABLE(camProcessedExpCreateTable);
     69    CREATE_TABLE(camMaskCreateTable);
    7070    CREATE_TABLE(detRunCreateTable);
    7171    CREATE_TABLE(detInputExpCreateTable);
     
    7979    CREATE_TABLE(detResidExpCreateTable);
    8080    CREATE_TABLE(detRunSummaryCreateTable);
    81     CREATE_TABLE(p4RunCreateTable);
    82     CREATE_TABLE(p4InputExpCreateTable);
    83     CREATE_TABLE(p4SkyCellMapCreateTable);
    84     CREATE_TABLE(p4SkyfileCreateTable);
    85     CREATE_TABLE(p5RunCreateTable);
    86     CREATE_TABLE(p5InputSkyfileCreateTable);
    87     CREATE_TABLE(p5DiffSkyfileCreateTable);
    88     CREATE_TABLE(p6RunCreateTable);
    89     CREATE_TABLE(p6InputSkyfileCreateTable);
    90     CREATE_TABLE(p6SumSkyfileCreateTable);
     81    CREATE_TABLE(warpRunCreateTable);
     82    CREATE_TABLE(warpInputExpCreateTable);
     83    CREATE_TABLE(warpSkyCellMapCreateTable);
     84    CREATE_TABLE(warpSkyfileCreateTable);
     85    CREATE_TABLE(diffRunCreateTable);
     86    CREATE_TABLE(diffInputSkyfileCreateTable);
     87    CREATE_TABLE(diffSkyfileCreateTable);
     88    CREATE_TABLE(stackRunCreateTable);
     89    CREATE_TABLE(stackInputSkyfileCreateTable);
     90    CREATE_TABLE(stackSumSkyfileCreateTable);
    9191
    9292    return true;
     
    9999    PS_ASSERT_PTR_NON_NULL(config, false);
    100100
    101     fprintf (stdout, "*** delete the P2 tables? ***\n");
     101    fprintf (stdout, "*** delete the chip tables? ***\n");
    102102    fprintf (stdout, "*** to delete the tables, answer YES, and give password ***\n");
    103103    fprintf (stdout, "*** WARNING: this action is permanent ***\n\n");
    104104
    105     fprintf (stdout, "delete the P2 tables (YES/[n]): ");
     105    fprintf (stdout, "delete the chip tables (YES/[n]): ");
    106106    fgets (line, 128, stdin);
    107107    sscanf (line, "%s", answer);
     
    135135    DROP_TABLE(rawExpDropTable);
    136136    DROP_TABLE(rawImfileDropTable);
    137     DROP_TABLE(p1PendingExpDropTable);
    138     DROP_TABLE(p2PendingExpDropTable);
    139     DROP_TABLE(p2PendingImfileDropTable);
    140     DROP_TABLE(p2ProcessedExpDropTable);
    141     DROP_TABLE(p2ProcessedImfileDropTable);
    142     DROP_TABLE(p2MaskDropTable);
    143     DROP_TABLE(p3PendingExpDropTable);
    144     DROP_TABLE(p3ProcessedExpDropTable);
    145     DROP_TABLE(p3MaskDropTable);
     137    DROP_TABLE(guidePendingExpDropTable);
     138    DROP_TABLE(chipPendingExpDropTable);
     139    DROP_TABLE(chipPendingImfileDropTable);
     140    DROP_TABLE(chipProcessedExpDropTable);
     141    DROP_TABLE(chipProcessedImfileDropTable);
     142    DROP_TABLE(chipMaskDropTable);
     143    DROP_TABLE(camPendingExpDropTable);
     144    DROP_TABLE(camProcessedExpDropTable);
     145    DROP_TABLE(camMaskDropTable);
    146146    DROP_TABLE(detRunDropTable);
    147147    DROP_TABLE(detInputExpDropTable);
     
    155155    DROP_TABLE(detResidExpDropTable);
    156156    DROP_TABLE(detRunSummaryDropTable);
    157     DROP_TABLE(p4RunDropTable);
    158     DROP_TABLE(p4InputExpDropTable);
    159     DROP_TABLE(p4SkyCellMapDropTable);
    160     DROP_TABLE(p4SkyfileDropTable);
    161     DROP_TABLE(p5RunDropTable);
    162     DROP_TABLE(p5InputSkyfileDropTable);
    163     DROP_TABLE(p5DiffSkyfileDropTable);
    164     DROP_TABLE(p6RunDropTable);
    165     DROP_TABLE(p6InputSkyfileDropTable);
    166     DROP_TABLE(p6SumSkyfileDropTable);
     157    DROP_TABLE(warpRunDropTable);
     158    DROP_TABLE(warpInputExpDropTable);
     159    DROP_TABLE(warpSkyCellMapDropTable);
     160    DROP_TABLE(warpSkyfileDropTable);
     161    DROP_TABLE(diffRunDropTable);
     162    DROP_TABLE(diffInputSkyfileDropTable);
     163    DROP_TABLE(diffSkyfileDropTable);
     164    DROP_TABLE(stackRunDropTable);
     165    DROP_TABLE(stackInputSkyfileDropTable);
     166    DROP_TABLE(stackSumSkyfileDropTable);
    167167
    168168    return status;
  • trunk/ippTools/src/regtool.c

    r11997 r12024  
    3939
    4040// static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp);
    41 static p2PendingExpRow *newToP2PendingExp(pxConfig *config, newExpRow *newExp);
    42 static p2PendingImfileRow *rawImfileToP2PendingImfile(pxConfig *config, rawImfileRow *rawImfile);
     41static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp);
     42static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, rawImfileRow *rawImfile);
    4343
    4444static rawExpRow *newToRawExp(pxConfig *config, newExpRow *exp);
     
    672672        }
    673673
    674         // if this is a detrend image don't put it in the p2 queue (and we're
     674        // if this is a detrend image don't put it in the chip queue (and we're
    675675        // done)
    676676        if (detrend) {
     
    679679        }
    680680
    681         // insert an entry into the p2PendingExp table
    682         p2PendingExpRow *p2PendingExp = newToP2PendingExp(config, newExp);
    683         if (!p2PendingExp) {
    684             psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to p2PendingExp");
     681        // insert an entry into the chipPendingExp table
     682        chipPendingExpRow *chipPendingExp = newTochipPendingExp(config, newExp);
     683        if (!chipPendingExp) {
     684            psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to chipPendingExp");
    685685            psFree(newExp);
    686686            psFree(output);
     
    688688        }
    689689
    690         // insert the p2PendingExp object into the database
    691         if (!p2PendingExpInsertObject(config->dbh, p2PendingExp)) {
     690        // insert the chipPendingExp object into the database
     691        if (!chipPendingExpInsertObject(config->dbh, chipPendingExp)) {
    692692            // rollback
    693693            if (!psDBRollback(config->dbh)) {
     
    695695            }
    696696            psError(PS_ERR_UNKNOWN, false, "database error");
    697             psFree(p2PendingExp);
     697            psFree(chipPendingExp);
    698698            psFree(newExp);
    699699            psFree(output);
    700700            return false;
    701701        }
    702         psFree(p2PendingExp);
    703 
    704         // find all of the rawImfiles associated with the p2PendingExp object
     702        psFree(chipPendingExp);
     703
     704        // find all of the rawImfiles associated with the chipPendingExp object
    705705        psArray *rawImfiles = NULL;
    706706        {
     
    744744            return false;
    745745        }
    746         // convert the rawImfiles into p2PendingImfiles and insert them into
     746        // convert the rawImfiles into chipPendingImfiles and insert them into
    747747        // the database
    748748        for (long i = 0; i < psArrayLength(rawImfiles); i++) {
    749749            rawImfileRow *rawImfile = rawImfiles->data[i];
    750             p2PendingImfileRow *pendingImfile = rawImfileToP2PendingImfile(config, rawImfile);
    751             if (!p2PendingImfileInsertObject(config->dbh, pendingImfile)){
     750            chipPendingImfileRow *pendingImfile = rawImfileTochipPendingImfile(config, rawImfile);
     751            if (!chipPendingImfileInsertObject(config->dbh, pendingImfile)){
    752752                // rollback
    753753                if (!psDBRollback(config->dbh)) {
     
    915915
    916916
    917 static p2PendingExpRow *newToP2PendingExp(pxConfig *config, newExpRow *exp)
     917static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *exp)
    918918{
    919919    PS_ASSERT_PTR_NON_NULL(config, NULL);
     
    928928    }
    929929
    930     p2PendingExpRow *p2Exp = p2PendingExpRowAlloc(
     930    chipPendingExpRow *chipExp = chipPendingExpRowAlloc(
    931931        exp->exp_tag,
    932         0x0,            // p2 version XXX calc version number
     932        0x0,            // chip version XXX calc version number
    933933        0xdeadbeef,     // p1 version
    934934        label,
     
    938938    );
    939939
    940     return p2Exp;
    941 }
    942 
    943 
    944 static p2PendingImfileRow *rawImfileToP2PendingImfile(pxConfig *config, rawImfileRow *rawImfile)
    945 {
    946     return p2PendingImfileRowAlloc(
     940    return chipExp;
     941}
     942
     943
     944static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, rawImfileRow *rawImfile)
     945{
     946    return chipPendingImfileRowAlloc(
    947947        rawImfile->exp_tag,
    948         0x0,          // p2 version XXX calc version number
     948        0x0,          // chip version XXX calc version number
    949949        0xdeadbeef,   // p1 version
    950950        rawImfile->class_id,
  • trunk/ippTools/src/stacktool.c

    r11997 r12024  
    3939static bool sumskyfileMode(pxConfig *config);
    4040
    41 static bool setp6RunState(pxConfig *config, const char *p6_id, const char *state);
     41static bool setstackRunState(pxConfig *config, const char *stack_id, const char *state);
    4242
    4343# define MODECASE(caseName, func) \
     
    125125
    126126    // we have to support multipe exp_tags
    127     psMetadataItem *p4_ids = psMetadataLookup(config->args, "-p4_id");
    128     if (!p4_ids) {
     127    psMetadataItem *warp_ids = psMetadataLookup(config->args, "-warp_id");
     128    if (!warp_ids) {
    129129        // this shouldn't actually happen when using psArgs
    130         psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
     130        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
    131131        return false;
    132132    }
     
    147147    }
    148148
    149     p6RunRow *run = p6RunRowAlloc(
     149    stackRunRow *run = stackRunRowAlloc(
    150150            0,          // ID
    151151            "run",      // state
     
    158158    psFree(registered);
    159159    if (!run) {
    160         psError(PS_ERR_UNKNOWN, false, "failed to alloc p6Run object");
     160        psError(PS_ERR_UNKNOWN, false, "failed to alloc stackRun object");
    161161        return true;
    162162    }
     
    167167    }
    168168
    169     if (!p6RunInsertObject(config->dbh, run)) {
     169    if (!stackRunInsertObject(config->dbh, run)) {
    170170        if (!psDBRollback(config->dbh)) {
    171171            psError(PS_ERR_UNKNOWN, false, "database error");
     
    176176    }
    177177
    178     // get the assigned p4_id
    179     run->p6_id = psDBLastInsertID(config->dbh);
    180 
    181     // insert the p6InputSkyfile rows
    182     psListIterator *iter = psListIteratorAlloc(p4_ids->data.list, 0, false);
     178    // get the assigned warp_id
     179    run->stack_id = psDBLastInsertID(config->dbh);
     180
     181    // insert the stackInputSkyfile rows
     182    psListIterator *iter = psListIteratorAlloc(warp_ids->data.list, 0, false);
    183183    psMetadataItem *item = NULL;
    184184    while ((item = psListGetAndIncrement(iter))) {
    185         if (!p6InputSkyfileInsert(config->dbh, run->p6_id, atoi((char *)item->data.V))) {
     185        if (!stackInputSkyfileInsert(config->dbh, run->stack_id, atoi((char *)item->data.V))) {
    186186            if (!psDBRollback(config->dbh)) {
    187187                psError(PS_ERR_UNKNOWN, false, "database error");
    188188            }
    189             psError(PS_ERR_UNKNOWN, false, "failed to insert p6InputSkyfile rows");
     189            psError(PS_ERR_UNKNOWN, false, "failed to insert stackInputSkyfile rows");
    190190            return false;
    191191        }
     
    210210    }
    211211
    212     if (!p6RunPrintObject(stdout, run, !simple)) {
     212    if (!stackRunPrintObject(stdout, run, !simple)) {
    213213            psError(PS_ERR_UNKNOWN, false, "failed to print object");
    214214            psFree(run);
     
    227227
    228228    bool status = false;
    229     psString p6_id = psMetadataLookupStr(&status, config->args, "-p6_id");
    230     if (!status) {
    231         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p6_id");
    232         return false;
    233     }
    234     if (!p6_id) {
    235         psError(PS_ERR_UNKNOWN, true, "-p6_id is required");
     229    psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id");
     230    if (!status) {
     231        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id");
     232        return false;
     233    }
     234    if (!stack_id) {
     235        psError(PS_ERR_UNKNOWN, true, "-stack_id is required");
    236236        return false;
    237237    }
     
    249249    if (state) {
    250250        // set detRun.state to state
    251         return setp6RunState(config, p6_id, state);
     251        return setstackRunState(config, stack_id, state);
    252252    }
    253253
     
    261261
    262262    bool status = false;
    263     psString p6_id = psMetadataLookupStr(&status, config->args, "-p6_id");
    264     if (!status) {
    265         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p6_id");
    266         return false;
    267     }
    268     if (!p6_id) {
    269         psError(PS_ERR_UNKNOWN, true, "-p6_id is required");
    270         return false;
    271 
    272     }
    273 
    274     psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
    275     if (!status) {
    276         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");
    277         return false;
    278     }
    279     if (!p4_id) {
    280         psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
    281         return false;
    282     }
    283 
    284 
    285     // XXX need to validate the p4_id here
     263    psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id");
     264    if (!status) {
     265        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id");
     266        return false;
     267    }
     268    if (!stack_id) {
     269        psError(PS_ERR_UNKNOWN, true, "-stack_id is required");
     270        return false;
     271
     272    }
     273
     274    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
     275    if (!status) {
     276        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id");
     277        return false;
     278    }
     279    if (!warp_id) {
     280        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
     281        return false;
     282    }
     283
     284
     285    // XXX need to validate the warp_id here
    286286    // XXX instead of validiting it here we should just use forgein key
    287287    // constrants
    288     if (!p6InputSkyfileInsert(config->dbh,
    289             (psS32)atoi(p6_id),
    290             (psS32)atoi(p4_id)
     288    if (!stackInputSkyfileInsert(config->dbh,
     289            (psS32)atoi(stack_id),
     290            (psS32)atoi(warp_id)
    291291        )) {
    292292        psError(PS_ERR_UNKNOWN, false, "database error");
     
    312312    psString query = psStringCopy(
    313313        "SELECT\n"
    314         "   p4Skyfile.*\n"
    315         " FROM p6Run\n"
    316         " JOIN p6InputSkyfile\n"
    317         "   USING(p6_id)\n"
    318         " JOIN p4Skyfile\n"
    319         "   ON  p6InputSkyfile.p4_id = p4Skyfile.p4_id\n"
    320         "   AND p6Run.skycell_id    = p4Skyfile.skycell_id\n"
    321         "   AND p6Run.tess_id       = p4Skyfile.tess_id\n"
     314        "   warpSkyfile.*\n"
     315        " FROM stackRun\n"
     316        " JOIN stackInputSkyfile\n"
     317        "   USING(stack_id)\n"
     318        " JOIN warpSkyfile\n"
     319        "   ON  stackInputSkyfile.warp_id = warpSkyfile.warp_id\n"
     320        "   AND stackRun.skycell_id    = warpSkyfile.skycell_id\n"
     321        "   AND stackRun.tess_id       = warpSkyfile.tess_id\n"
    322322        " WHERE\n"
    323         "   p6Run.state = 'run'\n"
     323        "   stackRun.state = 'run'\n"
    324324    );
    325325    if (config->where) {
    326         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p6InputSkyfile");
     326        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackInputSkyfile");
    327327        psStringAppend(&query, " AND %s", whereClause);
    328328        psFree(whereClause);
     
    358358    }
    359359    if (!psArrayLength(output)) {
    360         psError(PS_ERR_UNKNOWN, false, "no p6InputSkyfile rows found");
     360        psError(PS_ERR_UNKNOWN, false, "no stackInputSkyfile rows found");
    361361        psFree(output);
    362362        return true;
     
    375375    if (psArrayLength(output)) {
    376376        // negative simple so the default is true
    377         if (!ippdbPrintMetadatas(stdout, output, "p6InputSkyfile", !simple)) {
     377        if (!ippdbPrintMetadatas(stdout, output, "stackInputSkyfile", !simple)) {
    378378            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    379379            psFree(output);
     
    402402    psString query = psStringCopy(
    403403        "SELECT\n"
    404         "   p6Run.p6_id\n"
    405         " FROM p6Run\n"
    406         " LEFT JOIN p6SumSkyfile\n"
    407         "   USING(p6_id)\n"
     404        "   stackRun.stack_id\n"
     405        " FROM stackRun\n"
     406        " LEFT JOIN stackSumSkyfile\n"
     407        "   USING(stack_id)\n"
    408408        " WHERE\n"
    409         "   p6Run.state = 'run'\n"
    410         "   AND p6SumSkyfile.p6_id IS NULL\n"
     409        "   stackRun.state = 'run'\n"
     410        "   AND stackSumSkyfile.stack_id IS NULL\n"
    411411    );
    412412
    413413    if (config->where) {
    414         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p6SumSkyfile");
     414        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackSumSkyfile");
    415415        psStringAppend(&query, " AND %s", whereClause);
    416416        psFree(whereClause);
     
    446446    }
    447447    if (!psArrayLength(output)) {
    448         psError(PS_ERR_UNKNOWN, false, "no p6SumSkyfile rows found");
     448        psError(PS_ERR_UNKNOWN, false, "no stackSumSkyfile rows found");
    449449        psFree(output);
    450450        return true;
     
    463463    if (psArrayLength(output)) {
    464464        // negative simple so the default is true
    465         if (!ippdbPrintMetadatas(stdout, output, "p6SumSkyfile", !simple)) {
     465        if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) {
    466466            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    467467            psFree(output);
     
    481481
    482482    bool status = false;
    483     psString p6_id = psMetadataLookupStr(&status, config->args, "-p6_id");
    484     if (!status) {
    485         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p6_id");
    486         return false;
    487     }
    488     if (!p6_id) {
    489         psError(PS_ERR_UNKNOWN, true, "-p6_id is required");
     483    psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id");
     484    if (!status) {
     485        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id");
     486        return false;
     487    }
     488    if (!stack_id) {
     489        psError(PS_ERR_UNKNOWN, true, "-stack_id is required");
    490490        return false;
    491491
     
    520520    }
    521521
    522     // XXX need to validate the p6_id here
     522    // XXX need to validate the stack_id here
    523523    // XXX instead of validiting it here we should just use forgein key
    524524    // constrants
    525     if (!p6SumSkyfileInsert(config->dbh,
    526             (psS32)atoi(p6_id),
     525    if (!stackSumSkyfileInsert(config->dbh,
     526            (psS32)atoi(stack_id),
    527527            uri,
    528528            bg,
     
    536536    }
    537537
    538     if (setp6RunState(config, p6_id, "stop")) {
     538    if (setstackRunState(config, stack_id, "stop")) {
    539539        if (!psDBRollback(config->dbh)) {
    540540            psError(PS_ERR_UNKNOWN, false, "database error");
    541541        }
    542         psError(PS_ERR_UNKNOWN, false, "failed to change p6Run's state");
     542        psError(PS_ERR_UNKNOWN, false, "failed to change stackRun's state");
    543543        return false;
    544544    }
     
    568568    psString query = psStringCopy(
    569569        "SELECT\n"
    570         "   p6SumSkyfile.*\n"
    571         " FROM p6Run\n"
    572         " JOIN p6SumSkyfile\n"
    573         "   USING(p6_id)\n"
     570        "   stackSumSkyfile.*\n"
     571        " FROM stackRun\n"
     572        " JOIN stackSumSkyfile\n"
     573        "   USING(stack_id)\n"
    574574        " WHERE\n"
    575         "   p6Run.state = 'run'\n"
     575        "   stackRun.state = 'run'\n"
    576576    );
    577577
    578578    if (config->where) {
    579         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p6SumSkyfile");
     579        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackSumSkyfile");
    580580        psStringAppend(&query, " AND %s", whereClause);
    581581        psFree(whereClause);
     
    611611    }
    612612    if (!psArrayLength(output)) {
    613         psError(PS_ERR_UNKNOWN, false, "no p4Skyfile rows found");
     613        psError(PS_ERR_UNKNOWN, false, "no warpSkyfile rows found");
    614614        psFree(output);
    615615        return true;
     
    627627
    628628    if (psArrayLength(output)) {
    629         if (!ippdbPrintMetadatas(stdout, output, "p6SumSkyfile", !simple)) {
     629        if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) {
    630630            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    631631            psFree(output);
     
    640640
    641641
    642 static bool setp6RunState(pxConfig *config, const char *p6_id, const char *state)
    643 {
    644     PS_ASSERT_PTR_NON_NULL(p6_id, false);
     642static bool setstackRunState(pxConfig *config, const char *stack_id, const char *state)
     643{
     644    PS_ASSERT_PTR_NON_NULL(stack_id, false);
    645645    PS_ASSERT_PTR_NON_NULL(state, false);
    646646
     
    653653    ) {
    654654        psError(PS_ERR_UNKNOWN, false,
    655                 "invalid p4Run state: %s", state);
    656         return false;
    657     }
    658 
    659     char *query = "UPDATE p6Run SET state = '%s' WHERE p6_id = '%s'";
    660     if (!p_psDBRunQuery(config->dbh, query, state, p6_id)) {
     655                "invalid warpRun state: %s", state);
     656        return false;
     657    }
     658
     659    char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = '%s'";
     660    if (!p_psDBRunQuery(config->dbh, query, state, stack_id)) {
    661661        psError(PS_ERR_UNKNOWN, false,
    662                 "failed to change state for p6_id %s", p6_id);
    663         return false;
    664     }
    665 
    666     return true;
    667 }
     662                "failed to change state for stack_id %s", stack_id);
     663        return false;
     664    }
     665
     666    return true;
     667}
  • trunk/ippTools/src/warptool.c

    r12004 r12024  
    4444
    4545static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile);
    46 static bool setp4RunState(pxConfig *config, const char *p4_id, const char *state);
     46static bool setwarpRunState(pxConfig *config, const char *warp_id, const char *state);
    4747static bool isValidMode(pxConfig *config, const char *mode);
    48 bool p4CompletedRuns(pxConfig *config);
     48bool warpCompletedRuns(pxConfig *config);
    4949
    5050# define MODECASE(caseName, func) \
     
    145145    }
    146146
    147     p4RunRow *p4Run = p4RunRowAlloc(
     147    warpRunRow *warpRun = warpRunRowAlloc(
    148148            0,          // ID
    149149            mode,
     
    154154    );
    155155    psFree(registered);
    156     if (!p4Run) {
    157         psError(PS_ERR_UNKNOWN, false, "failed to alloc p4Run object");
     156    if (!warpRun) {
     157        psError(PS_ERR_UNKNOWN, false, "failed to alloc warpRun object");
    158158        return true;
    159159    }
    160     if (!p4RunInsertObject(config->dbh, p4Run)) {
    161         psError(PS_ERR_UNKNOWN, false, "database error");
    162         psFree(p4Run);
     160    if (!warpRunInsertObject(config->dbh, warpRun)) {
     161        psError(PS_ERR_UNKNOWN, false, "database error");
     162        psFree(warpRun);
    163163        return true;
    164164    }
    165165
    166     // get the assigned p4_id
    167     p4Run->p4_id = psDBLastInsertID(config->dbh);
     166    // get the assigned warp_id
     167    warpRun->warp_id = psDBLastInsertID(config->dbh);
    168168
    169169    bool simple = false;
     
    173173        if (!status) {
    174174            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    175             psFree(p4Run);
    176             return false;
    177         }
    178     }
    179 
    180     if (!p4RunPrintObject(stdout, p4Run, !simple)) {
     175            psFree(warpRun);
     176            return false;
     177        }
     178    }
     179
     180    if (!warpRunPrintObject(stdout, warpRun, !simple)) {
    181181            psError(PS_ERR_UNKNOWN, false, "failed to print object");
    182             psFree(p4Run);
    183             return false;
    184     }
    185 
    186     psFree(p4Run);
     182            psFree(warpRun);
     183            return false;
     184    }
     185
     186    psFree(warpRun);
    187187
    188188    return true;
     
    195195
    196196    bool status = false;
    197     psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
    198     if (!status) {
    199         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4t_id");
    200         return false;
    201     }
    202     if (!p4_id) {
    203         psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
     197    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
     198    if (!status) {
     199        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warpt_id");
     200        return false;
     201    }
     202    if (!warp_id) {
     203        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
    204204        return false;
    205205    }
     
    217217    if (state) {
    218218        // set detRun.state to state
    219         return setp4RunState(config, p4_id, state);
     219        return setwarpRunState(config, warp_id, state);
    220220    }
    221221
     
    229229
    230230    bool status = false;
    231     psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
    232     if (!status) {
    233         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");
    234         return false;
    235     }
    236     if (!p4_id) {
    237         psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
     231    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
     232    if (!status) {
     233        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id");
     234        return false;
     235    }
     236    if (!warp_id) {
     237        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
    238238        return false;
    239239    }
     
    250250
    251251    // defaults to 0
    252     psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version");
    253     if (!status) {
    254         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");
     252    psS32 cam_version = psMetadataLookupS32(&status, config->args, "-cam_version");
     253    if (!status) {
     254        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_version");
    255255        return false;
    256256    }
    257257
    258258    // defaults to false
    259     bool magiced = psMetadataLookupBool(&status, config->args, "-p3_version");
    260     if (!status) {
    261         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");
    262         return false;
    263     }
    264 
    265     // XXX need to validate the p4_id here
     259    bool magiced = psMetadataLookupBool(&status, config->args, "-cam_version");
     260    if (!status) {
     261        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_version");
     262        return false;
     263    }
     264
     265    // XXX need to validate the warp_id here
    266266    // XXX instead of validiting it here we should just use forgein key
    267267    // constrants
    268     if (!p4InputExpInsert(config->dbh,
    269             (psS32)atoi(p4_id),
     268    if (!warpInputExpInsert(config->dbh,
     269            (psS32)atoi(warp_id),
    270270            exp_tag,
    271             p3_version,
     271            cam_version,
    272272            magiced
    273273        )) {
     
    294294    psString query = psStringCopy(
    295295        "SELECT\n"
    296         "   p3ProcessedExp.*\n"
    297         " FROM p4Run\n"
    298         " JOIN p4InputExp\n"
    299         "   USING(p4_id)\n"
    300         " JOIN p3ProcessedExp\n"
    301         "   ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n"
    302         "   AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n"
     296        "   camProcessedExp.*\n"
     297        " FROM warpRun\n"
     298        " JOIN warpInputExp\n"
     299        "   USING(warp_id)\n"
     300        " JOIN camProcessedExp\n"
     301        "   ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n"
     302        "   AND warpInputExp.cam_version = camProcessedExp.cam_version\n"
    303303        " WHERE\n"
    304         "   p4Run.state = 'run'\n"
    305         "   AND p3ProcessedExp.fault = 0\n"
     304        "   warpRun.state = 'run'\n"
     305        "   AND camProcessedExp.fault = 0\n"
    306306    );
    307307
    308308    if (config->where) {
    309         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp");
     309        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp");
    310310        psStringAppend(&query, " AND %s", whereClause);
    311311        psFree(whereClause);
     
    358358    if (psArrayLength(output)) {
    359359        // negative simple so the default is true
    360         if (!ippdbPrintMetadatas(stdout, output, "p4InputExp", !simple)) {
     360        if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) {
    361361            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    362362            psFree(output);
     
    386386        "SELECT\n"
    387387        "   rawImfile.*\n"
    388         " FROM p4Run\n"
    389         " JOIN p4InputExp\n"
    390         "   USING(p4_id)\n"
     388        " FROM warpRun\n"
     389        " JOIN warpInputExp\n"
     390        "   USING(warp_id)\n"
    391391        " JOIN rawImfile\n" // is there any reason not to refer back to rawimfiles?
    392         "   ON p4InputExp.exp_tag = rawImfile.exp_tag\n"
     392        "   ON warpInputExp.exp_tag = rawImfile.exp_tag\n"
    393393        " WHERE\n"
    394         "   p4Run.state = 'run'\n"
     394        "   warpRun.state = 'run'\n"
    395395    );
    396396    if (config->where) {
    397         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp");
     397        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp");
    398398        psStringAppend(&query, " AND %s", whereClause);
    399399        psFree(whereClause);
     
    446446    if (psArrayLength(output)) {
    447447        // negative simple so the default is true
    448         if (!ippdbPrintMetadatas(stdout, output, "p4InputImfile", !simple)) {
     448        if (!ippdbPrintMetadatas(stdout, output, "warpInputImfile", !simple)) {
    449449            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    450450            psFree(output);
     
    473473    psString query = psStringCopy(
    474474        "SELECT\n"
    475         "   p3ProcessedExp.*\n"
    476         " FROM p4Run\n"
    477         " JOIN p4InputExp\n"
    478         "   USING(p4_id)\n"
    479         " JOIN p3ProcessedExp\n"
    480         "   ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n"
    481         "   AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n"
    482         " LEFT JOIN p4SkyCellMap\n"
    483         "   ON p4InputExp.p4_id = p4SkyCellMap.p4_id\n"
    484         "   AND p4InputExp.exp_tag = p4SkyCellMap.exp_tag\n"
    485         "   AND p4InputExp.p3_version = p4SkyCellMap.p3_version\n"
     475        "   camProcessedExp.*\n"
     476        " FROM warpRun\n"
     477        " JOIN warpInputExp\n"
     478        "   USING(warp_id)\n"
     479        " JOIN camProcessedExp\n"
     480        "   ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n"
     481        "   AND warpInputExp.cam_version = camProcessedExp.cam_version\n"
     482        " LEFT JOIN warpSkyCellMap\n"
     483        "   ON warpInputExp.warp_id = warpSkyCellMap.warp_id\n"
     484        "   AND warpInputExp.exp_tag = warpSkyCellMap.exp_tag\n"
     485        "   AND warpInputExp.cam_version = warpSkyCellMap.cam_version\n"
    486486        " WHERE\n"
    487         "   p4Run.state = 'run'\n"
    488         "   AND p3ProcessedExp.fault = 0\n"
    489         "   AND p4SkyCellMap.p4_id IS NULL\n"
    490         "   AND p4SkyCellMap.exp_tag IS NULL\n"
    491         "   AND p4SkyCellMap.p3_version IS NULL\n"
     487        "   warpRun.state = 'run'\n"
     488        "   AND camProcessedExp.fault = 0\n"
     489        "   AND warpSkyCellMap.warp_id IS NULL\n"
     490        "   AND warpSkyCellMap.exp_tag IS NULL\n"
     491        "   AND warpSkyCellMap.cam_version IS NULL\n"
    492492    );
    493493
    494494    if (config->where) {
    495         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp");
     495        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp");
    496496        psStringAppend(&query, " AND %s", whereClause);
    497497        psFree(whereClause);
     
    544544    if (psArrayLength(output)) {
    545545        // negative simple so the default is true
    546         if (!ippdbPrintMetadatas(stdout, output, "p4InputExp", !simple)) {
     546        if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) {
    547547            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    548548            psFree(output);
     
    623623        // this conversion isn't strictly nessicary but it's an easy way of
    624624        // validating the format
    625         p4SkyCellMapRow *row = p4SkyCellMapObjectFromMetadata(sc);
     625        warpSkyCellMapRow *row = warpSkyCellMapObjectFromMetadata(sc);
    626626        if (!row) {
    627             psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a p4SkyCellMap object", mapfile);
     627            psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a warpSkyCellMap object", mapfile);
    628628            psFree(iter);
    629629            psFree(skycells);
     
    631631        }
    632632
    633         if (!p4SkyCellMapInsertObject(config->dbh, row)) {
     633        if (!warpSkyCellMapInsertObject(config->dbh, row)) {
    634634            psErrorCode err = psErrorCodeLast();
    635635            switch (err) {
     
    670670    psString query = psStringCopy(
    671671        "SELECT\n"
    672         "   p4SkyCellMap.*\n"
    673         " FROM p4Run\n"
    674         " JOIN p4SkyCellMap\n"
    675         "   USING(p4_id)\n"
     672        "   warpSkyCellMap.*\n"
     673        " FROM warpRun\n"
     674        " JOIN warpSkyCellMap\n"
     675        "   USING(warp_id)\n"
    676676        " WHERE\n"
    677         "   p4Run.state = 'run'\n"
     677        "   warpRun.state = 'run'\n"
    678678    );
    679679
    680680    if (config->where) {
    681         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4SkyCellMap");
     681        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyCellMap");
    682682        psStringAppend(&query, " AND %s", whereClause);
    683683        psFree(whereClause);
     
    713713    }
    714714    if (!psArrayLength(output)) {
    715         psError(PS_ERR_UNKNOWN, false, "no p4SkyCellMap rows found");
     715        psError(PS_ERR_UNKNOWN, false, "no warpSkyCellMap rows found");
    716716        psFree(output);
    717717        return true;
     
    730730    if (psArrayLength(output)) {
    731731        // negative simple so the default is true
    732         if (!ippdbPrintMetadatas(stdout, output, "p4SkyCellMap", !simple)) {
     732        if (!ippdbPrintMetadatas(stdout, output, "warpSkyCellMap", !simple)) {
    733733            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    734734            psFree(output);
     
    757757    psString query = psStringCopy(
    758758        "SELECT\n"
    759         "   p4SkyCellMap.*\n"
    760         " FROM p4Run\n"
    761         " JOIN p4SkyCellMap\n"
    762         "   USING(p4_id)\n"
    763         " LEFT JOIN p4Skyfile\n"
    764         "   USING(p4_id, skycell_id, tess_id)\n"
     759        "   warpSkyCellMap.*\n"
     760        " FROM warpRun\n"
     761        " JOIN warpSkyCellMap\n"
     762        "   USING(warp_id)\n"
     763        " LEFT JOIN warpSkyfile\n"
     764        "   USING(warp_id, skycell_id, tess_id)\n"
    765765        " WHERE\n"
    766         "   p4Run.state = 'run'\n"
    767         "   AND p4Skyfile.p4_id IS NULL\n"
    768         "   AND p4Skyfile.skycell_id IS NULL\n"
    769         "   AND p4Skyfile.tess_id IS NULL\n"
     766        "   warpRun.state = 'run'\n"
     767        "   AND warpSkyfile.warp_id IS NULL\n"
     768        "   AND warpSkyfile.skycell_id IS NULL\n"
     769        "   AND warpSkyfile.tess_id IS NULL\n"
    770770    );
    771771
    772772    if (config->where) {
    773         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4SkyCellMap");
     773        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyCellMap");
    774774        psStringAppend(&query, " AND %s", whereClause);
    775775        psFree(whereClause);
     
    805805    }
    806806    if (!psArrayLength(output)) {
    807         psError(PS_ERR_UNKNOWN, false, "no p4PendingSkyCell rows found");
     807        psError(PS_ERR_UNKNOWN, false, "no warpPendingSkyCell rows found");
    808808        psFree(output);
    809809        return true;
     
    822822    if (psArrayLength(output)) {
    823823        // negative simple so the default is true
    824         if (!ippdbPrintMetadatas(stdout, output, "p4PendingSkyCell", !simple)) {
     824        if (!ippdbPrintMetadatas(stdout, output, "warpPendingSkyCell", !simple)) {
    825825            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    826826            psFree(output);
     
    840840
    841841    bool status = false;
    842     psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
    843     if (!status) {
    844         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");
    845         return false;
    846     }
    847     if (!p4_id) {
    848         psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
     842    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
     843    if (!status) {
     844        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id");
     845        return false;
     846    }
     847    if (!warp_id) {
     848        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
    849849        return false;
    850850    }
     
    900900    }
    901901
    902     // XXX need to validate that this coresponds to an p4InputImfile
    903     if (!p4SkyfileInsert(config->dbh,
    904             (psS32)atoi(p4_id),
     902    // XXX need to validate that this coresponds to an warpInputImfile
     903    if (!warpSkyfileInsert(config->dbh,
     904            (psS32)atoi(warp_id),
    905905            skycell_id,
    906906            tess_id,
     
    916916    }
    917917
    918     if (!p4CompletedRuns(config)) {
     918    if (!warpCompletedRuns(config)) {
    919919        if (!psDBRollback(config->dbh)) {
    920920            psError(PS_ERR_UNKNOWN, false, "database error");
     
    933933}
    934934
    935 bool p4CompletedRuns(pxConfig *config)
     935bool warpCompletedRuns(pxConfig *config)
    936936{
    937937    PS_ASSERT_PTR_NON_NULL(config, false);
     
    945945    // modifying.
    946946    char *query =
    947         "UPDATE p4Run\n"
    948         "   SET p4Run.state = 'stop'\n"
     947        "UPDATE warpRun\n"
     948        "   SET warpRun.state = 'stop'\n"
    949949        " WHERE\n"
    950         "   p4Run.p4_id =\n"
     950        "   warpRun.warp_id =\n"
    951951        "   (SELECT DISTINCT\n"
    952         "       p4_id\n"
     952        "       warp_id\n"
    953953        "   FROM\n"
    954954        "       (SELECT DISTINCT\n"
    955         "           p4Run.p4_id,\n"
    956         "           p4SkyCellMap.p4_id as foo,\n"
    957         "           p4Skyfile.p4_id as bar\n"
    958         "       FROM p4Run\n"
    959         "       JOIN p4SkyCellMap\n"
    960         "           USING(p4_id)\n"
    961         "       LEFT JOIN p4Skyfile\n"
    962         "           USING(p4_id, skycell_id, tess_id)\n"
     955        "           warpRun.warp_id,\n"
     956        "           warpSkyCellMap.warp_id as foo,\n"
     957        "           warpSkyfile.warp_id as bar\n"
     958        "       FROM warpRun\n"
     959        "       JOIN warpSkyCellMap\n"
     960        "           USING(warp_id)\n"
     961        "       LEFT JOIN warpSkyfile\n"
     962        "           USING(warp_id, skycell_id, tess_id)\n"
    963963        "       WHERE\n"
    964         "           p4Run.state = 'run'\n"
     964        "           warpRun.state = 'run'\n"
    965965        "       GROUP BY\n"
    966         "           p4Run.p4_id\n" 
     966        "           warpRun.warp_id\n" 
    967967        "       HAVING\n"
    968         "       COUNT(p4SkyCellMap.p4_id) = COUNT(p4Skyfile.p4_id)\n"
     968        "       COUNT(warpSkyCellMap.warp_id) = COUNT(warpSkyfile.warp_id)\n"
    969969        "       ) as Foo\n"
    970970        "   )\n";
     
    978978    char *query =
    979979        "CREATE TEMPORARY TABLE finished\n"
    980         " (p4_id INT, PRIMARY KEY(p4_id)) ENGINE=MEMORY\n";
     980        " (warp_id INT, PRIMARY KEY(warp_id)) ENGINE=MEMORY\n";
    981981
    982982    if (!p_psDBRunQuery(config->dbh, query)) {
     
    990990        "INSERT INTO finished\n"
    991991        " SELECT\n"
    992         "   p4_id\n"
     992        "   warp_id\n"
    993993        " FROM\n"
    994994        "   (SELECT DISTINCT\n"
    995         "       p4Run.p4_id,\n"
    996         "       p4SkyCellMap.p4_id as foo,\n"
    997         "       p4Skyfile.p4_id as bar\n"
    998         "   FROM p4Run\n"
    999         "   JOIN p4SkyCellMap\n"
    1000         "       USING(p4_id)\n"
    1001         "   LEFT JOIN p4Skyfile\n"
    1002         "       USING(p4_id, skycell_id, tess_id)\n"
     995        "       warpRun.warp_id,\n"
     996        "       warpSkyCellMap.warp_id as foo,\n"
     997        "       warpSkyfile.warp_id as bar\n"
     998        "   FROM warpRun\n"
     999        "   JOIN warpSkyCellMap\n"
     1000        "       USING(warp_id)\n"
     1001        "   LEFT JOIN warpSkyfile\n"
     1002        "       USING(warp_id, skycell_id, tess_id)\n"
    10031003        "   WHERE\n"
    1004         "       p4Run.state = 'run'\n"
     1004        "       warpRun.state = 'run'\n"
    10051005        "   GROUP BY\n"
    1006         "       p4Run.p4_id\n" 
     1006        "       warpRun.warp_id\n" 
    10071007        "   HAVING\n"
    1008         "       COUNT(p4SkyCellMap.p4_id) = COUNT(p4Skyfile.p4_id)\n"
     1008        "       COUNT(warpSkyCellMap.warp_id) = COUNT(warpSkyfile.warp_id)\n"
    10091009        " ) as Foo \n";
    10101010
     
    10171017{   
    10181018    char *query =
    1019         "UPDATE p4Run\n"
    1020         "   SET p4Run.state = 'stop'\n"
     1019        "UPDATE warpRun\n"
     1020        "   SET warpRun.state = 'stop'\n"
    10211021        " WHERE\n"
    1022         "   p4Run.p4_id =\n"
     1022        "   warpRun.warp_id =\n"
    10231023        "   (SELECT DISTINCT\n"
    1024         "       p4_id\n"
     1024        "       warp_id\n"
    10251025        "   FROM finished\n"
    10261026        "   )\n";
     
    10501050    psString query = psStringCopy(
    10511051        "SELECT\n"
    1052         "   p4Skyfile.*\n"
    1053         " FROM p4Run\n"
    1054         " JOIN p4Skyfile\n"
    1055         "   USING(p4_id)\n"
     1052        "   warpSkyfile.*\n"
     1053        " FROM warpRun\n"
     1054        " JOIN warpSkyfile\n"
     1055        "   USING(warp_id)\n"
    10561056        " WHERE\n"
    1057         "   p4Run.state = 'run'\n"
     1057        "   warpRun.state = 'run'\n"
    10581058    );
    10591059
    10601060    if (config->where) {
    1061         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4Skyfile");
     1061        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyfile");
    10621062        psStringAppend(&query, " AND %s", whereClause);
    10631063        psFree(whereClause);
     
    10931093    }
    10941094    if (!psArrayLength(output)) {
    1095         psError(PS_ERR_UNKNOWN, false, "no p4Skyfile rows found");
     1095        psError(PS_ERR_UNKNOWN, false, "no warpSkyfile rows found");
    10961096        psFree(output);
    10971097        return true;
     
    11101110    if (psArrayLength(output)) {
    11111111        // negative simple so the default is true
    1112         if (!ippdbPrintMetadatas(stdout, output, "p4Skyfile", !simple)) {
     1112        if (!ippdbPrintMetadatas(stdout, output, "warpSkyfile", !simple)) {
    11131113            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    11141114            psFree(output);
     
    11231123
    11241124
    1125 static bool setp4RunState(pxConfig *config, const char *p4_id, const char *state)
    1126 {
    1127     PS_ASSERT_PTR_NON_NULL(p4_id, false);
     1125static bool setwarpRunState(pxConfig *config, const char *warp_id, const char *state)
     1126{
     1127    PS_ASSERT_PTR_NON_NULL(warp_id, false);
    11281128    PS_ASSERT_PTR_NON_NULL(state, false);
    11291129
     
    11361136    ) {
    11371137        psError(PS_ERR_UNKNOWN, false,
    1138                 "invalid p4Run state: %s", state);
    1139         return false;
    1140     }
    1141 
    1142     char *query = "UPDATE p4Run SET state = '%s' WHERE p4_id = '%s'";
    1143     if (!p_psDBRunQuery(config->dbh, query, state, p4_id)) {
     1138                "invalid warpRun state: %s", state);
     1139        return false;
     1140    }
     1141
     1142    char *query = "UPDATE warpRun SET state = '%s' WHERE warp_id = '%s'";
     1143    if (!p_psDBRunQuery(config->dbh, query, state, warp_id)) {
    11441144        psError(PS_ERR_UNKNOWN, false,
    1145                 "failed to change state for p4_id %s", p4_id);
     1145                "failed to change state for warp_id %s", warp_id);
    11461146        return false;
    11471147    }
  • trunk/ippTools/src/warptoolConfig.c

    r11997 r12024  
    5959    // -updaterun
    6060    psMetadata *updaterunArgs = psMetadataAlloc();
    61     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-p4_id", 0,
    62             "define p4 ID (required)", NULL);
     61    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-warp_id", 0,
     62            "define warp ID (required)", NULL);
    6363    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0,
    6464            "set state (required)", NULL);
     
    7272    // -addinputexp
    7373    psMetadata *addinputexpArgs = psMetadataAlloc();
    74     psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-p4_id", 0,
    75             "define p4 ID (required)", NULL);
     74    psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-warp_id", 0,
     75            "define warp ID (required)", NULL);
    7676    psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
    7777            "define exposure tag (required)", NULL);
    78     psMetadataAddS32(addinputexpArgs, PS_LIST_TAIL, "-p3_version", 0,
     78    psMetadataAddS32(addinputexpArgs, PS_LIST_TAIL, "-cam_version", 0,
    7979            "define phase 3 version of exposure tag (required)", 0);
    8080    psMetadataAddBool(addinputexpArgs, PS_LIST_TAIL, "-magiced",  0,
     
    8383    // -exp
    8484    psMetadata *expArgs = psMetadataAlloc();
    85     psMetadataAddStr(expArgs, PS_LIST_TAIL, "-p4_id", 0,
    86             "define p4 ID (required)", NULL);
     85    psMetadataAddStr(expArgs, PS_LIST_TAIL, "-warp_id", 0,
     86            "define warp ID (required)", NULL);
    8787    psMetadataAddStr(expArgs, PS_LIST_TAIL, "-exp_tag", 0,
    8888            "define exposure tag (required)", NULL);
    89     psMetadataAddS32(expArgs, PS_LIST_TAIL, "-p3_version", 0,
     89    psMetadataAddS32(expArgs, PS_LIST_TAIL, "-cam_version", 0,
    9090            "define phase 3 version of exposure tag (required)", 0);
    9191    psMetadataAddU64(expArgs, PS_LIST_TAIL, "-limit",  0,
     
    9696    // -imfile
    9797    psMetadata *imfileArgs = psMetadataAlloc();
    98     psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-p4_id", 0,
    99             "define p4 ID (required)", NULL);
     98    psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-warp_id", 0,
     99            "define warp ID (required)", NULL);
    100100    psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-exp_tag", 0,
    101101            "define exposure tag (required)", NULL);
    102     psMetadataAddS32(imfileArgs, PS_LIST_TAIL, "-p3_version", 0,
     102    psMetadataAddS32(imfileArgs, PS_LIST_TAIL, "-cam_version", 0,
    103103            "define phase 3 version of exposure tag (required)", 0);
    104104    psMetadataAddU64(imfileArgs, PS_LIST_TAIL, "-limit",  0,
     
    109109    // -tooverlap
    110110    psMetadata *tooverlapArgs = psMetadataAlloc();
    111     psMetadataAddStr(tooverlapArgs, PS_LIST_TAIL, "-p4_id", 0,
    112             "search by p4 ID", NULL);
     111    psMetadataAddStr(tooverlapArgs, PS_LIST_TAIL, "-warp_id", 0,
     112            "search by warp ID", NULL);
    113113    psMetadataAddU64(tooverlapArgs, PS_LIST_TAIL, "-limit",  0,
    114114            "limit result set to N items", 0);
     
    123123    // -scmap
    124124    psMetadata *scmapArgs = psMetadataAlloc();
    125     psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "-p4_id", 0,
    126             "search by p4 ID", NULL);
     125    psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "-warp_id", 0,
     126            "search by warp ID", NULL);
    127127    psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "-skycell_id", 0,
    128128            "searcy by skycell ID", NULL);
     
    136136    // -towarped
    137137    psMetadata *towarpedArgs = psMetadataAlloc();
    138     psMetadataAddStr(towarpedArgs, PS_LIST_TAIL, "-p4_id", 0,
    139             "search by p4 ID", NULL);
     138    psMetadataAddStr(towarpedArgs, PS_LIST_TAIL, "-warp_id", 0,
     139            "search by warp ID", NULL);
    140140    psMetadataAddU64(towarpedArgs, PS_LIST_TAIL, "-limit",  0,
    141141            "limit result set to N items", 0);
     
    145145    // -addwarped
    146146    psMetadata *addwarpedArgs = psMetadataAlloc();
    147     psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-p4_id", 0,
    148             "define p4 ID (required)", NULL);
     147    psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-warp_id", 0,
     148            "define warp ID (required)", NULL);
    149149    psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-skycell_id",  0,
    150150            "define skycell ID (required)", NULL);
     
    160160    // -warped
    161161    psMetadata *warpedArgs = psMetadataAlloc();
    162     psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-p4_id", 0,
    163             "search by p4 ID", NULL);
     162    psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-warp_id", 0,
     163            "search by warp ID", NULL);
    164164    psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-skycell_id",  0,
    165165            "define skycell ID (required)", NULL);
     
    168168    psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-exp_tag", 0,
    169169            "define exposure tag (required)", NULL);
    170     psMetadataAddS32(warpedArgs, PS_LIST_TAIL, "-p3_version", 0,
     170    psMetadataAddS32(warpedArgs, PS_LIST_TAIL, "-cam_version", 0,
    171171            "define phase 3 version of exposure tag (required)", 0);
    172172    psMetadataAddU64(warpedArgs, PS_LIST_TAIL, "-limit",  0,
     
    285285    psString str = NULL;
    286286    bool status = false;
    287     if ((str = psMetadataLookupStr(&status, config->args, "-p4_id"))) {
    288         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p4_id", 0, "==", (psS32)atoi(str))) {
    289             psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");
     287    if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) {
     288        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS32)atoi(str))) {
     289            psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    290290            psFree(config);
    291291            return NULL;
Note: See TracChangeset for help on using the changeset viewer.