IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 17, 2010, 4:40:03 PM (16 years ago)
Author:
Paul Price
Message:

Reworked all ippTools to put fault=2 (SYS_ERROR) when can't find SQL file (presumably due to NFS problems). Removed DATA_ERROR because ippTools don't work on data (astronomical images or catalogues). This should allow us to turn on revert for fault=2 only.

File:
1 edited

Legend:

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

    r26567 r26981  
    115115    if (!psListLength(where->list)) {
    116116        psFree(where);
    117         psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
    118         return false;
    119     }
    120 
    121     // require the camera to be defined: this analysis does not make sense 
     117        psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
     118        return false;
     119    }
     120
     121    // require the camera to be defined: this analysis does not make sense
    122122    // across multiple cameras
    123123    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     
    142142    psString query = pxDataGet("chiptool_find_rawexp.sql");
    143143    if (!query) {
    144         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     144        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
    145145        psFree(where);
    146146        return false;
     
    173173
    174174    if (pretend) {
    175         for (long i = 0; i < psArrayLength(output); i++) {
    176             // negative simple so the default is true
    177             if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
    178                 psError(PS_ERR_UNKNOWN, false, "failed to print array");
    179                 psFree(output);
    180                 return false;
    181             }
    182         }
     175        for (long i = 0; i < psArrayLength(output); i++) {
     176            // negative simple so the default is true
     177            if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
     178                psError(PS_ERR_UNKNOWN, false, "failed to print array");
     179                psFree(output);
     180                return false;
     181            }
     182        }
    183183        psFree(output);
    184184        return true;
     
    195195    // create a new flatcorrRun
    196196    if (!flatcorrRunInsert(
    197             config->dbh,
     197            config->dbh,
    198198            0,      // corr_id
    199             det_type,
     199            det_type,
    200200            dvodb,
    201             camera,
    202             telescope,
    203             NULL,
     201            camera,
     202            telescope,
     203            NULL,
    204204            filter,
    205205            "reg",  // state
    206             make_correction,
     206            make_correction,
    207207            workdir,
    208208            label,
    209209            reduction,
    210             region,
    211             NULL,
    212             0
     210            region,
     211            NULL,
     212            0
    213213        )) {
    214214        if (!psDBRollback(config->dbh)) {
     
    310310    // create a new flatcorrRun
    311311    flatcorrRunRow *row = flatcorrRunRowAlloc(
    312         0,      // corr_id
    313         det_type,
    314         dvodb,
    315         camera,
    316         telescope,
    317         NULL,
    318         filter,
    319         "reg",  // state
    320         make_correction,
    321         workdir,
    322         label,
    323         reduction,
    324         region,
    325         NULL, // hostname
    326         0 // fault
     312        0,      // corr_id
     313        det_type,
     314        dvodb,
     315        camera,
     316        telescope,
     317        NULL,
     318        filter,
     319        "reg",  // state
     320        make_correction,
     321        workdir,
     322        label,
     323        reduction,
     324        region,
     325        NULL, // hostname
     326        0 // fault
    327327        );
    328328
     
    335335        return false;
    336336    }
    337    
     337
    338338    // figure out the ID of the flatcorrRun we just created
    339339    psS64 corr_id = psDBLastInsertID(config->dbh);
     
    377377    psString query = pxDataGet("flatcorr_dropchip.sql");
    378378    if (!query) {
    379         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    380         return false;
     379        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     380        return false;
    381381    }
    382382
     
    420420    psString query = pxDataGet("flatcorr_dropcamera.sql");
    421421    if (!query) {
    422         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    423         return false;
     422        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     423        return false;
    424424    }
    425425
     
    448448    psString query = pxDataGet("flatcorr_chiprundone.sql");
    449449    if (!query) {
    450         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    451         return false;
     450        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     451        return false;
    452452    }
    453453
     
    461461    // treat limit == 0 as "no limit"
    462462    if (limit) {
    463         psString limitString = psDBGenerateLimitSQL(limit);
    464         psStringAppend(&query, " %s", limitString);
    465         psFree(limitString);
     463        psString limitString = psDBGenerateLimitSQL(limit);
     464        psStringAppend(&query, " %s", limitString);
     465        psFree(limitString);
    466466    }
    467467
     
    524524        // queue the exp
    525525        if (!pxcamQueueByChipID(
    526                 config,
    527                 row->chip_id,
    528                 row->workdir,
    529                 row->label,
    530                 row->data_group,
    531                 row->dist_group,
    532                 row->reduction,
    533                 row->expgroup,
    534                 row->dvodb,
    535                 row->tess_id,
    536                 "camera",
     526                config,
     527                row->chip_id,
     528                row->workdir,
     529                row->label,
     530                row->data_group,
     531                row->dist_group,
     532                row->reduction,
     533                row->expgroup,
     534                row->dvodb,
     535                row->tess_id,
     536                "camera",
    537537                row->magicked,
    538538                NULL // note does not propragate
     
    548548        }
    549549
    550         // figure out the ID of the flatcorrRun we just created
    551         psS64 cam_id = psDBLastInsertID(config->dbh);
    552 
    553         // add the camRun entry to the flatcorrCamLink table (include is TRUE)
     550        // figure out the ID of the flatcorrRun we just created
     551        psS64 cam_id = psDBLastInsertID(config->dbh);
     552
     553        // add the camRun entry to the flatcorrCamLink table (include is TRUE)
    554554        if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) {
    555555            if (!psDBRollback(config->dbh)) {
     
    559559            return false;
    560560        }
    561        
     561
    562562        psFree(row);
    563563    }
     
    587587    psString query = pxDataGet("flatcorr_camerarundone.sql");
    588588    if (!query) {
    589         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    590         return false;
     589        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     590        return false;
    591591    }
    592592
     
    600600    // treat limit == 0 as "no limit"
    601601    if (limit) {
    602         psString limitString = psDBGenerateLimitSQL(limit);
    603         psStringAppend(&query, " %s", limitString);
    604         psFree(limitString);
     602        psString limitString = psDBGenerateLimitSQL(limit);
     603        psStringAppend(&query, " %s", limitString);
     604        psFree(limitString);
    605605    }
    606606
     
    663663        // queue the exp : force image_only to be false (flatcorr is meaningless with just image info)
    664664        if (!pxaddQueueByCamID(
    665                 config,
    666                 row->cam_id,
    667                 row->workdir,
    668                 row->reduction,
    669                 row->label,
     665                config,
     666                row->cam_id,
     667                row->workdir,
     668                row->reduction,
     669                row->label,
    670670                row->data_group,
    671                 row->dvodb,
     671                row->dvodb,
    672672                NULL,       // note is not propagated
    673                 0)) {
     673                0)) {
    674674            if (!psDBRollback(config->dbh)) {
    675675                psError(PS_ERR_UNKNOWN, false, "database error");
     
    682682        }
    683683
    684         // figure out the ID of the flatcorrRun we just created
    685         psS64 add_id = psDBLastInsertID(config->dbh);
    686 
    687         // add the addRun entry to the flatcorrAddstarLink table (include is TRUE)
     684        // figure out the ID of the flatcorrRun we just created
     685        psS64 add_id = psDBLastInsertID(config->dbh);
     686
     687        // add the addRun entry to the flatcorrAddstarLink table (include is TRUE)
    688688        if (!flatcorrAddstarLinkInsert(config->dbh, corr_id, row->cam_id, add_id, 1)) {
    689689            if (!psDBRollback(config->dbh)) {
     
    719719    psString query = pxDataGet("flatcorr_pendingprocess.sql");
    720720    if (!query) {
    721         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    722         return false;
     721        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     722        return false;
    723723    }
    724724
     
    732732    // treat limit == 0 as "no limit"
    733733    if (limit) {
    734         psString limitString = psDBGenerateLimitSQL(limit);
    735         psStringAppend(&query, " %s", limitString);
    736         psFree(limitString);
     734        psString limitString = psDBGenerateLimitSQL(limit);
     735        psStringAppend(&query, " %s", limitString);
     736        psFree(limitString);
    737737    }
    738738
     
    755755
    756756    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    757         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    758         psFree(output);
    759         return false;
     757        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     758        psFree(output);
     759        return false;
    760760    }
    761761
     
    814814    // treat limit == 0 as "no limit"
    815815    if (limit) {
    816         psString limitString = psDBGenerateLimitSQL(limit);
    817         psStringAppend(&query, " %s", limitString);
    818         psFree(limitString);
     816        psString limitString = psDBGenerateLimitSQL(limit);
     817        psStringAppend(&query, " %s", limitString);
     818        psFree(limitString);
    819819    }
    820820
     
    837837
    838838    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    839         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    840         psFree(output);
    841         return false;
     839        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     840        psFree(output);
     841        return false;
    842842    }
    843843
     
    854854    PXOPT_LOOKUP_BOOL(simple,  config->args, "-simple",  false);
    855855    PXOPT_LOOKUP_BOOL(limit,   config->args, "-limit",   false);
    856    
     856
    857857    psMetadata *where = psMetadataAlloc();
    858858    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "==");
     
    860860    psString query = pxDataGet("flatcorr_inputimfile.sql");
    861861    if (!query) {
    862         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     862        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
    863863        return false;
    864864    }
     
    873873    // treat limit == 0 as "no limit"
    874874    if (limit) {
    875         psString limitString = psDBGenerateLimitSQL(limit);
    876         psStringAppend(&query, " %s", limitString);
    877         psFree(limitString);
     875        psString limitString = psDBGenerateLimitSQL(limit);
     876        psStringAppend(&query, " %s", limitString);
     877        psFree(limitString);
    878878    }
    879879
     
    896896
    897897    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    898         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    899         psFree(output);
    900         return false;
     898        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     899        psFree(output);
     900        return false;
    901901    }
    902902
     
    910910
    911911    // check that state is a valid string value
    912     if (!strcmp(state, "reg") && 
    913         !strcmp(state, "new") &&
    914         !strcmp(state, "full"))
     912    if (!strcmp(state, "reg") &&
     913        !strcmp(state, "new") &&
     914        !strcmp(state, "full"))
    915915    {
    916916        psError(PS_ERR_UNKNOWN, false, "invalid state: %s", state);
Note: See TracChangeset for help on using the changeset viewer.