IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 20, 2008, 3:48:37 PM (18 years ago)
Author:
eugene
Message:

merging changes from JHs end_stage branch (new end_stage field and related features; substantial cleanup via macros)

File:
1 edited

Legend:

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

    r15293 r16170  
    9292    PS_ASSERT_PTR_NON_NULL(config, false);
    9393
    94     bool status = false;
    95     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    96     if (!status) {
    97         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    98         return false;
    99     }
    100     if (!camera) {
    101         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    102         return false;
    103     }
    104 
    105     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    106     if (!status) {
    107         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    108         return false;
    109     }
    110     if (!telescope) {
    111         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
    112         return false;
    113     }
    114 
    115     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    116     if (!status) {
    117         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");
    118         return false;
    119     }
    120     if (!uri) {
    121         psError(PS_ERR_UNKNOWN, true, "-uri is required");
    122         return false;
    123     }
     94    // required
     95    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     96    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
     97    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    12498
    12599    if (!pzDataStoreInsert(config->dbh,
     
    139113    PS_ASSERT_PTR_NON_NULL(config, false);
    140114
     115    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     116
    141117    if (!p_psDBRunQuery(config->dbh, "SELECT * FROM pzDataStore")) {
    142118        psError(PS_ERR_UNKNOWN, false, "database error");
     
    153129        psFree(output);
    154130        return true;
    155     }
    156 
    157     bool simple = false;
    158     {
    159         bool status = false;
    160         simple = psMetadataLookupBool(&status, config->args, "-simple");
    161         if (!status) {
    162             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    163             return false;
    164         }
    165131    }
    166132
     
    180146{
    181147    PS_ASSERT_PTR_NON_NULL(config, false);
     148
     149    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    182150
    183151    psString query = psStringCopy("SELECT * FROM summitExp");
     
    207175    }
    208176
    209     bool simple = false;
    210     {
    211         bool status = false;
    212         simple = psMetadataLookupBool(&status, config->args, "-simple");
    213         if (!status) {
    214             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    215             return false;
    216         }
    217     }
    218 
    219177    // negative simple so the default is true
    220178    if (!ippdbPrintMetadatas(stdout, output, "summitExp", !simple)) {
     
    233191    PS_ASSERT_PTR_NON_NULL(config, false);
    234192
    235     bool status = false;
    236     psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
    237     if (!status) {
    238         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit");
    239         return false;
    240     }
     193    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     194    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    241195
    242196    psString query = psStringCopy(
     
    279233    }
    280234
    281     bool simple = false;
    282     {
    283         bool status = false;
    284         simple = psMetadataLookupBool(&status, config->args, "-simple");
    285         if (!status) {
    286             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    287             psFree(output);
    288             return false;
    289         }
    290     }
    291 
    292235    // negative simple so the default is true
    293236    if (!ippdbPrintMetadatas(stdout, output, "pzPendingExp", !simple)) {
     
    306249    PS_ASSERT_PTR_NON_NULL(config, false);
    307250
    308     bool status = false;
    309     psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
    310     if (!status) {
    311         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit");
    312         return false;
    313     }
     251    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     252    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    314253
    315254    psArray *cameras = pzGetPendingCameras(config);
     
    330269        }
    331270
     271        bool status;
    332272        psString camera = psMetadataLookupStr(&status, cameras->data[i], "camera");
    333273        psStringAppend(&query, " WHERE camera = \"%s\"", camera);
     
    380320    psFree(cameraImfiles);
    381321
    382     bool simple = false;
    383     {
    384         bool status = false;
    385         simple = psMetadataLookupBool(&status, config->args, "-simple");
    386         if (!status) {
    387             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
    388             psFree(output);
    389             return false;
    390         }
    391     }
    392 
    393322    // negative simple so the default is true
    394323    if (!ippdbPrintMetadatas(stdout, output, "pzPendingImfile", !simple)) {
     
    407336    PS_ASSERT_PTR_NON_NULL(config, false);
    408337
    409     bool status = false;
    410     psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name");
    411     if (!status) {
    412         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name");
    413         return false;
    414     }
    415     if (!exp_name) {
    416         psError(PS_ERR_UNKNOWN, true, "-exp_name is required");
    417         return false;
    418     }
    419 
    420     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    421     if (!status) {
    422         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    423         return NULL;
    424     }
    425     if (!camera) {
    426         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    427         return NULL;
    428     }
    429 
    430     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    431     if (!status) {
    432         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    433         return NULL;
    434     }
    435     if (!telescope) {
    436         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
    437         return NULL;
    438     }
    439 
    440     psString class = psMetadataLookupStr(&status, config->args, "-class");
    441     if (!status) {
    442         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class");
    443         return NULL;
    444     }
    445     if (!class) {
    446         psError(PS_ERR_UNKNOWN, true, "-class is required");
    447         return NULL;
    448     }
    449 
    450     psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
    451     if (!status) {
    452         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
    453         return NULL;
    454     }
    455     if (!class_id) {
    456         psError(PS_ERR_UNKNOWN, true, "-class_id is required");
    457         return NULL;
    458     }
    459 
    460     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    461     if (!status) {
    462         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");
    463         return false;
    464     }
    465     if (!uri) {
    466         psError(PS_ERR_UNKNOWN, true, "-uri is required");
    467         return false;
    468     }
     338    // required
     339    PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false);
     340    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     341    PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false);
     342    PXOPT_LOOKUP_STR(class, config->args, "-class", true, false);
     343    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
     344    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    469345
    470346    // need to know exp_name, camera, telescope, class, class_id (to find the
     
    476352        return false;
    477353    }
    478  
    479354
    480355    // cp the imfile into pzDoneImfile
     
    568443    PS_ASSERT_PTR_NON_NULL(config, false);
    569444
     445    // XXX this is an ugly hack!
     446    // we are passing exp level info to a imfile level mode (-copydone)
     447    // these options are thrown away unless we just -copydone'd the last imfile
     448    // in an exp. 
     449    // This function MUST NOT be invoked from anywhere but copydoneMode().
     450 
     451    // optional
     452    PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", false, false);
     453    PXOPT_LOOKUP_STR(dvodb, config->args, "-dvodb", false, false);
     454    PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", false, false);
     455    PXOPT_LOOKUP_STR(end_stage, config->args, "-end_stage", false, false);
     456
    570457    // find all exposures that have had all of their imfiles downloaded but do
    571458    // not appear in newExp
     
    613500                    doneExp->telescope, // tmp_telescope
    614501                    "run",              // state
    615                     NULL,               // workdir
     502                    workdir,            // workdir
    616503                    "dirty",            // workdir state
    617                     NULL                // reduction class
     504                    NULL,               // reduction class
     505                    dvodb,              // dvodb
     506                    tess_id,            // tess_id
     507                    end_stage           // end_stage
    618508                )
    619509        ) {
Note: See TracChangeset for help on using the changeset viewer.