IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2010, 2:37:19 PM (16 years ago)
Author:
bills
Message:

add time_stamp cuts on disttool -updaterun. When setting state to goto_cleaned
change state only if it is not already cleaned or goto_cleaned.

File:
1 edited

Legend:

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

    r27542 r28259  
    470470    PXOPT_COPY_STR(config->args, where, "-data_group", "distRun.data_group", "LIKE");
    471471    PXOPT_COPY_STR(config->args, where, "-dist_group", "distTarget.dist_group", "==");
    472     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     472    PXOPT_COPY_TIME(config->args, where, "-time_stamp_begin", "distRun.time_stamp", ">=");
     473    PXOPT_COPY_TIME(config->args, where, "-time_stamp_end", "distRun.time_stamp", "<=");
     474
     475    PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false);
     476    PXOPT_LOOKUP_BOOL(full, config->args, "-full", false);
     477    if (clean && full) {
     478        psFree(where);
     479        psError(PXTOOLS_ERR_CONFIG, true, "-clean and -full are contradictory parameters");
     480        return false;
     481    }
    473482
    474483    if (!psListLength(where->list)) {
     
    491500    }
    492501
     502    psString extraWhere = NULL;
    493503    psString query = psStringCopy("UPDATE distRun join distTarget using(target_id, stage) SET distRun.time_stamp = UTC_TIMESTAMP()");
    494504
     
    498508    if (state) {
    499509        psStringAppend(&query, " , distRun.state = '%s'", state);
     510        if (!strcmp(state, "goto_cleaned")) {
     511            // don't queue for clean up if run has already already cleaned
     512            psStringAppend(&extraWhere, " AND (distRun.state != 'cleaned' AND distRun.state != 'goto_cleaned')");
     513        }
    500514    }
    501515
     
    521535    psFree(whereClause);
    522536    psFree(where);
     537
     538    if (extraWhere) {
     539        psStringAppend(&query, extraWhere);
     540    }
     541    if (clean) {
     542        psStringAppend(&query, " AND (distRun.clean)");
     543    } else if (full) {
     544        psStringAppend(&query, " AND (!distRun.clean)");
     545    }
    523546
    524547    if (!p_psDBRunQuery(config->dbh, query)) {
Note: See TracChangeset for help on using the changeset viewer.