IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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        }
Note: See TracChangeset for help on using the changeset viewer.