IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28082


Ignore:
Timestamp:
May 24, 2010, 7:18:05 PM (16 years ago)
Author:
bills
Message:

order pending files by priority. Works but needs optimization.

Location:
trunk/ippTools
Files:
2 edited

Legend:

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

    r27926 r28082  
    1212    workdir,
    1313    magicked,
    14     path_base
     14    path_base,
     15    priority
    1516FROM (
    16     SELECT DISTINCT
     17    (SELECT DISTINCT
    1718        warpSkyCellMap.warp_id,
    1819        warpImfile.warp_skyfile_id,
     
    2728        warpRun.workdir,
    2829        chipRun.magicked,
    29         CAST(NULL AS CHAR(255)) AS path_base
     30        CAST(NULL AS CHAR(255)) AS path_base,
     31        IFNULL(Label.priority, 10000) AS priority
    3032    FROM warpRun
    3133    JOIN warpSkyCellMap
     
    5052    LEFT JOIN warpMask
    5153        ON warpRun.label = warpMask.label
     54    LEFT JOIN Label ON warpRun.label = Label.label
    5255    WHERE
    5356        warpRun.state = 'new'
     
    6063        AND warpMask.label IS NULL
    6164        AND warpSkyCellMap.fault = 0
     65        AND (Label.active OR Label.active IS NULL)
    6266        -- where hook 1 %s
    6367        -- limit hook 1 %s
     68    )
    6469UNION
    65     SELECT
     70    (SELECT
    6671        warpSkyCellMap.warp_id,
    6772        warpImfile.warp_skyfile_id,
     
    7681        warpRun.workdir,
    7782        MIN(chipProcessedImfile.magicked) AS magicked,
    78         warpSkyfile.path_base
     83        warpSkyfile.path_base,
     84        IFNULL(Label.priority, 10000) AS priority
    7985    FROM warpRun
    8086    JOIN warpImfile USING(warp_id)
     
    8692    JOIN rawExp USING(exp_id)
    8793    LEFT JOIN chipProcessedImfile USING(chip_id, class_id)
     94    LEFT JOIN Label ON warpRun.label = Label.label
    8895    WHERE warpRun.state = 'update'
    8996        AND warpSkyfile.data_state = 'update'
     
    94101        -- this blocks processing until all the chip inputs have been destreaked
    95102        AND (warpSkyfile.magicked = 0 OR chipProcessedImfile.magicked >= 0)
     103        AND (Label.active OR Label.active IS NULL)
    96104        -- where hook 2 %s
    97105    GROUP BY warp_id, skycell_id
    98106    HAVING COUNT(warpSkyCellMap.class_id) = COUNT(chipProcessedImfile.class_id)
    99107    -- limit hook 2 %s
     108    )
    100109) as towarped
    101 
  • trunk/ippTools/src/warptool.c

    r28056 r28082  
    940940
    941941    // treat limit == 0 as "no limit"
    942     psString limitString = psStringCopy("\n");
     942    psString limitString = psStringCopy("\nORDER BY priority DESC, warp_id");
    943943    if (limit) {
    944         // We apply the limit to both sides of the UNION
    945         // to avoid slow queries and to the query itself
    946         // to satisfy the user's requested limit
     944        // We apply the limit to both sides of the UNION to avoid slow queries
     945        // and to the query itself to satisfy the user's requested limit
    947946        psStringAppend(&limitString, "%s", psDBGenerateLimitSQL(limit));
    948947        psStringAppend(&query, " %s", limitString);
    949948    }
    950949
    951 #define TWO_WHERES
    952 #ifdef TWO_WHERES
    953950    if (!p_psDBRunQueryF(config->dbh, query, whereStr, limitString, whereStr,  limitString)) {
    954951        psError(PS_ERR_UNKNOWN, false, "database error");
     
    956953        return false;
    957954    }
    958 #else
    959     if (!p_psDBRunQueryF(config->dbh, query, whereStr)) {
    960         psError(PS_ERR_UNKNOWN, false, "database error");
    961         psFree(query);
    962         return false;
    963     }
    964 #endif
    965955    psFree(limitString);
    966956    psFree(whereStr);
Note: See TracChangeset for help on using the changeset viewer.