IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 8, 2011, 2:44:12 PM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20110906
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110906

  • branches/eam_branches/ipp-20110906/ippTools/src

  • branches/eam_branches/ipp-20110906/ippTools/src/difftool.c

    r32218 r32630  
    16341634    PXOPT_COPY_F32(config->args, selectWhere, "-timediff",
    16351635                   "ABS(TIME_TO_SEC(TIMEDIFF(inputRawExp.dateobs, templateRawExp.dateobs)))", "<=");
     1636    PXOPT_COPY_F32(config->args, selectWhere, "-mintimediff",
     1637                   "ABS(TIME_TO_SEC(TIMEDIFF(inputRawExp.dateobs, templateRawExp.dateobs)))", ">=");
    16361638
    16371639    // other where restrictions:
     
    18671869        const char *tess_id = psMetadataLookupStr(NULL, row, "tess_id");
    18681870        psString input_data_group = psMetadataLookupStr(NULL, row, "input_data_group");
    1869         if (input_data_group) {
     1871        if (!data_group) {
    18701872          data_group = input_data_group;
    18711873        }
     
    19341936            return false;
    19351937        }
     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        }
    19362002        psFree(input);
    19372003        psFree(diff);
    1938 
    1939         if (!setdiffRunState(config, run->diff_id, "new", false)) {
    1940             psError(PS_ERR_UNKNOWN, false, "Failed to change diffRun.state for diff_id: %" PRId64,
    1941                     run->diff_id);
    1942             psFree(run);
    1943             psFree(list);
    1944             psFree(insert);
    1945             psFree(results);
    1946             if (!psDBRollback(config->dbh)) {
    1947                 psError(PS_ERR_UNKNOWN, false, "database error");
    1948             }
    1949             return false;
    1950         }
    19512004
    19522005        psArrayAdd(list, list->n, run);
Note: See TracChangeset for help on using the changeset viewer.