IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32609 for trunk/ippTools/src


Ignore:
Timestamp:
Nov 3, 2011, 2:50:40 PM (15 years ago)
Author:
bills
Message:

Change PRIMARY KEY for diffInputSkyfile from (diff_id, skycell_id) to diff_skyfile_id.
This allows skycell_id to be NULL which we use in diftool -definewarpwarp to handle
the case where a pair of warps gets selected when there are actually no overlapping skycells.
We insert a diffInputSkyfile with the two warp_ids and skycell_id NULL. Then we set the
run to 'full'.
Change pubtool -definerun to not attempt to queue publishRuns for diffs in this state and
also fix the bug where publishRuns get queued even if all skycells for a diff have bad
quality

File:
1 edited

Legend:

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

    r32482 r32609  
    19361936            return false;
    19371937        }
     1938        psS64 numSkycells = psDBAffectedRows(config->dbh);
     1939        if (numSkycells > 0) {
     1940            if (!setdiffRunState(config, run->diff_id, "new", false)) {
     1941                psError(PS_ERR_UNKNOWN, false, "Failed to change diffRun.state for diff_id: %" PRId64,
     1942                        run->diff_id);
     1943                psFree(input);
     1944                psFree(diff);
     1945                psFree(run);
     1946                psFree(list);
     1947                psFree(insert);
     1948                psFree(results);
     1949                if (!psDBRollback(config->dbh)) {
     1950                    psError(PS_ERR_UNKNOWN, false, "database error");
     1951                }
     1952                return false;
     1953            }
     1954            run->state = psStringCopy("new");
     1955        } else {
     1956            // No overlap between the warps. Insert a dummy skycell which will complete this pair of warps
     1957            // XXX: we'd like to use diffInputSkyfileRowAlloc and diffInputSkyfileInsert but there doesn't
     1958            // seem to be a way to pass in NULL for skycell_id, stack1 and stack2
     1959            psString dummyQuery = NULL;
     1960            psStringAppend(&dummyQuery,
     1961              "INSERT INTO diffInputSkyfile VALUES(%" PRId64 ", NULL, %s, NULL, %s, NULL, '%s', 0)",
     1962                    run->diff_id,
     1963                    input,                      // warp1
     1964                    template,                   // warp2
     1965                    tess_id);
     1966            if (!p_psDBRunQuery(config->dbh, dummyQuery)) {
     1967                psError(PS_ERR_UNKNOWN, false, "database error");
     1968                psFree(dummyQuery);
     1969                psFree(input);
     1970                psFree(diff);
     1971                psFree(run);
     1972                psFree(list);
     1973                psFree(insert);
     1974                psFree(results);
     1975                if (!psDBRollback(config->dbh)) {
     1976                    psError(PS_ERR_UNKNOWN, false, "database error");
     1977                }
     1978                return false;
     1979            }
     1980            psFree(dummyQuery);
     1981            psString finishQuery = NULL;
     1982            psStringAppend( &finishQuery,
     1983                "UPDATE diffRun set state ='full', note = 'dummy run - no overlap' WHERE diff_id = %" PRId64,
     1984                run->diff_id);
     1985            if (!p_psDBRunQuery(config->dbh, finishQuery)) {
     1986                psError(PS_ERR_UNKNOWN, false, "database error");
     1987                psFree(finishQuery);
     1988                psFree(input);
     1989                psFree(diff);
     1990                psFree(run);
     1991                psFree(list);
     1992                psFree(insert);
     1993                psFree(results);
     1994                if (!psDBRollback(config->dbh)) {
     1995                    psError(PS_ERR_UNKNOWN, false, "database error");
     1996                }
     1997                return false;
     1998            }
     1999            psFree(finishQuery);
     2000            run->state = psStringCopy("full");
     2001        }
    19382002        psFree(input);
    19392003        psFree(diff);
    1940 
    1941         if (!setdiffRunState(config, run->diff_id, "new", false)) {
    1942             psError(PS_ERR_UNKNOWN, false, "Failed to change diffRun.state for diff_id: %" PRId64,
    1943                     run->diff_id);
    1944             psFree(run);
    1945             psFree(list);
    1946             psFree(insert);
    1947             psFree(results);
    1948             if (!psDBRollback(config->dbh)) {
    1949                 psError(PS_ERR_UNKNOWN, false, "database error");
    1950             }
    1951             return false;
    1952         }
    19532004
    19542005        psArrayAdd(list, list->n, run);
Note: See TracChangeset for help on using the changeset viewer.