IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24512 for trunk


Ignore:
Timestamp:
Jun 19, 2009, 12:38:16 PM (17 years ago)
Author:
Paul Price
Message:

Done with development of mechanism to automatically publish detections: merging branches/pap_mops (r24510) into trunk

Location:
trunk
Files:
39 edited
10 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Nebulous

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Nebulous-Server

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Nebulous/bin

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Nebulous/examples

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Nebulous/lib

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Nebulous/nebclient

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Nebulous/nebclient/tests/tap

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Nebulous/t

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Ohana

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Ohana/src/relastro

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/dbconfig/changes.txt

    r24487 r24512  
    11281128
    11291129ALTER TABLE warpRun ADD COLUMN reduction VARCHAR(64) AFTER tess_id;
     1130
     1131-- Tables to support publishing of detections to a Science Client
     1132-- Clients to which we send stuff
     1133CREATE TABLE publishClient (
     1134    client_id BIGINT AUTO_INCREMENT, -- unique identifier
     1135    product VARCHAR(64),             -- product name
     1136    stage VARCHAR(64) NOT NULL, -- stage of interest (chip, camera, diff, etc.)
     1137    workdir VARCHAR(255) NOT NULL, -- working directory
     1138    comment VARCHAR(255),            -- for human memory
     1139    PRIMARY KEY(client_id)
     1140) ENGINE=innodb DEFAULT CHARSET=latin1;
     1141-- Publishing a set of data (e.g., a specific diffRun)
     1142CREATE TABLE publishRun (
     1143    pub_id BIGINT AUTO_INCREMENT, -- unique identifier
     1144    client_id BIGINT NOT NULL,  -- link to publishClient
     1145    stage_id BIGINT NOT NULL,   -- link to various stage tables
     1146    label VARCHAR(64),          -- label for run
     1147    state VARCHAR(64),          -- state of run (new, full, etc.)
     1148    PRIMARY KEY(pub_id),
     1149    KEY(client_id),
     1150    KEY(stage_id),
     1151    KEY(label),
     1152    KEY(state),
     1153    FOREIGN KEY(client_id) REFERENCES publishClient(client_id)
     1154) ENGINE=innodb DEFAULT CHARSET=latin1;
     1155-- Publishing a file within a set
     1156CREATE TABLE publishDone (
     1157    pub_id BIGINT AUTO_INCREMENT, -- link to publishRun
     1158    path_base VARCHAR(255),     -- base path of output
     1159    fault SMALLINT NOT NULL DEFAULT 0, -- Fault code
     1160    PRIMARY KEY(pub_id),
     1161    KEY(fault),
     1162    FOREIGN KEY(pub_id) REFERENCES publishRun(pub_id)
     1163) ENGINE=innodb DEFAULT CHARSET=latin1;
  • trunk/dbconfig/ipp.m4

    r23880 r24512  
    2626include(rc.md)
    2727include(receive.md)
     28include(publish.md)
  • trunk/ippScripts/Build.PL

    r24266 r24512  
    9191        scripts/receive_setstatus.pl
    9292        scripts/rcserver_checkstatus.pl
     93        scripts/publish_file.pl
    9394    )],
    9495    dist_abstract => 'Scripts for running the Pan-STARRS IPP',
  • trunk/ippTasks/Makefile.am

    r24204 r24512  
    2323        rcserver.pro \
    2424        pstamp.pro \
    25         receive.pro
     25        receive.pro \
     26        publish.pro
    2627
    2728other_files = \
  • trunk/ippTools/share/Makefile.am

    r24422 r24512  
    168168     pxadmin_create_mirror_tables.sql \
    169169     pxadmin_drop_tables.sql \
     170     pubtool_definerun.sql \
     171     pubtool_pending.sql \
     172     pubtool_revert.sql \
    170173     pztool_find_completed_exp.sql \
    171174     pztool_pendingimfile.sql \
  • trunk/ippTools/share/camtool_find_processedexp.sql

    r24112 r24512  
    55    rawExp.exp_tag,
    66    rawExp.exp_name,
     7    rawExp.exp_time,
    78    rawExp.camera,
    89    rawExp.telescope,
  • trunk/ippTools/share/chiptool_export_imfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ippTools/share/chiptool_export_processed_imfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ippTools/share/difftool_definewarpstack.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ippTools/share/difftool_definewarpstack_part1.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ippTools/share/difftool_definewarpstack_part2.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ippTools/share/difftool_definewarpstack_temp_create.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ippTools/share/difftool_skyfile.sql

    r24174 r24512  
    55    diffRun.state,
    66    diffRun.workdir,
     7    diffRun.bothways,
     8    camProcessedExp.zpt_obs,
     9    camProcessedExp.zpt_stdev,
     10    camProcessedExp.zpt_lq,
     11    camProcessedExp.zpt_uq,
     12    rawExp.exp_time,
     13    rawExp.camera,
    714    warp1,
    815    stack1,
     
    1320JOIN diffInputSkyfile USING(diff_id, skycell_id)
    1421JOIN warpRun
     22-- NOTE: joining input only!
     23-- This is so that we can get the correct zero point
     24-- XXX This needs to be more clever to handle diffs between stacks
    1525    ON warpRun.warp_id = diffInputSkyfile.warp1
    1626JOIN fakeRun USING(fake_id)
    1727JOIN camRun USING(cam_id)
     28JOIN camProcessedExp USING(cam_id)
    1829JOIN chipRun USING(chip_id)
    1930JOIN rawExp USING(exp_id)
  • trunk/ippTools/share/pxadmin_create_tables.sql

    r24487 r24512  
    13691369
    13701370
     1371
     1372-- Tables to support publishing of detections to a Science Client
     1373
     1374-- Clients to which we send stuff
     1375CREATE TABLE publishClient (
     1376    client_id BIGINT AUTO_INCREMENT, -- unique identifier
     1377    product VARCHAR(64),             -- product name
     1378    stage VARCHAR(64) NOT NULL, -- stage of interest (chip, camera, diff, etc.)
     1379    workdir VARCHAR(255) NOT NULL, -- working directory
     1380    comment VARCHAR(255),            -- for human memory
     1381    PRIMARY KEY(client_id)
     1382) ENGINE=innodb DEFAULT CHARSET=latin1;
     1383
     1384-- Publishing a set of data (e.g., a specific diffRun)
     1385CREATE TABLE publishRun (
     1386    pub_id BIGINT AUTO_INCREMENT, -- unique identifier
     1387    client_id BIGINT NOT NULL,  -- link to publishClient
     1388    stage_id BIGINT NOT NULL,   -- link to various stage tables
     1389    label VARCHAR(64),          -- label for run
     1390    state VARCHAR(64),          -- state of run (new, full, etc.)
     1391    PRIMARY KEY(pub_id),
     1392    KEY(client_id),
     1393    KEY(stage_id),
     1394    KEY(label),
     1395    KEY(state),
     1396    FOREIGN KEY(client_id) REFERENCES publishClient(client_id)
     1397) ENGINE=innodb DEFAULT CHARSET=latin1;
     1398
     1399-- Publishing a file within a set
     1400CREATE TABLE publishDone (
     1401    pub_id BIGINT AUTO_INCREMENT, -- link to publishRun
     1402    path_base VARCHAR(255),     -- base path of output
     1403    fault SMALLINT NOT NULL DEFAULT 0, -- Fault code
     1404    PRIMARY KEY(pub_id),
     1405    KEY(fault),
     1406    FOREIGN KEY(pub_id) REFERENCES publishRun(pub_id)
     1407) ENGINE=innodb DEFAULT CHARSET=latin1;
     1408
     1409
    13711410-- This comment line is here to avoid empty query error.
    13721411-- Another way to avoid that problem is to omit the semicolon above but I think that is untidy.
  • trunk/ippTools/share/warptool_revertoverlap.sql

  • trunk/ippTools/src

    • Property svn:ignore
      •  

        old new  
        3434disttool
        3535receivetool
         36
         37pubtool
  • trunk/ippTools/src/Makefile.am

    r24038 r24512  
    2020        stacktool \
    2121        warptool \
    22         receivetool
     22        receivetool \
     23        pubtool
    2324
    2425
     
    5960        regtool.h \
    6061        stacktool.h \
    61         warptool.h
     62        warptool.h \
     63        pubtool.h
    6264
    6365lib_LTLIBRARIES = libpxtools.la
     
    220222    receivetoolConfig.c
    221223
     224pubtool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS)
     225pubtool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la
     226pubtool_SOURCES = \
     227    pubtool.c \
     228    pubtoolConfig.c
     229
    222230clean-local:
    223231        -rm -f TAGS
  • trunk/ppImage

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ppStack

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/ppSub

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psLib/src/fits/psFitsTable.c

    r18421 r24512  
    390390
    391391
    392 bool psFitsInsertTable(psFits* fits,
    393                        const psMetadata* header,
    394                        const psArray* table,
    395                        const char *extname,
    396                        bool after)
     392static bool fitsInsertTable(psFits* fits,             // FITS file
     393                            const psMetadata* header, // FITS header to write
     394                            const psArray* table,     // Table to write
     395                            const char *extname,      // Extension name to give table
     396                            bool after,               // Write table after current extension?
     397                            bool writeData            // Write data?
     398                            )
    397399{
    398400    PS_ASSERT_FITS_NON_NULL(fits, false);
     
    403405
    404406    long numRows = table->n;
    405     if (numRows < 1) {
     407    if (writeData && numRows < 1) {
    406408        // no table data, what can I do?
    407409        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     
    504506        fits_create_tbl(fits->fd,
    505507                        BINARY_TBL,
    506                         table->n, // number of rows in table
     508                        writeData ? numRows : 0, // number of rows in table
    507509                        numColumns, // number of columns in table
    508510                        (char**)columnNames->data, // names of the columns
     
    524526        // Insert the table
    525527        fits_insert_btbl(fits->fd,
    526                          table->n, // number of rows in table
     528                         writeData ? numRows : 0, // number of rows in table
    527529                         numColumns, // number of columns in table
    528530                         (char**)columnNames->data, // names of the columns
     
    562564
    563565    // cfitsio requires that we write the data by columns --- urgh!
    564     psMetadataIteratorSet(colSpecsIter, PS_LIST_HEAD);
    565     for (long colNum = 1; (colSpecItem = psMetadataGetAndIncrement(colSpecsIter)); colNum++) {
    566         // Note: colNum is unit-indexed, because it's for cfitsio
    567         colSpec *spec = colSpecItem->data.V; // The specification
    568         if (PS_DATA_IS_PRIMITIVE(spec->type)) {
    569             size_t dataSize = PSELEMTYPE_SIZEOF(spec->type); // Size (in bytes) of this type
    570             psVector *columnData = psVectorAlloc(table->n, spec->type); // The raw row data, to be written
    571             psVectorInit(columnData, 0);
    572             for (long i = 0; i < table->n; i++) {
    573                 psMetadata *row = table->data[i]; // The row of interest
    574                 psMetadataItem *dataItem = psMetadataLookup(row, colSpecItem->name); // The value of interest
    575                 memcpy(&columnData->data.U8[i * dataSize], &dataItem->data, dataSize);
     566    if (writeData) {
     567        psMetadataIteratorSet(colSpecsIter, PS_LIST_HEAD);
     568        for (long colNum = 1; (colSpecItem = psMetadataGetAndIncrement(colSpecsIter)); colNum++) {
     569            // Note: colNum is unit-indexed, because it's for cfitsio
     570            colSpec *spec = colSpecItem->data.V; // The specification
     571            if (PS_DATA_IS_PRIMITIVE(spec->type)) {
     572                size_t dataSize = PSELEMTYPE_SIZEOF(spec->type); // Size (in bytes) of this type
     573                psVector *columnData = psVectorAlloc(table->n, spec->type); // The raw row data, to be written
     574                psVectorInit(columnData, 0);
     575                for (long i = 0; i < table->n; i++) {
     576                    psMetadata *row = table->data[i]; // The row of interest
     577                    psMetadataItem *dataItem = psMetadataLookup(row, colSpecItem->name); // Value of interest
     578                    memcpy(&columnData->data.U8[i * dataSize], &dataItem->data, dataSize);
     579                }
     580
     581                int fitsDataType;           // Data type for cfitsio
     582                p_psFitsTypeToCfitsio(spec->type, NULL, NULL, &fitsDataType);
     583                fits_write_col(fits->fd,
     584                               fitsDataType,
     585                               colNum, // column number
     586                               1, // first row
     587                               1, // first element
     588                               table->n, // number of rows
     589                               columnData->data.U8, // the data
     590                               &status);
     591                psFree(columnData);
     592            } else {
     593                switch (spec->type) {
     594                  case PS_DATA_STRING: {
     595                      psArray *strings = psArrayAlloc(table->n); // Array of strings
     596                      for (long i = 0; i < table->n; i++) {
     597                          psMetadata *row = table->data[i]; // The row of interest
     598                          strings->data[i] = psMemIncrRefCounter(psMetadataLookupStr(NULL, row,
     599                                                                                     colSpecItem->name));
     600                      }
     601                      fits_write_col_str(fits->fd, colNum, 1, 1, table->n, (char**)strings->data, &status);
     602                      psFree(strings);
     603                      break;
     604                  }
     605                  case PS_DATA_VECTOR: {
     606                      size_t dataSize = PSELEMTYPE_SIZEOF(spec->vectorType); // Size of data, in bytes
     607                      psVector *columnData = psVectorAlloc(spec->size * table->n * dataSize, PS_TYPE_U8);
     608                      psVectorInit(columnData, 0);
     609                      for (long i = 0; i < table->n; i++) {
     610                          psMetadata *row = table->data[i]; // The row of interest
     611                          psMetadataItem* dataItem = psMetadataLookup(row, colSpecItem->name);
     612                          if (dataItem->type != PS_DATA_VECTOR) {
     613                              // Just in case --- get a zero instead of some weird result
     614                              continue;
     615                          }
     616                          psVector *vector = dataItem->data.V;
     617                          memcpy(&columnData->data.U8[i * dataSize * spec->size], vector->data.U8,
     618                                 vector->n * dataSize);
     619                      }
     620
     621                      int fitsDataType;           // Data type for cfitsio
     622                      p_psFitsTypeToCfitsio(spec->vectorType, NULL, NULL, &fitsDataType);
     623                      fits_write_col(fits->fd, fitsDataType, colNum, 1, 1, table->n * spec->size,
     624                                     columnData->data.U8, &status);
     625                      psFree(columnData);
     626                      break;
     627                  }
     628                  default:
     629                    psAbort("Should never get here.\n");
     630                }
    576631            }
    577632
    578             int fitsDataType;           // Data type for cfitsio
    579             p_psFitsTypeToCfitsio(spec->type, NULL, NULL, &fitsDataType);
    580             fits_write_col(fits->fd,
    581                            fitsDataType,
    582                            colNum, // column number
    583                            1, // first row
    584                            1, // first element
    585                            table->n, // number of rows
    586                            columnData->data.U8, // the data
    587                            &status);
    588             psFree(columnData);
    589         } else {
    590             switch (spec->type) {
    591             case PS_DATA_STRING: {
    592                     psArray *strings = psArrayAlloc(table->n); // Array of strings
    593                     for (long i = 0; i < table->n; i++) {
    594                         psMetadata *row = table->data[i]; // The row of interest
    595                         strings->data[i] = psMemIncrRefCounter(psMetadataLookupStr(NULL, row,
    596                                                                colSpecItem->name));
    597                     }
    598                     fits_write_col_str(fits->fd, colNum, 1, 1, table->n, (char**)strings->data, &status);
    599                     psFree(strings);
    600                     break;
    601                 }
    602             case PS_DATA_VECTOR: {
    603                     size_t dataSize = PSELEMTYPE_SIZEOF(spec->vectorType); // Size of data, in bytes
    604                     psVector *columnData = psVectorAlloc(spec->size * table->n * dataSize, PS_TYPE_U8);
    605                     psVectorInit(columnData, 0);
    606                     for (long i = 0; i < table->n; i++) {
    607                         psMetadata *row = table->data[i]; // The row of interest
    608                         psMetadataItem* dataItem = psMetadataLookup(row, colSpecItem->name);
    609                         if (dataItem->type != PS_DATA_VECTOR) {
    610                             // Just in case --- get a zero instead of some weird result
    611                             continue;
    612                         }
    613                         psVector *vector = dataItem->data.V;
    614                         memcpy(&columnData->data.U8[i * dataSize * spec->size], vector->data.U8,
    615                                vector->n * dataSize);
    616                     }
    617 
    618                     int fitsDataType;           // Data type for cfitsio
    619                     p_psFitsTypeToCfitsio(spec->vectorType, NULL, NULL, &fitsDataType);
    620                     fits_write_col(fits->fd, fitsDataType, colNum, 1, 1, table->n * spec->size,
    621                                    columnData->data.U8, &status);
    622                     psFree(columnData);
    623                     break;
    624                 }
    625             default:
    626                 psAbort("Should never get here.\n");
     633            // Check error status from writing column
     634            if (status != 0) {
     635                psFitsError(status, true, "Unable to write column %ld of FITS table", colNum);
     636                psFree(colSpecsIter);
     637                psFree(colSpecs);
     638                return false;
    627639            }
    628         }
    629 
    630         // Check error status from writing column
    631         if (status != 0) {
    632             psFitsError(status, true, "Unable to write column %ld of FITS table", colNum);
    633             psFree(colSpecsIter);
    634             psFree(colSpecs);
    635             return false;
    636640        }
    637641    }
     
    650654    return true;
    651655}
     656
     657
     658bool psFitsInsertTable(psFits* fits, const psMetadata* header, const psArray* table, const char *extname,
     659                       bool after)
     660{
     661    PS_ASSERT_FITS_NON_NULL(fits, false);
     662    PS_ASSERT_FITS_WRITABLE(fits, false);
     663    return fitsInsertTable(fits, header, table, extname, after, true);
     664}
     665
     666bool psFitsWriteTableEmpty(psFits *fits, const psMetadata *header, const psMetadata *columns,
     667                           const char *extname)
     668{
     669    PS_ASSERT_FITS_NON_NULL(fits, false);
     670    PS_ASSERT_FITS_WRITABLE(fits, false);
     671    if (!psFitsMoveLast(fits)) {
     672        psError(PS_ERR_UNKNOWN, false, "Unable to move to last extension to write table");
     673        return false;
     674    }
     675    psArray *table = psArrayAlloc(1);   // Dummy table carrying column definitions
     676    table->data[0] = psMemIncrRefCounter((psPtr)columns); // Casting away const
     677    bool status = fitsInsertTable(fits, header, table, extname, true, false); // Status of insertion
     678    psFree(table);
     679    return status;
     680}
     681
     682bool psFitsInsertTableEmpty(psFits *fits, const psMetadata *header, const psMetadata *columns,
     683                            const char *extname, bool after)
     684{
     685    PS_ASSERT_FITS_NON_NULL(fits, false);
     686    PS_ASSERT_FITS_WRITABLE(fits, false);
     687    psArray *table = psArrayAlloc(1);   // Dummy table carrying column definitions
     688    table->data[0] = psMemIncrRefCounter((psPtr)columns); // Casting away const
     689    bool status = fitsInsertTable(fits, header, table, extname, after, false); // Status of insertion
     690    psFree(table);
     691    return status;
     692}
     693
    652694
    653695bool psFitsUpdateTable(psFits* fits,
  • trunk/psLib/src/fits/psFitsTable.h

    r15248 r24512  
    9090);
    9191
     92/// Write an empty table
     93bool psFitsWriteTableEmpty(
     94    psFits *fits,                       ///< FITS file pointer
     95    const psMetadata *header,           ///< Header to write
     96    const psMetadata *columns,          ///< Column definitions; no data used except name,type
     97    const char *extname                 ///< Extension name for table
     98    );
     99
    92100/** Inserts a whole FITS table. A new HDU of the type BINTABLE is inserted either
    93101 *  before or after, depending on the AFTER parameter, the current HDU.
     
    104112    bool after    ///< TRUE if insert is done after CHDU, otherwise table is inserted before CHDU
    105113);
     114
     115/// Insert an empty table
     116bool psFitsInsertTableEmpty(
     117    psFits *fits,              ///< FITS file pointer
     118    const psMetadata *header,  ///< Header to write
     119    const psMetadata *columns, ///< Column definitions; no data used except name,type
     120    const char *extname,       ///< Extension name for table
     121    bool after                 ///< Insert after current HDU?
     122    );
     123
    106124
    107125/** Updates a FITS table.  The current HDU type must be either
  • trunk/psModules

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psastro

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psastro/src/psastroFindChip.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psconfig

  • trunk/psconfig/tagsets/ipp-2.8.dist

    r23567 r24512  
    6969  YYYYY  DataStore              ipp-2-8          -0
    7070
     71  YYYYY  ppMops                 ipp-2-8          -0
     72
    7173  YNNNN  extsrc/gpcsw           ipp-2-8          -0
    7274
  • trunk/psphot

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.