IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11983


Ignore:
Timestamp:
Feb 21, 2007, 3:52:48 PM (19 years ago)
Author:
jhoblitt
Message:

improved p4tool transactions
remove p6SumScfile.{skycell_id, tess_id}
add p6Run.{skycell_id, tess_id}
change p6tool -addsumfile to change the runs' state to stop

Location:
trunk/ippTools/src
Files:
3 edited

Legend:

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

    r11976 r11983  
    3939static bool sumscfileMode(pxConfig *config);
    4040
    41 static bool setp6RunState(pxConfig *config, const char *p4_id, const char *state);
     41static bool setp6RunState(pxConfig *config, const char *p6_id, const char *state);
    4242
    4343# define MODECASE(caseName, func) \
     
    104104    }
    105105
     106    psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id");
     107    if (!status) {
     108        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id");
     109        return false;
     110    }
     111    if (!skycell_id) {
     112        psError(PS_ERR_UNKNOWN, true, "-skycell_id is required");
     113        return false;
     114    }
     115
     116    psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id");
     117    if (!status) {
     118        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id");
     119        return false;
     120    }
     121    if (!tess_id) {
     122        psError(PS_ERR_UNKNOWN, true, "-tess_id is required");
     123        return false;
     124    }
     125
    106126    psTime *registered = NULL;
    107127    {
     
    124144            workdir,
    125145            NULL,       // dvodb
    126             registered
     146            registered,
     147            skycell_id,
     148            tess_id
    127149    );
    128150    psFree(registered);
     
    223245    }
    224246
    225     psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id");
    226     if (!status) {
    227         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id");
    228         return false;
    229     }
    230     if (!skycell_id) {
    231         psError(PS_ERR_UNKNOWN, true, "-skycell_id is required");
    232         return false;
    233     }
    234 
    235     psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id");
    236     if (!status) {
    237         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id");
    238         return false;
    239     }
    240     if (!tess_id) {
    241         psError(PS_ERR_UNKNOWN, true, "-tess_id is required");
    242         return false;
    243     }
    244247
    245248    // XXX need to validate the p4_id here
     
    248251    if (!p6InputScfileInsert(config->dbh,
    249252            (psS32)atoi(p6_id),
    250             (psS32)atoi(p4_id),
    251             skycell_id,
    252             tess_id
     253            (psS32)atoi(p4_id)
    253254        )) {
    254255        psError(PS_ERR_UNKNOWN, false, "database error");
     
    279280        "   USING(p6_id)\n"
    280281        " JOIN p4Scfile\n"
    281         "   ON p6InputScfile.p4_id = p4Scfile.p4_id\n"
    282         "   AND p6InputScfile.skycell_id = p4Scfile.skycell_id\n"
    283         "   AND p6InputScfile.tess_id = p4Scfile.tess_id\n"
     282        "   ON  p6InputScfile.p4_id = p4Scfile.p4_id\n"
     283        "   AND p6Run.skycell_id    = p4Scfile.skycell_id\n"
     284        "   AND p6Run.tess_id      = p4Scfile.tess_id\n"
    284285        " WHERE\n"
    285286        "   p6Run.state = 'run'\n"
     
    454455    }
    455456
    456     psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id");
    457     if (!status) {
    458         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id");
    459         return false;
    460     }
    461     if (!skycell_id) {
    462         psError(PS_ERR_UNKNOWN, true, "-skycell_id is required");
    463         return false;
    464     }
    465 
    466     psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id");
    467     if (!status) {
    468         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id");
    469         return false;
    470     }
    471     if (!tess_id) {
    472         psError(PS_ERR_UNKNOWN, true, "-tess_id is required");
    473         return false;
    474     }
    475 
    476457    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    477458    if (!status) {
     
    494475    if (!status) {
    495476        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_mean_stdev");
     477        return false;
     478    }
     479
     480    if (!psDBTransaction(config->dbh)) {
     481        psError(PS_ERR_UNKNOWN, false, "database error");
    496482        return false;
    497483    }
     
    502488    if (!p6SumScfileInsert(config->dbh,
    503489            (psS32)atoi(p6_id),
    504             skycell_id,
    505             tess_id,
    506490            uri,
    507491            bg,
    508492            bg_mean_stdev
    509493        )) {
     494        if (!psDBRollback(config->dbh)) {
     495            psError(PS_ERR_UNKNOWN, false, "database error");
     496        }
     497        psError(PS_ERR_UNKNOWN, false, "database error");
     498        return false;
     499    }
     500
     501    if (setp6RunState(config, p6_id, "stop")) {
     502        if (!psDBRollback(config->dbh)) {
     503            psError(PS_ERR_UNKNOWN, false, "database error");
     504        }
     505        psError(PS_ERR_UNKNOWN, false, "failed to change p6Run's state");
     506        return false;
     507    }
     508
     509    // point of no return
     510    if (!psDBCommit(config->dbh)) {
    510511        psError(PS_ERR_UNKNOWN, false, "database error");
    511512        return false;
  • trunk/ippTools/src/stacktoolConfig.c

    r11866 r11983  
    5252    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-registered",  0,
    5353            "time detrend run was registered", now);
     54    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-skycell_id",  0,
     55            "define skycell ID (required)", NULL);
     56    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-tess_id",  0,
     57            "define tessellation ID (required)", NULL);
    5458    psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-simple",  0,
    5559            "use the simple output format", false);
     
    7478    psMetadataAddStr(addinputscfileArgs, PS_LIST_TAIL, "-p4_id", 0,
    7579            "define p4 ID (required)", NULL);
    76     psMetadataAddStr(addinputscfileArgs, PS_LIST_TAIL, "-skycell_id",  0,
    77             "define skycell ID (required)", NULL);
    78     psMetadataAddStr(addinputscfileArgs, PS_LIST_TAIL, "-tess_id",  0,
    79             "define tessellation ID (required)", NULL);
    8080
    8181    // -inputscfile
     
    8585    psMetadataAddStr(inputscfileArgs, PS_LIST_TAIL, "-p4_id", 0,
    8686            "search by p4 ID (required)", NULL);
    87     psMetadataAddStr(inputscfileArgs, PS_LIST_TAIL, "-skycell_id",  0,
    88             "search by skycell ID (required)", NULL);
    89     psMetadataAddStr(inputscfileArgs, PS_LIST_TAIL, "-tess_id",  0,
    90             "search by tessellation ID (required)", NULL);
    9187    psMetadataAddU64(inputscfileArgs, PS_LIST_TAIL, "-limit",  0,
    9288            "limit result set to N items", 0);
     
    10096    psMetadataAddStr(tosumArgs, PS_LIST_TAIL, "-p4_id", 0,
    10197            "search by p4 ID (required)", NULL);
    102     psMetadataAddStr(tosumArgs, PS_LIST_TAIL, "-skycell_id",  0,
    103             "search by skycell ID (required)", NULL);
    104     psMetadataAddStr(tosumArgs, PS_LIST_TAIL, "-tess_id",  0,
    105             "search by tessellation ID (required)", NULL);
    10698    psMetadataAddU64(tosumArgs, PS_LIST_TAIL, "-limit",  0,
    10799            "limit result set to N items", 0);
     
    113105    psMetadataAddStr(addsumscfileArgs, PS_LIST_TAIL, "-p6_id", 0,
    114106            "define p4 ID (required)", NULL);
    115     psMetadataAddStr(addsumscfileArgs, PS_LIST_TAIL, "-skycell_id",  0,
    116             "define skycell ID (required)", NULL);
    117     psMetadataAddStr(addsumscfileArgs, PS_LIST_TAIL, "-tess_id",  0,
    118             "define tessellation ID (required)", NULL);
    119107    psMetadataAddStr(addsumscfileArgs, PS_LIST_TAIL, "-uri", 0,
    120108            "define URI of file (required)", 0);
     
    130118    psMetadataAddStr(sumscfileArgs, PS_LIST_TAIL, "-p4_id", 0,
    131119            "search by p4 ID (required)", NULL);
    132     psMetadataAddStr(sumscfileArgs, PS_LIST_TAIL, "-skycell_id",  0,
    133             "search by skycell ID (required)", NULL);
    134     psMetadataAddStr(sumscfileArgs, PS_LIST_TAIL, "-tess_id",  0,
    135             "search by tessellation ID (required)", NULL);
    136120    psMetadataAddU64(sumscfileArgs, PS_LIST_TAIL, "-limit",  0,
    137121            "limit result set to N items", 0);
  • trunk/ippTools/src/warptool.c

    r11981 r11983  
    909909            bg_mean_stdev
    910910        )) {
     911        if (!psDBRollback(config->dbh)) {
     912            psError(PS_ERR_UNKNOWN, false, "database error");
     913        }
    911914        psError(PS_ERR_UNKNOWN, false, "database error");
    912915        return false;
     
    914917
    915918    if (!p4CompletedRuns(config)) {
     919        if (!psDBRollback(config->dbh)) {
     920            psError(PS_ERR_UNKNOWN, false, "database error");
     921        }
    916922        psError(PS_ERR_UNKNOWN, false, "database error");
    917923        return false;
Note: See TracChangeset for help on using the changeset viewer.