IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26039


Ignore:
Timestamp:
Nov 4, 2009, 7:14:15 PM (17 years ago)
Author:
bills
Message:

in -definebyquery -rerun don't queue if a run with the given label exists
(previous change didn't work)

Location:
trunk/ippTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/share/magictool_definebyquery_select.sql

    r26033 r26039  
    11-- Get a list of exposures on which magic may be performed
    22SELECT DISTINCT
    3     exp_id,
     3    chipRun.exp_id,
    44    MAX(diffWarps.diff_id) AS diff_id,
    55    -- The following trick pulls out the 'inverse' value for the maximum diff_id
     
    3333JOIN camRun USING(cam_id)
    3434JOIN chipRun USING(chip_id)
    35 LEFT JOIN magicRun USING(exp_id)
     35LEFT JOIN
     36    (SELECT magic_id, exp_id, label
     37        FROM magicRun
     38        -- rerun hook %s
     39    ) AS oldMagicRun
     40    ON oldMagicRun.exp_id = chipRun.exp_id
    3641-- WHERE hook %s
    37 GROUP BY exp_id
     42GROUP BY chipRun.exp_id
  • trunk/ippTools/src/magictool.c

    r26034 r26039  
    151151        // what if no skycells for the diff run completed?
    152152
    153         psStringAppend(&queryWhereStr, "\n%s (magic_id IS NULL", queryWhereStr ? "AND" : "WHERE");
     153        psStringAppend(&queryWhereStr, "\n%s magic_id IS NULL", queryWhereStr ? "AND" : "WHERE");
     154        psString rerunWhereStr = NULL;
    154155        if (rerun) {
    155             psStringAppend(&queryWhereStr, " OR (magicRun.label != '%s')", label);
    156         }
    157         psStringAppend(&queryWhereStr, ") ");
     156            psStringAppend(&rerunWhereStr, "\n WHERE magicRun.label = '%s'", label);
     157        }
    158158
    159159        // now add the user specified qualifiers
     
    178178            queryWhereStr = psStringCopy("");
    179179        }
    180 
    181         if (!p_psDBRunQueryF(config->dbh, query, diffWhereStr, diffWhereStr, queryWhereStr)) {
     180        if (!rerunWhereStr) {
     181            rerunWhereStr = psStringCopy("");
     182        }
     183
     184        if (!p_psDBRunQueryF(config->dbh, query, diffWhereStr, diffWhereStr, rerunWhereStr, queryWhereStr)) {
    182185            psError(PS_ERR_UNKNOWN, false, "database error");
    183186            psFree(diffWhereStr);
    184187            psFree(queryWhereStr);
     188            psFree(rerunWhereStr);
    185189            psFree(query);
    186190            return false;
     
    188192        psFree(diffWhereStr);
    189193        psFree(queryWhereStr);
     194        psFree(rerunWhereStr);
    190195        psFree(query);
    191196    }
Note: See TracChangeset for help on using the changeset viewer.