IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21463 for trunk/ippTools


Ignore:
Timestamp:
Feb 13, 2009, 8:51:50 AM (17 years ago)
Author:
bills
Message:

Add new tasks to handle promotion of exposures from chip to camera stage
and from camera to fake. Remove unreliable attempts to promote automatically
in the processed imfile mode. Add new -promoteexp modes to be called from
the tasks.

Location:
trunk/ippTools/src
Files:
6 edited

Legend:

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

    r21402 r21463  
    4242static bool revertprocessedimfileMode(pxConfig *config);
    4343static bool updateprocessedimfileMode(pxConfig *config);
     44static bool promoteexpMode(pxConfig *config);
    4445static bool blockMode(pxConfig *config);
    4546static bool maskedMode(pxConfig *config);
     
    5455static bool topurgedimfileMode(pxConfig *config);
    5556
    56 static bool chipProcessedCompleteExp(pxConfig *config);
    57 
    5857# define MODECASE(caseName, func) \
    5958    case caseName: \
     
    8079        MODECASE(CHIPTOOL_MODE_REVERTPROCESSEDIMFILE,   revertprocessedimfileMode);
    8180        MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE,   updateprocessedimfileMode);
     81        MODECASE(CHIPTOOL_MODE_PROMOTEEXP,              promoteexpMode);
    8282        MODECASE(CHIPTOOL_MODE_BLOCK,                   blockMode);
    8383        MODECASE(CHIPTOOL_MODE_MASKED,                  maskedMode);
     
    495495    }
    496496
     497#if 0
    497498    // XXX I've decided to make the transaction cover the Exp migration as
    498499    // well.  Otherwise, if the last imfile in an exp is moved and the exp
     
    508509        return false;
    509510    }
     511#endif
    510512
    511513    if (!psDBCommit(config->dbh)) {
     
    10741076
    10751077
    1076 static bool chipProcessedCompleteExp(pxConfig *config)
     1078static bool promoteexpMode(pxConfig *config)
    10771079{
    10781080    PS_ASSERT_PTR_NON_NULL(config, false);
     1081
     1082    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     1083
     1084    psMetadata *where = psMetadataAlloc();
     1085    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
    10791086
    10801087    // look for completed chipPendingExp
     
    10861093    }
    10871094
     1095    if (where && psListLength(where->list)) {
     1096        psString whereClause = psDBGenerateWhereSQL(where, NULL);
     1097        psStringAppend(&query, " %s", whereClause);
     1098        psFree(whereClause);
     1099    }
     1100    psFree(where);
     1101
     1102    // treat limit == 0 as "no limit"
     1103    if (limit) {
     1104        psString limitString = psDBGenerateLimitSQL(limit);
     1105        psStringAppend(&query, " %s", limitString);
     1106        psFree(limitString);
     1107    }
     1108
    10881109    if (!p_psDBRunQuery(config->dbh, query)) {
    10891110        psError(PS_ERR_UNKNOWN, false, "database error");
     
    11081129
    11091130        chipRunRow *chipRun = chipRunObjectFromMetadata(row);
     1131        if (!psDBTransaction(config->dbh)) {
     1132            psError(PS_ERR_UNKNOWN, false, "database error");
     1133            return false;
     1134        }
     1135
    11101136        // set chipRun.state to 'stop'
    11111137        if (!pxchipRunSetState(config, chipRun->chip_id, "full")) {
     
    11191145        // NULL for end_stage means go as far as possible
    11201146        if (chipRun->end_stage && psStrcasestr(chipRun->end_stage, "chip")) {
     1147            if (!psDBCommit(config->dbh)) {
     1148                psError(PS_ERR_UNKNOWN, false, "database error");
     1149                return false;
     1150            }
     1151
    11211152            psFree(chipRun);
    11221153            continue;
     
    11361167                    chipRun->end_stage
    11371168        )) {
    1138             // rollback
    1139             if (!psDBRollback(config->dbh)) {
     1169           if (!psDBRollback(config->dbh)) {
    11401170                psError(PS_ERR_UNKNOWN, false, "database error");
    11411171            }
     
    11451175            return false;
    11461176        }
     1177        if (!psDBCommit(config->dbh)) {
     1178            psError(PS_ERR_UNKNOWN, false, "database error");
     1179            return false;
     1180        }
    11471181        psFree(chipRun);
    11481182    }
  • trunk/ippTools/src/chiptool.h

    r19334 r21463  
    3232    CHIPTOOL_MODE_REVERTPROCESSEDIMFILE,
    3333    CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE,
     34    CHIPTOOL_MODE_PROMOTEEXP,
    3435    CHIPTOOL_MODE_BLOCK,
    3536    CHIPTOOL_MODE_MASKED,
  • trunk/ippTools/src/chiptoolConfig.c

    r21308 r21463  
    176176    psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code (required)", 0);
    177177
     178    // -promoteexp
     179    psMetadata *promoteexpArgs = psMetadataAlloc();
     180    psMetadataAddS64(promoteexpArgs, PS_LIST_TAIL, "-chip_id",  0,          "search by chip ID", 0);
     181    psMetadataAddStr(promoteexpArgs, PS_LIST_TAIL, "-label",  0,            "promote exposures for specified label", NULL);
     182    psMetadataAddU64(promoteexpArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
     183
    178184    // -block
    179185    psMetadata *blockArgs = psMetadataAlloc();
     
    248254    PXOPT_ADD_MODE("-updateprocessedimfile","change procesed imfile properties",    CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE,updateprocessedimfileArgs);
    249255    PXOPT_ADD_MODE("-revertprocessedimfile","undo a processed imfile",              CHIPTOOL_MODE_REVERTPROCESSEDIMFILE,revertprocessedimfileArgs);
     256    PXOPT_ADD_MODE("-promoteexp",           "promote completed exposures",          CHIPTOOL_MODE_PROMOTEEXP,           promoteexpArgs);
    250257    PXOPT_ADD_MODE("-block",                "set a label block",                    CHIPTOOL_MODE_BLOCK,                blockArgs);
    251258    PXOPT_ADD_MODE("-masked",               "show blocked labels",                  CHIPTOOL_MODE_MASKED,               maskedArgs);
  • trunk/ippTools/src/faketool.c

    r21402 r21463  
    4141static bool revertprocessedimfileMode(pxConfig *config);
    4242static bool updateprocessedimfileMode(pxConfig *config);
     43static bool promoteexpMode(pxConfig *config);
    4344static bool blockMode(pxConfig *config);
    4445static bool maskedMode(pxConfig *config);
     
    5253static bool topurgedimfileMode(pxConfig *config);
    5354
    54 static bool fakeProcessedCompleteExp(pxConfig *config);
    55 
    5655# define MODECASE(caseName, func) \
    5756    case caseName: \
     
    7978        MODECASE(FAKETOOL_MODE_REVERTPROCESSEDIMFILE,   revertprocessedimfileMode);
    8079        MODECASE(FAKETOOL_MODE_UPDATEPROCESSEDIMFILE,   updateprocessedimfileMode);
     80        MODECASE(FAKETOOL_MODE_PROMOTEEXP,              promoteexpMode);
    8181        MODECASE(FAKETOOL_MODE_BLOCK,                   blockMode);
    8282        MODECASE(FAKETOOL_MODE_MASKED,                  maskedMode);
     
    520520    }
    521521
    522     // XXX I've decided to make the transaction cover the Exp migration as
    523     // well.  Otherwise, if the last imfile in an exp is moved and the exp
    524     // migration fails then the data base is left in a satuation where the exp
    525     // migration can't happen.
    526 
    527     if (!fakeProcessedCompleteExp(config)) {
    528         // rollback
    529         if (!psDBRollback(config->dbh)) {
    530             psError(PS_ERR_UNKNOWN, false, "database error");
    531         }
    532         psError(PS_ERR_UNKNOWN, false, "database error");
    533         return false;
    534     }
    535 
    536522    if (!psDBCommit(config->dbh)) {
    537523        psError(PS_ERR_UNKNOWN, false, "database error");
     
    10621048}
    10631049
    1064 static bool fakeProcessedCompleteExp(pxConfig *config)
     1050static bool promoteexpMode(pxConfig *config)
    10651051{
    10661052    PS_ASSERT_PTR_NON_NULL(config, false);
     1053
     1054    psMetadata *where = psMetadataAlloc();
     1055    PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "==");
     1056    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     1057
     1058    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    10671059
    10681060    // look for completed fakePendingExp
     
    10741066    }
    10751067
     1068    if (where && psListLength(where->list)) {
     1069        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     1070        psStringAppend(&query, " WHERE %s", whereClause);
     1071        psFree(whereClause);
     1072    }
     1073    psFree(where);
     1074
     1075    // treat limit == 0 as "no limit"
     1076    if (limit) {
     1077        psString limitString = psDBGenerateLimitSQL(limit);
     1078        psStringAppend(&query, " %s", limitString);
     1079        psFree(limitString);
     1080    }
     1081
    10761082    if (!p_psDBRunQuery(config->dbh, query)) {
    10771083        psError(PS_ERR_UNKNOWN, false, "database error");
     
    10961102
    10971103        fakeRunRow *fakeRun = fakeRunObjectFromMetadata(row);
     1104        if (!psDBTransaction(config->dbh)) {
     1105            psError(PS_ERR_UNKNOWN, false, "database error");
     1106            return false;
     1107        }
     1108
    10981109        // set fakeRun.state to 'full'
    10991110        if (!pxfakeRunSetState(config, fakeRun->fake_id, "full")) {
    11001111            psError(PS_ERR_UNKNOWN, false, "failed to change fakeRun.state for fake_id: %" PRId64, fakeRun->fake_id);
     1112            if (!psDBRollback(config->dbh)) {
     1113                psError(PS_ERR_UNKNOWN, false, "database error");
     1114            }
    11011115            psFree(fakeRun);
    11021116            psFree(output);
     
    11041118        }
    11051119
    1106         // should we stop here or proceed on to the cam stage?
     1120        // should we stop here or proceed on to the warp stage?
    11071121        // NULL for end_stage means go as far as possible
    11081122        if ((fakeRun->end_stage && psStrcasestr(fakeRun->end_stage, "fake")) || !fakeRun->tess_id) {
    11091123            psFree(fakeRun);
     1124            if (!psDBCommit(config->dbh)) {
     1125                psError(PS_ERR_UNKNOWN, false, "database error");
     1126                return false;
     1127            }
    11101128            continue;
    11111129        }
    11121130        // else continue on...
    11131131
    1114         // camQueueFakeID() can only be run after fakeRun.state has been set to
    1115         // stop
     1132        // pxwarpQueueByFakeID() can only be run after fakeRun.state has been set to stop
    11161133        if (!pxwarpQueueByFakeID(config,
    11171134                    fakeRun->fake_id,
     
    11221139                    fakeRun->end_stage
    11231140        )) {
    1124             psError(PS_ERR_UNKNOWN, false, "failed to queue camPendingExp");
     1141            psError(PS_ERR_UNKNOWN, false, "failed to queue warpRun");
     1142            if (!psDBRollback(config->dbh)) {
     1143                psError(PS_ERR_UNKNOWN, false, "database error");
     1144            }
    11251145            psFree(fakeRun);
    11261146            psFree(output);
     1147            return false;
     1148        }
     1149        if (!psDBCommit(config->dbh)) {
     1150            psError(PS_ERR_UNKNOWN, false, "database error");
     1151            psFree(fakeRun);
    11271152            return false;
    11281153        }
  • trunk/ippTools/src/faketool.h

    r19702 r21463  
    3333    FAKETOOL_MODE_REVERTPROCESSEDIMFILE,
    3434    FAKETOOL_MODE_UPDATEPROCESSEDIMFILE,
     35    FAKETOOL_MODE_PROMOTEEXP,
    3536    FAKETOOL_MODE_BLOCK,
    3637    FAKETOOL_MODE_MASKED,
  • trunk/ippTools/src/faketoolConfig.c

    r19931 r21463  
    241241    psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
    242242
     243
     244    // -promoteexp
     245    psMetadata *promoteexpArgs = psMetadataAlloc();
     246    psMetadataAddS64(promoteexpArgs, PS_LIST_TAIL, "-fake_id", 0,      "search by fake ID", 0);
     247    psMetadataAddStr(promoteexpArgs, PS_LIST_TAIL, "-label",  0,       "search by label ", NULL);
     248    psMetadataAddU64(promoteexpArgs, PS_LIST_TAIL, "-limit",  0,       "limit exposures to promote to N items", 0);
     249
    243250    // -block
    244251    psMetadata *blockArgs = psMetadataAlloc();
     
    307314    PXOPT_ADD_MODE("-updateprocessedimfile","change procesed imfile properties",     FAKETOOL_MODE_UPDATEPROCESSEDIMFILE,    updateprocessedimfileArgs);
    308315    PXOPT_ADD_MODE("-revertprocessedimfile", "undo a processed imfile",              FAKETOOL_MODE_REVERTPROCESSEDIMFILE,    revertprocessedimfileArgs);
     316    PXOPT_ADD_MODE("-promoteexp",            "promote completed exposoures",         FAKETOOL_MODE_PROMOTEEXP,          promoteexpArgs);
    309317    PXOPT_ADD_MODE("-block",                 "set a label block",                    FAKETOOL_MODE_BLOCK,          blockArgs);
    310318    PXOPT_ADD_MODE("-masked",                "show blocked labels",                  FAKETOOL_MODE_MASKED,         maskedArgs);
Note: See TracChangeset for help on using the changeset viewer.