IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19371


Ignore:
Timestamp:
Sep 4, 2008, 2:23:50 PM (18 years ago)
Author:
eugene
Message:

various updates to support needed queries for the flatcorr script

Location:
trunk/ippTools
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/share/Makefile.am

    r19334 r19371  
    9292     flatcorr_chiprundone.sql \
    9393     flatcorr_pendingprocess.sql \
     94     flatcorr_inputimfile.sql \
    9495     magictool_addmask.sql \
    9596     magictool_create_tmp_warpcomplete.sql \
  • trunk/ippTools/share/flatcorr_pendingprocess.sql

    r19325 r19371  
    77  label,
    88  reduction,
    9   region
     9  region,
    1010  chip_count,
    1111  cam_count
  • trunk/ippTools/src/flatcorr.c

    r19325 r19371  
    131131
    132132    if (where && psListLength(where->list)) {
    133         psString whereClause = psDBGenerateWhereConditionSQL(where, "rawExp");
     133        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    134134        psStringAppend(&query, " AND %s", whereClause);
    135135        psFree(whereClause);
     
    177177
    178178    // create a new flatcorrRun
    179     if (!flatcorrRunInsert(config->dbh,
     179    if (!flatcorrRunInsert(
     180            config->dbh,
    180181            0,      // corr_id
    181182            dvodb,
     
    184185            workdir,
    185186            label,
    186             NULL,   // stats
    187187            reduction,
    188             region
     188            region,
     189            NULL,
     190            0
    189191        )) {
    190192        if (!psDBRollback(config->dbh)) {
     
    285287        workdir,
    286288        label,
    287         NULL,   // stats
    288289        reduction,
    289         region
     290        region,
     291        NULL, // hostname
     292        0 // fault
    290293        );
    291294
     
    549552    PXOPT_LOOKUP_BOOL(simple,  config->args, "-simple",  false);
    550553    PXOPT_LOOKUP_BOOL(limit,   config->args, "-limit",   false);
    551 
    552     char *query = psStringCopy ("SELECT * FROM chipProcessedImfile WHERE chip_id = %" PRId64);
     554   
     555    psMetadata *where = psMetadataAlloc();
     556    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "==");
     557
     558    psString query = pxDataGet("flatcorr_inputimfile.sql");
     559    if (!query) {
     560        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     561        return false;
     562    }
     563
     564    if (where && psListLength(where->list)) {
     565        psString whereClause = psDBGenerateWhereSQL(where, NULL);
     566        psStringAppend(&query, " %s", whereClause);
     567        psFree(whereClause);
     568    }
     569    psFree(where);
    553570
    554571    // treat limit == 0 as "no limit"
     
    591608
    592609    PXOPT_LOOKUP_S64(corr_id, config->args, "-corr_id", true, false);
    593 
    594     if (!setflatcorrRunState(config, corr_id, "full")) {
    595         if (!psDBRollback(config->dbh)) {
    596             psError(PS_ERR_UNKNOWN, false, "database error");
    597         }
    598         psError(PS_ERR_UNKNOWN, false, "failed to set run state");
     610    PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false);
     611    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     612
     613    char *query = "UPDATE flatcorrRun SET state = 'full', hostname = '%s', fault = '%hd' WHERE corr_id = %" PRId64;
     614
     615    if (!p_psDBRunQuery(config->dbh, query, hostname, code, corr_id)) {
     616        psError(PS_ERR_UNKNOWN, false, "failed to change state for corr_id %" PRId64, corr_id);
    599617        return false;
    600618    }
     
    636654
    637655    char *query = "UPDATE flatcorrRun SET state = '%s' WHERE corr_id = %" PRId64;
     656
    638657    if (!p_psDBRunQuery(config->dbh, query, state, corr_id)) {
    639         psError(PS_ERR_UNKNOWN, false,
    640                 "failed to change state for corr_id %" PRId64, corr_id);
    641         return false;
    642     }
    643 
    644     return true;
    645 }
    646 
    647 
     658        psError(PS_ERR_UNKNOWN, false, "failed to change state for corr_id %" PRId64, corr_id);
     659        return false;
     660    }
     661
     662    return true;
     663}
  • trunk/ippTools/src/flatcorrConfig.c

    r19325 r19371  
    9292    // -addprocess (XXX need to add fault and stats)
    9393    psMetadata *addprocessArgs = psMetadataAlloc();
    94     psMetadataAddS64 (addprocessArgs, PS_LIST_TAIL, "-corr_id", 0, "add complete run for specified corr_id (required)", 0);
     94    psMetadataAddS64 (addprocessArgs, PS_LIST_TAIL, "-corr_id",  0, "add complete run for specified corr_id (required)", 0);
     95    psMetadataAddStr (addprocessArgs, PS_LIST_TAIL, "-hostname", 0, "set hostname", NULL);
     96    psMetadataAddS16 (addprocessArgs, PS_LIST_TAIL, "-code",     0, "set fault code", 0);
    9597
    9698    // -updaterun
Note: See TracChangeset for help on using the changeset viewer.