IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35546


Ignore:
Timestamp:
May 9, 2013, 11:26:59 AM (13 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20130419
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130419/Nebulous

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippMonitor

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippTasks

  • branches/eam_branches/ipp-20130419/ippTasks/nightly_stacks.pro

    r33166 r35546  
    621621  periods         -poll $LOADPOLL
    622622  periods         -exec $LOADEXEC
    623   periods         -timeout 120
     623  periods         -timeout 900 # this task can be quite slow
    624624  npending        1
    625625
  • branches/eam_branches/ipp-20130419/ippTasks/pstamp.pro

    r33810 r35546  
    965965
    966966        # XXX: have the script set this up this
    967         $MYLOGFILE=/data/ippdb02.0/pstamp/work/logs/cleanup.$REQ_ID
     967        $MYLOGFILE=/data/ippc17.0/pstamp/work/logs/cleanup.$REQ_ID
    968968        stdout $MYLOGFILE
    969969        stderr $MYLOGFILE
  • branches/eam_branches/ipp-20130419/ippTasks/survey.pro

    r35360 r35546  
    2020 book create SURVEY_LAPGROUP
    2121 book create SURVEY_RELEXP
     22 book create SURVEY_RELSTACK
    2223 $haveSurveyBooks = TRUE
    2324end
     
    3738$SURVEY_LAPGROUP_DB = 0
    3839$SURVEY_RELEXP_DB = 0
     40$SURVEY_RELSTACK_DB = 0
    3941$SURVEY_STATICSKYSINGLE_DB = 0
    4042$SURVEY_EXEC = 120
    4143$SURVEY_POLL = 10
    4244$SURVEY_TIMEOUT = 600
     45# the tasks for loading the release tabels for nightly science do not need to run very often
     46$SURVEY_RELEASE_EXEC 300
    4347
    4448macro survey.on
     
    8892    active true
    8993  end
     94  task survey.relstack
     95    active true
     96  end
    9097end
    9198
     
    134141  end
    135142  task survey.relexp
     143    active false
     144  end
     145  task survey.relstack
    136146    active false
    137147  end
     
    568578  end
    569579  book listbook SURVEY_RELEXP
     580end
     581
     582macro survey.add.relstack
     583  if ($0 != 3)
     584    echo "USAGE: survey.add.relstack (label) (releasename)"
     585    break
     586  end
     587  book newpage SURVEY_RELSTACK $1
     588  book setword SURVEY_RELSTACK $1 LABEL $1
     589  book setword SURVEY_RELSTACK $1 RELEASE_NAME $2
     590  book setword SURVEY_RELSTACK $1 STATE PENDING
     591end
     592
     593macro survey.del.relstack
     594  if ($0 != 2)
     595    echo "USAGE: survey.del.relstack (label)"
     596    break
     597  end
     598  book delpage SURVEY_RELSTACK $1
     599end
     600
     601macro survey.show.relstack
     602  if ($0 != 1)
     603    echo "USAGE: survey.show.relstack"
     604    break
     605  end
     606  book listbook SURVEY_RELSTACK
    570607end
    571608
     
    17061743 
    17071744  periods      -poll $SURVEY_POLL
    1708   periods      -exec $SURVEY_EXEC
     1745  periods      -exec $SURVEY_RELEASE_EXEC
    17091746  periods      -timeout $SURVEY_TIMEOUT
    17101747  npending     1
     
    17701807  end
    17711808end
     1809
     1810task survey.relstack
     1811  host local
     1812 
     1813  periods      -poll $SURVEY_POLL
     1814  periods      -exec $SURVEY_RELEASE_EXEC
     1815  periods      -timeout $SURVEY_TIMEOUT
     1816  npending     1
     1817
     1818  stdout $LOGDIR/survey.relstack.log
     1819  stderr $LOGDIR/survey.relstack.log
     1820
     1821  task.exec
     1822    book npages SURVEY_RELSTACK -var N
     1823    if ($N == 0)
     1824#      echo "No labels for processing"
     1825      break
     1826    endif
     1827
     1828    book getpage SURVEY_RELSTACK 0 -var label -key STATE NEW
     1829    if ("$label" == "NULL")
     1830      # All labels have been done --- reset
     1831#      echo "Resetting labels"
     1832      for i 0 $N
     1833        book getpage SURVEY_RELSTACK $i -var label
     1834        book setword SURVEY_RELSTACK $label STATE NEW
     1835      end
     1836      book getpage SURVEY_RELSTACK 0 -var label -key STATE NEW
     1837
     1838      # Select different database
     1839      $SURVEY_RELSTACK_DB ++
     1840      if ($SURVEY_RELSTACK_DB >= $DB:n) set SURVEY_RELSTACK_DB = 0
     1841    end
     1842
     1843    book setword SURVEY_RELSTACK $label STATE DONE
     1844    book getword SURVEY_RELSTACK $label RELEASE_NAME -var RELEASE_NAME
     1845
     1846    # XXX: Can we use the survey task for stack types other than nightly?
     1847    $run = releasetool -definerelstack -label $label -release_name $RELEASE_NAME -set_state processed -set_stack_type nightly
     1848
     1849    if ($DB:n == 0)
     1850      option DEFAULT
     1851    else
     1852      $run = $run -dbname $DB:$SURVEY_RELSTACK_DB
     1853      option $DB:$SURVEY_RELSTACK_DB
     1854    end
     1855   
     1856     echo $run
     1857    command $run
     1858  end
     1859
     1860  # success
     1861  task.exit    0
     1862#    echo "Success"
     1863  end
     1864
     1865  # locked list
     1866  task.exit    default
     1867    showcommand failure
     1868  end
     1869
     1870  task.exit    crash
     1871    showcommand crash
     1872  end
     1873
     1874  # operation times out?
     1875  task.exit    timeout
     1876    showcommand timeout
     1877  end
     1878end
  • branches/eam_branches/ipp-20130419/ippTools/share

  • branches/eam_branches/ipp-20130419/ippTools/share/camtool_find_pendingimfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippTools/share/chiptool_pendingcleanupimfile.sql

    r33171 r35546  
    1313    USING(chip_id)
    1414WHERE
    15     ((chipRun.state = 'goto_cleaned' AND (chipProcessedImfile.data_state = 'full'
    16                                        OR chipProcessedImfile.data_state = 'update') AND chipProcessedImfile.quality = 0)
     15    ((chipRun.state = 'goto_cleaned'
     16        AND (chipProcessedImfile.data_state = 'full'
     17          OR chipProcessedImfile.data_state = 'update'
     18          OR chipProcessedImfile.data_state = 'error_cleaned')
     19        AND chipProcessedImfile.quality = 0)
    1720OR
    1821    (chipRun.state = 'goto_scrubbed' AND chipProcessedImfile.data_state != 'scrubbed')
  • branches/eam_branches/ipp-20130419/ippTools/share/chiptool_setimfiletoupdate.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippTools/share/pxadmin_create_tables.sql

    r35436 r35546  
    1 CREATE TABLE dbversion (
     1eREATE TABLE dbversion (
    22    schema_version VARCHAR(64),
    33    updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP
     
    21722172    priority    INT,
    21732173    PRIMARY KEY(rel_id),
     2174    UNIQUE KEY(surveyID, release_name),
    21742175    KEY(release_name),
    21752176    KEY(release_state),
     
    21962197    PRIMARY KEY (relexp_id),
    21972198    FOREIGN KEY(rel_id) REFERENCES ippRelease(rel_id),
     2199    UNIQUE KEY(rel_id, exp_id),
    21982200    KEY (state),
    21992201    KEY (fault),
     
    22242226    time_stamp  DATETIME,
    22252227    PRIMARY KEY (relstack_id),
     2228    UNIQUE KEY (rel_id, tess_id, skycell_id, filter, stack_type, mjd_obs),
    22262229    KEY (tess_id, skycell_id),
    2227     KEY (rel_id, tess_id, skycell_id, filter, mjd_obs),
    22282230    KEY (stack_type),
    22292231    KEY (mjd_obs),
  • branches/eam_branches/ipp-20130419/ippTools/share/releasetool_definerelstack.sql

    r35196 r35546  
    66    stackRun.tess_id,
    77    stackRun.filter,
    8     0 AS mjd_obs,
     8    stackSumSkyfile.mjd_obs,
    99    0 AS zpt_obs,
    1010    0 AS zpt_stdev
     
    1212FROM ippRelease
    1313JOIN stackRun
    14 LEFT JOIN relStack AS previousRelStack USING(rel_id, tess_id, skycell_id, filter)
    15 
     14JOIN stackSumSkyfile using(stack_id)
     15LEFT JOIN relStack AS previousRelStack
     16    ON previousRelStack.rel_id = ippRelease.rel_id
     17    AND previousRelStack.tess_id = stackRun.tess_id
     18    AND previousRelStack.skycell_id = stackRun.skycell_id
     19    AND previousRelStack.filter = stackRun.filter
     20    -- JOIN hook %s
    1621WHERE previousRelStack.relstack_id IS NULL
     22    AND stackRun.state ='full'
     23    AND stackSumSkyfile.quality = 0
     24    AND stackSumSkyfile.fault = 0
  • branches/eam_branches/ipp-20130419/ippTools/share/releasetool_definerelstack_with_skycal.sql

    r35196 r35546  
    1313JOIN stackRun
    1414JOIN stackSumSkyfile USING(stack_id)
    15 LEFT JOIN relStack AS previousRelStack USING(rel_id, tess_id, skycell_id, filter)
    1615JOIN skycalRun ON skycalRun.stack_id = stackRun.stack_id
    1716JOIN skycalResult ON skycalRun.skycal_id = skycalResult.skycal_id
     17-- LEFT JOIN relStack AS previousRelStack USING(rel_id, tess_id, skycell_id, filter)
     18LEFT JOIN relStack AS previousRelStack
     19    ON ippRelease.rel_id = previousRelStack.rel_id
     20    AND stackRun.tess_id = previousRelStack.tess_id
     21    AND stackRun.skycell_id = previousRelStack.skycell_id
     22    AND stackRun.filter = previousRelStack.filter
     23-- JOIN Hook %s
    1824
    1925WHERE previousRelStack.relstack_id IS NULL
     26    AND skycalRun.state = 'full'
  • branches/eam_branches/ipp-20130419/ippTools/share/releasetool_listrelstack.sql

    r35397 r35546  
    77    stackRun.state AS stack_state,
    88    stackRun.data_group AS stack_data_group,
     9    skycalResult.fwhm_major,
    910    skycalResult.path_base AS skycal_path_base,
    1011    skycalRun.data_group AS skycal_data_group,
  • branches/eam_branches/ipp-20130419/ippTools/share/warptool_pendingcleanupskyfile.sql

    r33171 r35546  
    1010    USING(warp_id)
    1111WHERE
    12    ((warpRun.state = 'goto_cleaned'  AND (warpSkyfile.data_state = 'full'
    13                                       OR  warpSkyfile.data_state = 'update')
    14     AND warpSkyfile.quality = 0)
     12   ((warpRun.state = 'goto_cleaned' 
     13       AND (warpSkyfile.data_state = 'full'
     14          OR  warpSkyfile.data_state = 'error_cleaned'
     15          OR  warpSkyfile.data_state = 'update')
     16       AND warpSkyfile.quality = 0)
    1517    OR
    1618    (warpRun.state = 'goto_scrubbed' AND warpSkyfile.data_state != 'scrubbed')
  • branches/eam_branches/ipp-20130419/ippTools/share/warptool_towarped.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippTools/src

  • branches/eam_branches/ipp-20130419/ippTools/src/camtool.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippTools/src/camtoolConfig.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippTools/src/magictool.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130419/ippTools/src/releasetool.c

    r35397 r35546  
    702702    PXOPT_COPY_STR(config->args, where, "-cam_data_group",  "camRun.data_group", "LIKE");
    703703    PXOPT_COPY_STR(config->args, where, "-warp_data_group", "warpRun.data_group", "LIKE");
     704    PXOPT_COPY_STR(config->args, where, "-tess_id",      "warpRun.tess_id", "==");
     705    PXOPT_COPY_STR(config->args, where, "-skycell_id",   "warpSkyfile.skycell_id", "==");
     706   
     707    PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", false, false);
    704708
    705709    PXOPT_COPY_STR(config->args, where, "-surveyName",  "survey.surveyName", "LIKE");
     
    715719        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
    716720        return false;
     721    }
     722
     723    if (skycell_id) {
     724        psStringAppend(&query, "\nJOIN warpSkyfile ON warpRun.warp_id = warpSkyfile.warp_id AND warpRun.tess_id = warpSkyfile.tess_id");
    717725    }
    718726
     
    741749
    742750    if (priority_order) {
    743         psStringAppend(&query, "\nAND priority > 0 order by exp_id, priority");
     751        psStringAppend(&query, "\nAND priority > 0 order by exp_id, priority DESC");
    744752    }
    745753
     
    787795    bool includeSkycal = false;
    788796
     797    PXOPT_COPY_STR(config->args, where, "-skycal_label", "skycalRun.label", "==");
     798    PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "LIKE");
    789799    PXOPT_COPY_S64(config->args, where, "-skycal_id",  "skycalRun.skycal_id", "==");
    790     PXOPT_COPY_STR(config->args, where, "-skycal_label", "skycalRun.label", "==");
    791     PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "==");
    792800    if (psListLength(where->list)) {
    793801        includeSkycal = true;
     
    795803
    796804    PXOPT_COPY_STR(config->args, where, "-label",      "stackRun.label", "==");
    797     PXOPT_COPY_STR(config->args, where, "-data_group", "stackRun.data_group", "==");
     805    PXOPT_COPY_STR(config->args, where, "-data_group", "stackRun.data_group", "LIKE");
    798806    PXOPT_COPY_S64(config->args, where, "-stack_id",   "stackRun.stack_id", "==");
    799807
     
    848856    }
    849857
     858    psString joinConditions = psStringCopy("");
     859    // Finish up the selectors for the JOIN to previousRelStack
     860    // join to rows with our stack_type
     861    psStringAppend(&joinConditions, "\nAND previousRelStack.stack_type = '%s'", stack_type);
     862
     863    if (!strcmp(stack_type, "nightly")) {
     864        // detect nightly stack entries that already exist for this day
     865        psStringAppend(&joinConditions, "\nAND previousRelStack.mjd_obs = floor(stackSumSkyfile.mjd_obs)");
     866    }
     867
     868    // Add in the where conditions
    850869    psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    851     psStringAppend(&query, " AND %s", whereClause);
     870    psStringAppend(&query, "\nAND %s", whereClause);
    852871    psFree(whereClause);
     872
     873    if (!strcmp(stack_type, "nightly")) {
     874        // avoid stacks with NAN mjd_obs. These are old skycells that were lost due to system failure
     875        // prior to the time that the mjd_obs was extracted from the headers and added to stackSumSkyfile
     876        psStringAppend(&query, "\nAND stackSumSkyfile.mjd_obs IS NOT NULL");
     877    }
    853878
    854879    psFree(where);
     
    860885    }
    861886
    862     if (!p_psDBRunQuery(config->dbh, query)) {
     887    if (!p_psDBRunQueryF(config->dbh, query, joinConditions)) {
    863888        psError(PS_ERR_UNKNOWN, false, "database error");
    864889        psFree(query);
     890        psFree(joinConditions);
    865891        return false;
    866892    }
    867893    psFree(query);
     894    psFree(joinConditions);
    868895
    869896    psArray *output = p_psDBFetchResult(config->dbh);
     
    9851012    PXOPT_COPY_F32(config->args, where, "-mjd_min",    "stackSumSkyfile.mjd_obs", ">=");
    9861013    PXOPT_COPY_F32(config->args, where, "-mjd_max",    "stackSumSkyfile.mjd_obs", "<=");
    987     PXOPT_COPY_F32(config->args, where, "-fwhm_min",    "skycalResult.fwhm_minor", ">=");
    988     PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "skycalresult.fwhm_major", "<=");
    9891014    PXOPT_COPY_STR(config->args, where, "-tess_id",     "relStack.tess_id", "==");
    9901015    PXOPT_COPY_STR(config->args, where, "-skycell_id",  "relStack.skycell_id", "LIKE");
     1016//    PXOPT_COPY_STR(config->args, where, "-stack_type",  "relStack.stack_type", "==");
    9911017    PXOPT_COPY_STR(config->args, where, "-stack_data_group",  "stackRun.data_group", "LIKE");
    9921018    PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "LIKE");
     
    9961022    pxskycellAddWhere(config, where);
    9971023
     1024    PXOPT_COPY_F32(config->args, where, "-fwhm_min",    "IFNULL(skycalResult.fwhm_major, 999)", ">=");
     1025    PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "IFNULL(skycalResult.fwhm_major, 0)", "<=");
     1026
    9981027    PXOPT_LOOKUP_BOOL(priority_order, config->args, "-priority_order", false);
    9991028
    10001029    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    10011030    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     1031
     1032    pxAddLabelSearchArgs (config, where, "-stack_type", "relStack.stack_type", "==");
    10021033
    10031034    psString query = pxDataGet("releasetool_listrelstack.sql");
     
    10181049
    10191050    if (priority_order) {
    1020         psStringAppend(&query, "\nAND priority > 0 order by stack_id, priority");
     1051        psStringAppend(&query, "\nAND priority > 0 order by stack_id, priority DESC");
    10211052    }
    10221053
     
    14871518    PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<=");
    14881519    PXOPT_COPY_F32(config->args, where, "-fwhm_min",    "skycalResult.fwhm_major", ">=");
    1489     PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "skycalresult.fwhm_major", "<=");
     1520    PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "skycalResult.fwhm_major", "<=");
    14901521    PXOPT_COPY_STR(config->args, where, "-exp_name",    "rawExp.exp_ame", "==");
    14911522    PXOPT_COPY_S64(config->args, where, "-exp_id",      "relExp.exp_id", "==");
  • branches/eam_branches/ipp-20130419/ippTools/src/releasetoolConfig.c

    r35397 r35546  
    164164    psMetadataAddStr(listrelexpArgs,  PS_LIST_TAIL, "-cam_data_group", 0, "camRun.data_group (LIKE comparison)", NULL);
    165165    psMetadataAddStr(listrelexpArgs,  PS_LIST_TAIL, "-warp_data_group", 0, "warpRun.data_group (LIKE comparison)", NULL);
     166    psMetadataAddStr(listrelexpArgs,  PS_LIST_TAIL, "-skycell_id", 0, "select by skycell", NULL);
     167    psMetadataAddStr(listrelexpArgs,  PS_LIST_TAIL, "-tess_id", 0,    "warpRun.tess_id", NULL);
    166168
    167169    psMetadataAddStr(listrelexpArgs,  PS_LIST_TAIL, "-surveyName", 0, "select by survey name (LIKE comparision)", NULL);
     
    220222    psMetadataAddF32(listrelstackArgs,  PS_LIST_TAIL, "-fwhm_max", 0, "search by seeing (<=)", NAN);
    221223
     224    psMetadataAddF32(listrelstackArgs,  PS_LIST_TAIL, "-mjd_min", 0, "search by MJD seeing (>=)", NAN);
     225    psMetadataAddF32(listrelstackArgs,  PS_LIST_TAIL, "-mjd_max", 0, "search by MJD (<=)", NAN);
     226
    222227    psMetadataAddStr(listrelstackArgs,  PS_LIST_TAIL, "-tess_id", 0, "select by tess_id", NULL);
    223228    psMetadataAddStr(listrelstackArgs,  PS_LIST_TAIL, "-skycell_id", 0, "select by skycell_id (LIKE comparision)", NULL);
     229    psMetadataAddStr(listrelstackArgs,  PS_LIST_TAIL, "-stack_type", PS_META_DUPLICATE_OK, "select by stack_type", NULL);
    224230
    225231    psMetadataAddStr(listrelstackArgs,  PS_LIST_TAIL, "-stack_data_group", 0, "select by stackRun.data_group (LIKE comparison)", NULL);
Note: See TracChangeset for help on using the changeset viewer.