IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2014, 4:53:47 PM (12 years ago)
Author:
watersc1
Message:

Changes to support fixing the duplicates in PV3. stacktool now has an updatesass mode which allows stackAssociation.data_group to be altered. laptool now has a revertsass mode which resets the lapRun.final_sass_id to NULL, allowing new stacks to be requeued for that run.

File:
1 edited

Legend:

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

    r37104 r37384  
    4141static bool sumskyfileMode(pxConfig *config);
    4242static bool sassskyfileMode(pxConfig *config);
     43static bool updatesassMode(pxConfig *config);
    4344static bool revertsumskyfileMode(pxConfig *config);
    4445static bool tosummaryMode(pxConfig *config);
     
    8283        MODECASE(STACKTOOL_MODE_ADDSUMSKYFILE,         addsumskyfileMode);
    8384        MODECASE(STACKTOOL_MODE_SUMSKYFILE,            sumskyfileMode);
    84         MODECASE(STACKTOOL_MODE_SASSSKYFILE,            sassskyfileMode);
     85        MODECASE(STACKTOOL_MODE_SASSSKYFILE,           sassskyfileMode);
     86        MODECASE(STACKTOOL_MODE_UPDATESASS,            updatesassMode);
    8587        MODECASE(STACKTOOL_MODE_REVERTSUMSKYFILE,      revertsumskyfileMode);
    8688        MODECASE(STACKTOOL_MODE_TOSUMMARY,             tosummaryMode);
     
    12951297    PXOPT_COPY_STR(config->args, where, "-data_group", "stackAssociation.data_group", "LIKE");
    12961298
    1297 //  The following three selectors are incompatible with the sql so omit them
    1298 //    PXOPT_COPY_S64(config->args, where, "-warp_id", "warpRun.warp_id", "==");
    1299 //     PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");
    1300 //    PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "==");
    1301 
    13021299    PXOPT_LOOKUP_BOOL(all, config->args, "-all", false);
    13031300
     
    13691366}
    13701367
     1368static bool updatesassMode(pxConfig *config)
     1369{
     1370  PS_ASSERT_PTR_NON_NULL(config, false);
     1371
     1372  psMetadata *where = psMetadataAlloc();
     1373  PXOPT_COPY_S64(config->args, where, "-sass_id", "sass_id", "==");
     1374  PXOPT_COPY_STR(config->args, where, "-data_group", "data_group", "==");
     1375  PXOPT_COPY_STR(config->args, where, "-projection_cell", "projection_cell", "==");
     1376  PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "==");
     1377  PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");
     1378  if (!psListLength(where->list)) {
     1379    psFree(where);
     1380    psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
     1381    return false;
     1382  }
     1383
     1384  psMetadata *values = psMetadataAlloc();
     1385  PXOPT_COPY_STR(config->args, values, "-set_data_group", "data_group", "==");
     1386  if (!psListLength(values->list)) {
     1387    psFree(values);
     1388    psError(PXTOOLS_ERR_CONFIG, false, "data_group to assign not found");
     1389    return false;
     1390  }
     1391
     1392  if (!psDBTransaction(config->dbh)) {
     1393    psError(PS_ERR_UNKNOWN, false, "database error");
     1394    return false;
     1395  }
     1396 
     1397  long rows = psDBUpdateRows(config->dbh, "stackAssociation", where, values);
     1398  psFree(values);
     1399  psFree(where);
     1400
     1401  if (rows != 1) {
     1402    psError(PS_ERR_UNKNOWN, false, "should have updated only one row. updated %ld", rows);
     1403    return false;
     1404  }
     1405
     1406  if (!psDBCommit(config->dbh)) {
     1407    psError(PS_ERR_UNKNOWN, false, "database error");
     1408    return false;
     1409  }
     1410
     1411  return true;
     1412}
    13711413
    13721414static bool revertsumskyfileMode(pxConfig *config)
Note: See TracChangeset for help on using the changeset viewer.