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