IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20744


Ignore:
Timestamp:
Nov 13, 2008, 4:34:27 PM (17 years ago)
Author:
Paul Price
Message:

Add diffRun labels. Allow generation of a magic run even if one already exists with the '-new' flag.

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r20734 r20744  
    153153        psMetadata *where = psMetadataAlloc();
    154154        PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     155        PXOPT_COPY_STR(config->args, where, "-diff_label", "diffRun.label", "==");
    155156        PXOPT_COPY_F32(config->args, where, "-good_frac", "warpSkyfile.good_frac", ">=");
    156157
     
    180181        }
    181182
    182         psString whereClause = NULL;    // WHERE conditions
     183        psString magicSkyCellNumsWhere = NULL;    // WHERE conditions for magicSkyCellNums
    183184        {
    184185            psMetadata *where = psMetadataAlloc();
    185186            PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     187            PXOPT_COPY_STR(config->args, where, "-diff_label", "diffRun.label", "==");
    186188            PXOPT_COPY_F32(config->args, where, "-good_frac", "warpSkyfile.good_frac", ">=");
    187189
    188190            if (psListLength(where->list)) {
    189                 whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    190                 psStringPrepend(&whereClause, "\n AND ");
     191                magicSkyCellNumsWhere = psDBGenerateWhereConditionSQL(where, NULL);
     192                psStringPrepend(&magicSkyCellNumsWhere, "\n AND ");
    191193            }
    192194            psFree(where);
    193195        }
    194196
    195         // Only concern ourselves with exposures that have all diffs completed, unless we're told to only take
    196         // what's available.
     197        // "available" means only concern ourselves with exposures that have all diffs completed, unless we're
     198        // told to only take what's available.
     199        // "new" means we want a new run even if there's already a magic run defined
    197200        PXOPT_LOOKUP_BOOL(available, config->args, "-available", false);
    198         if (!available) {
    199             psStringAppend(&query, " AND num_done = num_todo");
    200         }
    201 
    202         if (!p_psDBRunQuery(config->dbh, query, whereClause ? whereClause : "")) {
     201        PXOPT_LOOKUP_BOOL(new, config->args, "-new", false);
     202
     203        psString queryWhere = NULL;     // WHERE conditions for entire query
     204        if (available) {
     205            psStringAppend(&queryWhere, " WHERE num_done = num_todo");
     206        }
     207        if (new) {
     208            const char *newWhere = " magic_id IS NULL"; // String to add
     209            if (queryWhere) {
     210                psStringAppend(&queryWhere, " AND %s", newWhere);
     211            } else {
     212                psStringAppend(&queryWhere, " WHERE %s", newWhere);
     213            }
     214        }
     215        if (queryWhere) {
     216            psStringAppend(&query, " %s", queryWhere);
     217            psFree(queryWhere);
     218        }
     219
     220
     221        if (!p_psDBRunQuery(config->dbh, query, magicSkyCellNumsWhere ? magicSkyCellNumsWhere : "")) {
    203222            psError(PS_ERR_UNKNOWN, false, "database error");
    204             psFree(whereClause);
     223            psFree(magicSkyCellNumsWhere);
    205224            psFree(query);
    206225            return false;
    207226        }
    208         psFree(whereClause);
     227        psFree(magicSkyCellNumsWhere);
    209228        psFree(query);
    210229    }
  • trunk/ippTools/src/magictoolConfig.c

    r20734 r20744  
    5454    psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-registered", 0, "time detrend run was registered", now);
    5555    psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-exp_id", 0, "search exp_id", 0);
     56    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-diff_label", 0, "select diff label", NULL);
    5657    psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-good_frac", 0, "limit good_frac", NAN);
    5758    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-available", 0, "process what's immediately available?", false);
     59    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-new", 0, "generate new run even if existing?", false);
    5860    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
    5961
Note: See TracChangeset for help on using the changeset viewer.