IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28411


Ignore:
Timestamp:
Jun 18, 2010, 4:04:27 PM (16 years ago)
Author:
Paul Price
Message:

Adding diffphot to publish.

Location:
trunk/ippTools
Files:
3 edited

Legend:

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

    r28372 r28411  
    3838        AND (camRun.magicked != 0 OR publishClient.magicked = 0)
    3939    -- WHERE hook %s
     40    UNION
     41    -- Get diffphots to publish
     42    SELECT DISTINCT
     43        client_id,
     44        diff_phot_id AS stage_id,
     45        diffPhotRun.label AS src_label
     46    FROM publishClient
     47    JOIN diffPhotRun
     48    JOIN diffRun USING(diff_id)
     49    JOIN diffInputSkyfile USING(diff_id)
     50    JOIN warpRun ON warpRun.warp_id = diffInputSkyfile.warp1 -- Only JOINing input, not reference!
     51    JOIN fakeRun USING(fake_id)
     52    JOIN camRun USING(cam_id)
     53    JOIN chipRun USING(chip_id)
     54    JOIN rawExp USING(exp_id)
     55    WHERE publishClient.stage = 'diffphot'
     56        AND publishClient.active = 1
     57        AND diffPhotRun.state IN ('full', 'cleaned', 'goto_cleaned')
     58        AND (diffRun.diff_mode = 4 OR publishClient.magicked = 0) -- diffPhotRun doesn't respect magic
     59    -- WHERE hook %s
    4060    ) AS publishToDo
    4161-- Only get stuff that hasn't been published
  • trunk/ippTools/share/pubtool_pending.sql

    r28373 r28411  
    5050        AND (camRun.magicked != 0 OR publishClient.magicked = 0)
    5151        -- WHERE hook %s
     52    SELECT DISTINCT
     53        publishRun.pub_id,
     54        publishClient.product,
     55        publishClient.stage,
     56        publishClient.workdir,
     57        diffPhotRun.diff_phot_id AS stage_id,
     58        rawExp.camera,
     59        rawExp.exp_id
     60    FROM publishRun
     61    JOIN publishClient USING(client_id)
     62    JOIN diffPhotRun
     63        ON diffPhotRun.diff_phot_id = publishRun.stage_id
     64    JOIN diffRun USING(diff_id)
     65    JOIN diffInputSkyfile USING(diff_id)
     66    -- Need to do something fancy here to get the camera name for a stack
     67    LEFT JOIN warpRun ON warpRun.warp_id = diffInputSkyfile.warp1
     68    JOIN fakeRun USING(fake_id)
     69    JOIN camRun USING(cam_id)
     70    JOIN chipRun USING(chip_id)
     71    JOIN rawExp USING(exp_id)
     72    WHERE publishClient.stage = 'diffphot'
     73        AND publishClient.active = 1
     74        AND publishRun.state = 'new'
     75        AND diffPhotRun.state IN ('full', 'cleaned', 'goto_cleaned')
     76        AND (diffRun.diff_mode = 4 OR publishClient.magicked = 0) -- diffPhotRun doesn't respect magic
     77        -- WHERE hook %s
    5278) AS publishToDo
    5379LEFT JOIN publishDone USING(pub_id)
  • trunk/ippTools/src/pubtool.c

    r28373 r28411  
    153153    psMetadata *diffWhere = psMetadataAlloc(); // WHERE conditions for diffs
    154154    psMetadata *camWhere = psMetadataAlloc(); // WHERE conditions for cams
     155    psMetadata *diffphotWhere = psMetadataAlloc(); // WHERE conditions for diffphots
    155156
    156157    // required
     
    173174    PXOPT_COPY_STR(config->args, camWhere, "-obs_mode", "rawExp.obs_mode", "LIKE");
    174175
     176    PXOPT_COPY_S64(config->args, diffphotWhere, "-client_id", "client_id", "==");
     177    pxAddLabelSearchArgs(config, diffphotWhere, "-label", "diffphotRun.label", "==");
     178    pxAddLabelSearchArgs(config, diffphotWhere, "-data_group", "diffphotRun.data_group", "LIKE");
     179    PXOPT_COPY_TIME(config->args, diffphotWhere, "-dateobs_begin", "rawExp.dateobs", ">=");
     180    PXOPT_COPY_TIME(config->args, diffphotWhere, "-dateobs_end", "rawExp.dateobs", "<=");
     181    PXOPT_COPY_STR(config->args, diffphotWhere, "-filter", "rawExp.filter", "LIKE");
     182    PXOPT_COPY_STR(config->args, diffphotWhere, "-obs_mode", "rawExp.obs_mode", "LIKE");
     183
    175184    PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);
    176185    PXOPT_LOOKUP_BOOL(rerun, config->args, "-rerun", false);
     
    201210        psFree(diffWhere);
    202211        psFree(camWhere);
     212        psFree(diffphotWhere);
    203213        return false;
    204214    }
     
    220230    psFree(camWhere);
    221231
    222     if (!p_psDBRunQueryF(config->dbh, query, whereDiff, whereCam)) {
     232    psString whereDiffphot = psStringCopy(""); // Additional constraints to add to query
     233    if (psListLength(diffphotWhere->list)) {
     234        psString clause = psDBGenerateWhereConditionSQL(diffphotWhere, NULL);
     235        psStringAppend(&whereDiffphot, "\n AND %s", clause);
     236        psFree(clause);
     237    }
     238    psFree(diffphotWhere);
     239
     240    if (!p_psDBRunQueryF(config->dbh, query, whereDiff, whereCam, whereDiffphot)) {
    223241        psError(PS_ERR_UNKNOWN, false, "Database error");
    224242        psFree(query);
    225243        psFree(whereDiff);
    226244        psFree(whereCam);
     245        psFree(whereDiffphot);
    227246        if (!psDBRollback(config->dbh)) {
    228247            psError(PS_ERR_UNKNOWN, false, "Database error");
     
    233252    psFree(whereDiff);
    234253    psFree(whereCam);
     254    psFree(whereDiffphot);
    235255
    236256    psArray *output = p_psDBFetchResult(config->dbh); // Output of SELECT statement
Note: See TracChangeset for help on using the changeset viewer.