IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 5, 2007, 3:16:08 PM (19 years ago)
Author:
jhoblitt
Message:

rename exp_id -> exp_name
rename exp_tag -> exp_id
add add rawExp.exp_tag for use as an external name only

File:
1 edited

Legend:

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

    r14018 r14023  
    111111
    112112    // select newImfiles that:
    113     // exp_tag is in newExp
    114     // don't have their exp_tag in rawExp
    115     // XXX having the same exp_tag in newExp and raw*Exp is probably an error
     113    // exp_id is in newExp
     114    // don't have their exp_id in rawExp
     115    // XXX having the same exp_id in newExp and raw*Exp is probably an error
    116116    // that should be checked for
    117117
     
    181181    PS_ASSERT_PTR_NON_NULL(config, false);
    182182
    183     psString query = pxDataGet("regtool_find_unprocessed_imfile.sql");
     183    psString query = pxDataGet("regtool_pendingimfile.sql");
    184184    if (!query) {
    185185        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     
    188188
    189189    {
    190         // build a query to search by exp_tag, class, class_id
     190        // build a query to search by exp_id, class, class_id
    191191        psMetadata *where = psMetadataAlloc();
    192192        bool status = false;
    193         psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     193        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    194194        if (!status) {
    195             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     195            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
    196196            psFree(query);
    197197            return false;
    198198        }
    199         if (exp_tag) {
    200             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
    201                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     199        if (exp_id) {
     200            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
     201                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    202202                psFree(where);
    203203                psFree(query);
     
    206206        }
    207207
    208         psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
     208        psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id");
    209209        if (!status) {
    210             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
     210            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id");
    211211            psFree(query);
    212212            return false;
    213213        }
    214         if (class_id) {
    215             if (!psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==", class_id)) {
    216                 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     214        if (tmp_class_id) {
     215            if (!psMetadataAddStr(where, PS_LIST_TAIL, "tmp_class_id", 0, "==", tmp_class_id)) {
     216                psError(PS_ERR_UNKNOWN, false, "failed to add item tmp_class_id");
    217217                psFree(where);
    218218                psFree(query);
     
    511511    PS_ASSERT_PTR_NON_NULL(config, false);
    512512
    513     // make sure that the exp_tag(s) are ready to be updated based on:
    514     // exp_tag is not in rawExp
    515     // exp_tag is not in newImfile
     513    // make sure that the exp_id(s) are ready to be updated based on:
     514    // exp_id is not in rawExp
     515    // exp_id is not in newImfile
    516516    // that the correct count of imfiles is in rawImfile
    517517   
    518518    bool status = false;
    519     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    520     if (!status) {
    521         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    522         return false;
    523     }
    524     if (!exp_tag) {
    525         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     519    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     520    if (!status) {
     521        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     522        return false;
     523    }
     524    if (!exp_id) {
     525        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    526526        return false;
    527527    }
     
    539539    }
    540540
    541     if (!p_psDBRunQuery(config->dbh, query, exp_tag)) {
     541    if (!p_psDBRunQuery(config->dbh, query, exp_id)) {
    542542        psError(PS_ERR_UNKNOWN, false, "database error");
    543543        psFree(query);
     
    608608        if (detrend) {
    609609            // set the state for the newExp to stop
    610             if (!pxnewExpSetState(config, exp_tag, "stop")) {
     610            if (!pxnewExpSetState(config, exp_id, "stop")) {
    611611                // rollback
    612612                if (!psDBRollback(config->dbh)) {
    613613                    psError(PS_ERR_UNKNOWN, false, "database error");
    614614                }
    615                 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag);
     615                psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
    616616                psFree(output);
    617617                return false;
     
    622622
    623623        // set the state for the newExp to stop
    624         if (!pxnewExpSetState(config, exp_tag, "stop")) {
     624        if (!pxnewExpSetState(config, exp_id, "stop")) {
    625625            // rollback
    626626            if (!psDBRollback(config->dbh)) {
    627627                psError(PS_ERR_UNKNOWN, false, "database error");
    628628            }
    629             psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag);
     629            psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
    630630            psFree(output);
    631631            return false;
     
    634634        // insert an entry into the chipPendingExp table
    635635        // this can only be run as the newExp's state has been set to stop
    636         if (!pxchipQueueByExpTag(config, exp_tag, NULL, NULL, NULL, NULL, NULL)) {
     636        if (!pxchipQueueByExpTag(config, exp_id, NULL, NULL, NULL, NULL, NULL)) {
    637637            // rollback
    638638            if (!psDBRollback(config->dbh)) {
     
    776776{
    777777    return guidePendingExpRowAlloc(
    778         newExp->exp_tag,
     778        newExp->exp_id,
    779779        newExp->camera,
    780780        newExp->telescope,
     
    810810    chipPendingExpRow *chipExp = chipPendingExpRowAlloc(
    811811            0,              // chip ID, assigned by db
    812             exp->exp_tag,
     812            exp->exp_id,
    813813            0xdeadbeef,     // guide version
    814814            label,
     
    839839
    840840    bool status = false;
     841    // required
     842    psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name");
     843    if (!status) {
     844        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name");
     845        return false;
     846    }
     847    if (!exp_name) {
     848        psError(PS_ERR_UNKNOWN, true, "-exp_name is required");
     849        return false;
     850    }
     851
     852    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
     853    if (!status) {
     854        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
     855        return false;
     856    }
     857    if (!camera) {
     858        psError(PS_ERR_UNKNOWN, true, "-inst is required");
     859        return false;
     860    }
     861
     862    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
     863    if (!status) {
     864        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
     865        return false;
     866    }
     867    if (!telescope) {
     868        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
     869        return false;
     870    }
     871
     872    psS32 imfiles = psMetadataLookupS32(&status, config->args, "-imfiles");
     873    if (!status) {
     874        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -imfiles");
     875        return false;
     876    }
     877    if (!imfiles) {
     878        psError(PS_ERR_UNKNOWN, true, "-imfiles is required");
     879        return false;
     880    }
     881
     882    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     883    if (!status) {
     884        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     885        return false;
     886    }
     887    if (!exp_tag) {
     888        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     889        return false;
     890    }
     891
    841892    // optional
    842893    psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type");
     
    9891040
    9901041    rawExpRow *raw = rawExpRowAlloc(
    991         exp->exp_tag,
    9921042        exp->exp_id,
    993         exp->camera,
    994         exp->telescope,
     1043        exp_name,
     1044        camera,
     1045        telescope,
    9951046        dateobs,
     1047        exp_tag,
    9961048        exp_type,
    997         exp->imfiles,
     1049        imfiles,
    9981050        filelevel,
    9991051        exp->workdir,
     
    10111063        ccd_temp,
    10121064        posang,
    1013         user_1,
    1014         user_2,
    1015         user_3,
    1016         user_4,
    1017         user_5,
     1065        user_1,
     1066        user_2,
     1067        user_3,
     1068        user_4,
     1069        user_5,
    10181070        object,
    10191071        0.0,
     
    10351087
    10361088    bool status = false;
     1089    // required
     1090    psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name");
     1091    if (!status) {
     1092        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name");
     1093        return false;
     1094    }
     1095    if (!exp_name) {
     1096        psError(PS_ERR_UNKNOWN, true, "-exp_name is required");
     1097        return false;
     1098    }
     1099
     1100    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
     1101    if (!status) {
     1102        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
     1103        return false;
     1104    }
     1105    if (!camera) {
     1106        psError(PS_ERR_UNKNOWN, true, "-inst is required");
     1107        return false;
     1108    }
     1109
     1110    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
     1111    if (!status) {
     1112        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
     1113        return false;
     1114    }
     1115    if (!telescope) {
     1116        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
     1117        return false;
     1118    }
     1119
     1120    psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id");
     1121    if (!status) {
     1122        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id");
     1123        return false;
     1124    }
     1125    if (!tmp_class_id) {
     1126        psError(PS_ERR_UNKNOWN, true, "-tmp_class_id is required");
     1127        return false;
     1128    }
     1129
     1130    psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
     1131    if (!status) {
     1132        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
     1133        return false;
     1134    }
     1135    if (!class_id) {
     1136        psError(PS_ERR_UNKNOWN, true, "-class_id is required");
     1137        return false;
     1138    }
     1139
    10371140    // optional
    10381141    psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type");
     
    11801283
    11811284    rawImfileRow *raw = rawImfileRowAlloc(
    1182         imfile->exp_tag,
    1183         imfile->class_id,
     1285        imfile->exp_id,
     1286        exp_name,
     1287        camera,
     1288        telescope,
     1289        dateobs,
     1290        tmp_class_id,
     1291        class_id,
    11841292        imfile->uri,
    11851293        exp_type,
     
    11981306        ccd_temp,
    11991307        posang,
    1200         user_1,
    1201         user_2,
    1202         user_3,
    1203         user_4,
    1204         user_5,
     1308        user_1,
     1309        user_2,
     1310        user_3,
     1311        user_4,
     1312        user_5,
    12051313        object,
    1206         dateobs,
    12071314        code
    12081315    );
Note: See TracChangeset for help on using the changeset viewer.