IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 9, 2009, 4:01:21 PM (17 years ago)
Author:
giebink
Message:

typo

File:
1 edited

Legend:

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

    r23688 r23786  
    117117    }
    118118
    119     // require the camera to be defined: this analysis does not make sense
     119    // require the camera to be defined: this analysis does not make sense 
    120120    // across multiple cameras
    121121    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     
    169169
    170170    if (pretend) {
    171         for (long i = 0; i < psArrayLength(output); i++) {
    172             // negative simple so the default is true
    173             if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
    174                 psError(PS_ERR_UNKNOWN, false, "failed to print array");
    175                 psFree(output);
    176                 return false;
    177             }
    178         }
     171        for (long i = 0; i < psArrayLength(output); i++) {
     172            // negative simple so the default is true
     173            if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
     174                psError(PS_ERR_UNKNOWN, false, "failed to print array");
     175                psFree(output);
     176                return false;
     177            }
     178        }
    179179        psFree(output);
    180180        return true;
     
    191191    // create a new flatcorrRun
    192192    if (!flatcorrRunInsert(
    193             config->dbh,
     193            config->dbh,
    194194            0,      // corr_id
    195             det_type,
     195            det_type,
    196196            dvodb,
    197             camera,
    198             telescope,
    199             NULL,
     197            camera,
     198            telescope,
     199            NULL,
    200200            filter,
    201201            "reg",  // state
     
    203203            label,
    204204            reduction,
    205             region,
    206             NULL,
    207             0
     205            region,
     206            NULL,
     207            0
    208208        )) {
    209209        if (!psDBRollback(config->dbh)) {
     
    304304    // create a new flatcorrRun
    305305    flatcorrRunRow *row = flatcorrRunRowAlloc(
    306         0,      // corr_id
    307         det_type,
    308         dvodb,
    309         camera,
    310         telescope,
    311         NULL,
    312         filter,
    313         "reg",  // state
    314         workdir,
    315         label,
    316         reduction,
    317         region,
    318         NULL, // hostname
    319         0 // fault
     306        0,      // corr_id
     307        det_type,
     308        dvodb,
     309        camera,
     310        telescope,
     311        NULL,
     312        filter,
     313        "reg",  // state
     314        workdir,
     315        label,
     316        reduction,
     317        region,
     318        NULL, // hostname
     319        0 // fault
    320320        );
    321321
     
    328328        return false;
    329329    }
    330 
     330   
    331331    // figure out the ID of the flatcorrRun we just created
    332332    psS64 corr_id = psDBLastInsertID(config->dbh);
     
    365365    psString query = pxDataGet("flatcorr_dropchip.sql");
    366366    if (!query) {
    367         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    368         return false;
     367        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     368        return false;
    369369    }
    370370
     
    390390    psString query = pxDataGet("flatcorr_chiprundone.sql");
    391391    if (!query) {
    392         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    393         return false;
     392        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     393        return false;
    394394    }
    395395
    396396    // treat limit == 0 as "no limit"
    397397    if (limit) {
    398         psString limitString = psDBGenerateLimitSQL(limit);
    399         psStringAppend(&query, " %s", limitString);
    400         psFree(limitString);
     398        psString limitString = psDBGenerateLimitSQL(limit);
     399        psStringAppend(&query, " %s", limitString);
     400        psFree(limitString);
    401401    }
    402402
     
    459459        // queue the exp
    460460        if (!pxcamQueueByChipID(
    461                 config,
    462                 row->chip_id,
    463                 row->workdir,
    464                 row->label,
    465                 row->reduction,
    466                 row->expgroup,
    467                 row->dvodb,
    468                 row->tess_id,
    469                 "camera")) {
     461                config,
     462                row->chip_id,
     463                row->workdir,
     464                row->label,
     465                row->reduction,
     466                row->expgroup,
     467                row->dvodb,
     468                row->tess_id,
     469                "camera")) {
    470470            if (!psDBRollback(config->dbh)) {
    471471                psError(PS_ERR_UNKNOWN, false, "database error");
     
    478478        }
    479479
    480         // figure out the ID of the flatcorrRun we just created
    481         psS64 cam_id = psDBLastInsertID(config->dbh);
    482 
    483         // add the camRun entry to the flatcorrCamLink table (include is TRUE)
     480        // figure out the ID of the flatcorrRun we just created
     481        psS64 cam_id = psDBLastInsertID(config->dbh);
     482
     483        // add the camRun entry to the flatcorrCamLink table (include is TRUE)
    484484        if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) {
    485485            if (!psDBRollback(config->dbh)) {
     
    489489            return false;
    490490        }
    491 
     491       
    492492        psFree(row);
    493493    }
     
    513513    psString query = pxDataGet("flatcorr_dropcamera.sql");
    514514    if (!query) {
    515         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    516         return false;
     515        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     516        return false;
    517517    }
    518518
     
    537537    psString query = pxDataGet("flatcorr_pendingprocess.sql");
    538538    if (!query) {
    539         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    540         return false;
     539        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     540        return false;
    541541    }
    542542
    543543    // treat limit == 0 as "no limit"
    544544    if (limit) {
    545         psString limitString = psDBGenerateLimitSQL(limit);
    546         psStringAppend(&query, " %s", limitString);
    547         psFree(limitString);
     545        psString limitString = psDBGenerateLimitSQL(limit);
     546        psStringAppend(&query, " %s", limitString);
     547        psFree(limitString);
    548548    }
    549549
     
    566566
    567567    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    568         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    569         psFree(output);
    570         return false;
     568        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     569        psFree(output);
     570        return false;
    571571    }
    572572
     
    588588    // treat limit == 0 as "no limit"
    589589    if (limit) {
    590         psString limitString = psDBGenerateLimitSQL(limit);
    591         psStringAppend(&query, " %s", limitString);
    592         psFree(limitString);
     590        psString limitString = psDBGenerateLimitSQL(limit);
     591        psStringAppend(&query, " %s", limitString);
     592        psFree(limitString);
    593593    }
    594594
     
    611611
    612612    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    613         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    614         psFree(output);
    615         return false;
     613        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     614        psFree(output);
     615        return false;
    616616    }
    617617
     
    628628    PXOPT_LOOKUP_BOOL(simple,  config->args, "-simple",  false);
    629629    PXOPT_LOOKUP_BOOL(limit,   config->args, "-limit",   false);
    630 
     630   
    631631    psMetadata *where = psMetadataAlloc();
    632632    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "==");
     
    647647    // treat limit == 0 as "no limit"
    648648    if (limit) {
    649         psString limitString = psDBGenerateLimitSQL(limit);
    650         psStringAppend(&query, " %s", limitString);
    651         psFree(limitString);
     649        psString limitString = psDBGenerateLimitSQL(limit);
     650        psStringAppend(&query, " %s", limitString);
     651        psFree(limitString);
    652652    }
    653653
     
    670670
    671671    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    672         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    673         psFree(output);
    674         return false;
     672        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     673        psFree(output);
     674        return false;
    675675    }
    676676
     
    685685    PXOPT_LOOKUP_S64(corr_id, config->args, "-corr_id", true, false);
    686686    PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false);
    687     PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     687    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    688688
    689689    char *query = "UPDATE flatcorrRun SET state = 'full', hostname = '%s', fault = '%hd' WHERE corr_id = %" PRId64;
    690690
    691     if (!p_psDBRunQueryF(config->dbh, query, hostname, fault, corr_id)) {
     691    if (!p_psDBRunQueryF(config->dbh, query, hostname, code, corr_id)) {
    692692        psError(PS_ERR_UNKNOWN, false, "failed to change state for corr_id %" PRId64, corr_id);
    693693        return false;
     
    721721
    722722    // check that state is a valid string value
    723     if (!strcmp(state, "reg") &&
    724         !strcmp(state, "new") &&
    725         !strcmp(state, "full"))
     723    if (!strcmp(state, "reg") && 
     724        !strcmp(state, "new") &&
     725        !strcmp(state, "full"))
    726726    {
    727727        psError(PS_ERR_UNKNOWN, false, "invalid state: %s", state);
     
    745745    char sqlFilename[80];
    746746  } ExportTable;
    747 
     747 
    748748  int numExportTables = 3;
    749749
     
    761761
    762762  psMetadata *where = psMetadataAlloc();
    763   PXOPT_COPY_S64(config->args, where, "-coor_id", "corr_id", "==");
     763  PXOPT_COPY_S64(config->args, where, "-corr_id", "corr_id", "==");
    764764
    765765  ExportTable tables [] = {
     
    825825  unsigned int nFail;
    826826  psMetadataItem *item, *entry;
    827 
     827 
    828828  int numImportTables = 3;
    829 
     829 
    830830  char tables[3] [80] = {"flatcorrRun", "flatcorrCamLink", "flatcorrChipLink"};
    831831
    832832  PS_ASSERT_PTR_NON_NULL(config, NULL);
    833 
     833 
    834834  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
    835835
     
    843843    psAssert (item, "entry not in input?");
    844844    psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
    845 
     845   
    846846    entry = psListGet (item->data.list, 0);
    847847    assert (entry);
    848848    assert (entry->type == PS_DATA_METADATA);
    849 
     849 
    850850    switch (i) {
    851851      case 0:
     
    857857        // psMetadataPrint (stderr, entry->data.md, 1);
    858858        break;
    859       }
     859      } 
    860860      case 1:
    861861      {
Note: See TracChangeset for help on using the changeset viewer.