IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 6, 2011, 2:34:55 PM (15 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/eam_branches/ipp-20110213/ippTools
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/ippTools/share/camtool_find_pendingimfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_todestreak_raw.sql

    r29561 r30812  
    2424    re_place,
    2525    remove,
    26     10000 AS priority
     26    IFNULL(Label.priority, 10000) AS priority
    2727FROM magicDSRun
    2828JOIN magicMask USING (magic_id)
     
    3535    ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id
    3636    AND magicDSFile.component = rawImfile.class_id
     37LEFT JOIN Label ON magicDSRun.label = Label.label
    3738WHERE
    3839    magicDSRun.state = 'new'
    3940    AND magicDSRun.stage = 'raw'
    4041    AND magicDSFile.component IS NULL
     42    AND (Label.active OR Label.active IS NULL)
     43
  • branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_diff.sql

    r30675 r30812  
    1313    magicDSFile.recovery_path_base,
    1414    "NULL" AS cam_path_base,
    15     recovery_path_base,
    1615    CAST(diffRun.bothways AS SIGNED) AS bothways,
    1716    0 AS bytes,
  • branches/eam_branches/ipp-20110213/ippTools/share/pxadmin_create_tables.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20110213/ippTools/src

  • branches/eam_branches/ipp-20110213/ippTools/src/addtool.c

    r29423 r30812  
    324324    // pxUpdateRun gets parameters from config->args and runs the update query
    325325    bool result = pxUpdateRun(config, where, &query, "addRun", "add_id",
    326         "addProcessedExp", false);
     326        "addProcessedExp", false, false);
    327327
    328328    psFree(query);
  • branches/eam_branches/ipp-20110213/ippTools/src/bgtool.c

    r29671 r30812  
    501501    psString query = psStringCopy("UPDATE chipBackgroundRun");
    502502    bool result = pxUpdateRun(config, where, &query, "chipBackgroundRun", "chip_bg_id",
    503                               "chipBackgroundImfile", true);
     503                              "chipBackgroundImfile", true, true);
    504504
    505505    psFree(query);
     
    14711471    psString query = psStringCopy("UPDATE warpBackgroundRun");
    14721472    bool result = pxUpdateRun(config, where, &query, "warpBackgroundRun", "warp_bg_id",
    1473                               "warpBackgroundSkyfile", true);
     1473                              "warpBackgroundSkyfile", true, true);
    14741474
    14751475    psFree(query);
  • branches/eam_branches/ipp-20110213/ippTools/src/camtool.c

    r29902 r30812  
    283283
    284284    // pxUpdateRun gets parameters from config->args and updates
    285     bool result = pxUpdateRun(config, where, &query, "camRun", "cam_id", "camProcessedExp", true);
     285    bool result = pxUpdateRun(config, where, &query, "camRun", "cam_id", "camProcessedExp", true, true);
    286286    if (!result) {
    287287        psError(psErrorCodeLast(), false, "pxUpdateRun failed");
  • branches/eam_branches/ipp-20110213/ippTools/src/camtoolConfig.c

    r29902 r30812  
    8686    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dist_group", 0,   "define new dist_group", NULL);
    8787    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0,         "define new note", NULL);
     88    pxmagicAddArguments(updaterunArgs);
    8889
    8990    // -pendingexp
     
    299300    PXOPT_ADD_MODE("-addprocessedexp",      "add a processed exposure",             CAMTOOL_MODE_ADDPROCESSEDEXP, addprocessedexpArgs);
    300301    PXOPT_ADD_MODE("-processedexp",         "show processed exposures",             CAMTOOL_MODE_PROCESSEDEXP,  processedexpArgs);
    301     PXOPT_ADD_MODE("-revertprocessedexp",   "change procesed exp properties",       CAMTOOL_MODE_REVERTPROCESSEDEXP,  revertprocessedexpArgs);
    302     PXOPT_ADD_MODE("-updateprocessedexp",   "undo a processed exposure",            CAMTOOL_MODE_UPDATEPROCESSEDEXP,updateprocessedexpArgs);
     302    PXOPT_ADD_MODE("-revertprocessedexp",   "undo a processed exposure",       CAMTOOL_MODE_REVERTPROCESSEDEXP,  revertprocessedexpArgs);
     303    PXOPT_ADD_MODE("-updateprocessedexp",   "changed processed exp properties",            CAMTOOL_MODE_UPDATEPROCESSEDEXP,updateprocessedexpArgs);
    303304    PXOPT_ADD_MODE("-block",                "set a label block",                    CAMTOOL_MODE_BLOCK,         blockArgs);
    304305    PXOPT_ADD_MODE("-masked",               "show blocked labels",                  CAMTOOL_MODE_MASKED,        maskedArgs);
  • branches/eam_branches/ipp-20110213/ippTools/src/chiptool.c

    r30544 r30812  
    443443
    444444    // pxUpdateRun gets parameters from config->args and updates
    445     bool result = pxUpdateRun(config, where, &query, "chipRun", "chip_id", "chipProcessedImfile", true);
     445    bool result = pxUpdateRun(config, where, &query, "chipRun", "chip_id", "chipProcessedImfile", true, true);
    446446    if (!result) {
    447447        psError(psErrorCodeLast(), false, "pxUpdateRun failed");
  • branches/eam_branches/ipp-20110213/ippTools/src/chiptoolConfig.c

    r30049 r30812  
    9999    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dist_group", 0,   "set dist group", NULL);
    100100    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0,         "set note", NULL);
     101    pxmagicAddArguments(updaterunArgs);
    101102
    102103    // -setimfiletoupdate
  • branches/eam_branches/ipp-20110213/ippTools/src/diffphottool.c

    r28488 r30812  
    228228
    229229    // pxUpdateRun gets parameters from config->args and updates
    230     bool result = pxUpdateRun(config, where, &query, "diffPhotRun", "diff_phot_id", "diffPhotSkyfile", true);
     230    bool result = pxUpdateRun(config, where, &query, "diffPhotRun", "diff_phot_id", "diffPhotSkyfile", true, false);
    231231
    232232    psFree(query);
  • branches/eam_branches/ipp-20110213/ippTools/src/difftool.c

    r30594 r30812  
    224224
    225225    // pxUpdateRun gets parameters from config->args and updates
    226     bool result = pxUpdateRun(config, where, &query, "diffRun", "diff_id", "diffSkyfile", true);
     226    bool result = pxUpdateRun(config, where, &query, "diffRun", "diff_id", "diffSkyfile", true, true);
    227227
    228228    psFree(query);
  • branches/eam_branches/ipp-20110213/ippTools/src/difftoolConfig.c

    r30070 r30812  
    7373    psMetadataAddS16(updaterunArgs, PS_LIST_TAIL, "-set_diff_mode", 0,    "specify type of difference (WW=1,WS=2,SW=3,SS=4)", 0);
    7474    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0,         "define new note", NULL);
     75    pxmagicAddArguments(updaterunArgs);
    7576
    7677    // -addinputskyfile
  • branches/eam_branches/ipp-20110213/ippTools/src/faketool.c

    r27391 r30812  
    348348
    349349    // pxUpdateRun gets parameters from config->args and updates
    350     bool result = pxUpdateRun(config, where, &query, "fakeRun", "fake_id", "fakeProcessedImfile", true);
     350    bool result = pxUpdateRun(config, where, &query, "fakeRun", "fake_id", "fakeProcessedImfile", true, false);
    351351    if (!result) {
    352352        psError(psErrorCodeLast(), false, "pxUpdateRun failed");
  • branches/eam_branches/ipp-20110213/ippTools/src/magicdstool.c

    r30700 r30812  
    13951395          (strcmp(state, "full") == 0) ||
    13961396          (strcmp(state, "drop") == 0) ||
     1397          (strcmp(state, "wait") == 0) ||
    13971398          (strcmp(state, "failed_revert") == 0) ||
    13981399          (strcmp(state, "error_cleaned") == 0) ||
  • branches/eam_branches/ipp-20110213/ippTools/src/magictool.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20110213/ippTools/src/pubtool.c

    r30376 r30812  
    3737static bool addMode(pxConfig *config);
    3838static bool revertMode(pxConfig *config);
     39static bool updaterunMode(pxConfig *config);
    3940
    4041# define MODECASE(caseName, func) \
     
    6364        MODECASE(PUBTOOL_MODE_ADD, addMode);
    6465        MODECASE(PUBTOOL_MODE_REVERT, revertMode);
     66        MODECASE(PUBTOOL_MODE_UPDATERUN, updaterunMode);
    6567      default:
    6668        psAbort("invalid option (this should not happen)");
     
    459461}
    460462
     463static bool updaterunMode(pxConfig *config)
     464{
     465    PS_ASSERT_PTR_NON_NULL(config, false);
     466
     467    psMetadata *where = psMetadataAlloc(); // WHERE conditions
     468    PXOPT_COPY_S64(config->args, where, "-pub_id", "pub_id", "==");
     469    PXOPT_COPY_S64(config->args, where, "-client_id", "client_id", "==");
     470    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
     471    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     472    PXOPT_COPY_STR(config->args, where, "-fault", "fault", "==");
     473
     474    PXOPT_LOOKUP_STR(state, config->args, "-set_state",  true, false);
     475
     476    psString query = NULL;              // Query to run
     477    psStringAppend(&query, "UPDATE publishRun LEFT JOIN publishDone using(pub_id) SET state = '%s'", state);
     478
     479    if (psListLength(where->list)) {
     480        psString clause = psDBGenerateWhereConditionSQL(where, NULL);
     481        psStringAppend(&query, "\n WHERE %s", clause);
     482        psFree(clause);
     483    } else {
     484        psError(PS_ERR_UNKNOWN, false, "select arguments are required");
     485        return false;
     486    }
     487    psFree(where);
     488
     489    if (!p_psDBRunQuery(config->dbh, query)) {
     490        psError(PS_ERR_UNKNOWN, false, "Database error");
     491        psFree(query);
     492        return false;
     493    }
     494    psFree(query);
     495
     496    long numUpdated = psDBAffectedRows(config->dbh);
     497    psLogMsg("pubtool", PS_LOG_INFO, "%ld rows updated.", numUpdated);
     498
     499    return true;
     500}
  • branches/eam_branches/ipp-20110213/ippTools/src/pubtool.h

    r25929 r30812  
    3131    PUBTOOL_MODE_ADD,
    3232    PUBTOOL_MODE_REVERT,
     33    PUBTOOL_MODE_UPDATERUN,
    3334} pubtoolMode;
    3435
  • branches/eam_branches/ipp-20110213/ippTools/src/pubtoolConfig.c

    r30376 r30812  
    102102    psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search on label", NULL);
    103103
     104    // -updaterun
     105    psMetadata *updaterunArgs = psMetadataAlloc();
     106    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state", 0, "new value for state (required)", NULL);
     107    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL);
     108    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-pub_id", 0, "search on pub_id", 0);
     109    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-client_id", 0, "search on client_id", 0);
     110    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL);
     111    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-fault", 0, "search by fault", NULL);
     112
    104113
    105114    psMetadata *argSets = psMetadataAlloc();
     
    112121    PXOPT_ADD_MODE("-add", "", PUBTOOL_MODE_ADD, addArgs);
    113122    PXOPT_ADD_MODE("-revert", "", PUBTOOL_MODE_REVERT, revertArgs);
     123    PXOPT_ADD_MODE("-updaterun", "", PUBTOOL_MODE_UPDATERUN, updaterunArgs);
    114124
    115125    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
  • branches/eam_branches/ipp-20110213/ippTools/src/pxtools.c

    r28486 r30812  
    278278
    279279// shared code for updating the various strings for a Run
    280 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group)
     280bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group, bool has_magicked)
    281281{
    282282    PS_ASSERT_PTR_NON_NULL(config, false);
     
    360360    if (fileWhere) {
    361361        psStringAppend(pQuery, "%s", fileWhere);
     362    }
     363    if (has_magicked) {
     364        pxmagicAddWhere(config, pQuery, runTable);
    362365    }
    363366
  • branches/eam_branches/ipp-20110213/ippTools/src/pxtools.h

    r30544 r30812  
    8484bool pxGetOptions(FILE *stream, int argc, char **argv, pxConfig *config, psMetadata *modes, psMetadata *argSets);
    8585
    86 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group);
     86bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group, bool has_magicked);
    8787
    8888#define PXOPT_ADD_MODE(option, comment, modeval, argset) \
  • branches/eam_branches/ipp-20110213/ippTools/src/stacktool.c

    r30429 r30812  
    750750
    751751    // pxUpdateRun gets parameters from config->args and updates
    752     bool result = pxUpdateRun(config, where, &query, "stackRun", "stack_id", "stackSumSkyfile", true);
     752    bool result = pxUpdateRun(config, where, &query, "stackRun", "stack_id", "stackSumSkyfile", true, false);
    753753
    754754    psFree(query);
  • branches/eam_branches/ipp-20110213/ippTools/src/staticskytool.c

    r29066 r30812  
    360360
    361361    // pxUpdateRun gets parameters from config->args and updates
    362     bool result = pxUpdateRun(config, where, &query, "staticskyRun", "sky_id", "staticskyResult", true);
     362    bool result = pxUpdateRun(config, where, &query, "staticskyRun", "sky_id", "staticskyResult", true, false);
    363363    psFree(query);
    364364    psFree(where);
  • branches/eam_branches/ipp-20110213/ippTools/src/warptool.c

    r30556 r30812  
    435435
    436436    // pxUpdateRun gets parameters from config->args and updates
    437     bool result = pxUpdateRun(config, where, &query, "warpRun", "warp_id", "warpSkyfile", true);
     437    bool result = pxUpdateRun(config, where, &query, "warpRun", "warp_id", "warpSkyfile", true, true);
    438438
    439439    psFree(query);
  • branches/eam_branches/ipp-20110213/ippTools/src/warptoolConfig.c

    r29416 r30812  
    141141    psMetadataAddTime(updaterunArgs, PS_LIST_TAIL, "-registered_begin", 0, "search for runs by registration time (>=)", NULL);
    142142    psMetadataAddTime(updaterunArgs, PS_LIST_TAIL, "-registered_end", 0, "search for runs by registration time (<)", NULL);
    143     psMetadataAddBool(updaterunArgs, PS_LIST_TAIL, "-destreaked", 0, "search for runs that have been destreaked", false);
    144143    psMetadataAddBool(updaterunArgs, PS_LIST_TAIL, "-pretend", 0, "only pretend to run the query", false);
    145144
     
    149148    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dist_group", 0,   "define new dist_group", NULL);
    150149    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0,         "define new note", NULL);
     150    pxmagicAddArguments(updaterunArgs);
    151151
    152152    // -exp
Note: See TracChangeset for help on using the changeset viewer.