IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38846


Ignore:
Timestamp:
Oct 12, 2015, 3:40:59 PM (11 years ago)
Author:
heather
Message:

forcedgal changes

Location:
trunk/ippTools
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/share/Makefile.am

    r38563 r38846  
    1212        addtool_find_ff_id.sql \
    1313        addtool_find_ff_id_dvo.sql \
     14        addtool_find_ffsummary_id.sql \
     15        addtool_find_ffsummary_id_dvo.sql \
    1416        addtool_find_skycal_id_dvo.sql \
    1517        addtool_find_skycal_id.sql \
     
    2224        addtool_find_pendingexp_diff.sql \
    2325        addtool_find_pendingexp_ff.sql \
     26        addtool_find_pendingexp_ff_summary.sql \
    2427        addtool_find_pendingexp_skycal.sql \
    2528        addtool_find_pendingexp_stack.sql \
     
    2932        addtool_find_processedexp_diff.sql \
    3033        addtool_find_processedexp_ff.sql \
     34        addtool_find_processedexp_ff_summary.sql \
    3135        addtool_find_processedexp_skycal.sql \
    3236        addtool_find_processedexp_stack.sql \
     
    3943        addtool_queue_diff_id.sql \
    4044        addtool_queue_ff_id.sql \
     45        addtool_queue_ffsummary_id.sql \
    4146        addtool_queue_stack_id.sql \
    4247        addtool_queue_sky_id_multi.sql \
     
    4752        addtool_revertprocessedexp_diff.sql \
    4853        addtool_revertprocessedexp_ff.sql \
     54        addtool_revertprocessedexp_ffsummary.sql \
    4955        addtool_revertprocessedexp_skycal.sql \
    5056        addtool_revertprocessedexp_stack.sql \
  • trunk/ippTools/src/addtool.c

    r38608 r38846  
    156156    if (strcmp(stage, "fullforce")==0) {
    157157      pxAddLabelSearchArgs (config, where, "-label",     "fullForceRun.label", "=="); //define using skycalRun label
     158      pxAddLabelSearchArgs (config, where, "-data_group","fullForceRun.data_group", "==");
     159      PXOPT_COPY_STR(config->args, where,  "-reduction", "fullForceRun.reduction",  "==");
     160    }
     161    if (strcmp(stage, "fullforce_summary")==0) {
     162      //should be nearly identical to fullforce (uses the same tables)
     163      pxAddLabelSearchArgs (config, where, "-label",     "fullForceRun.label", "==");
    158164      pxAddLabelSearchArgs (config, where, "-data_group","fullForceRun.data_group", "==");
    159165      PXOPT_COPY_STR(config->args, where,  "-reduction", "fullForceRun.reduction",  "==");
     
    315321    }
    316322
     323        if (strcmp(stage,"fullforce_summary") == 0) {
     324      if (dvodb ) {
     325        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_ffsummary_id_dvo.sql\n%s\n", dvodb,stage);
     326        // find the skycal_id of all the exposures that we want to queue up.                                                                                                   
     327        bare_query = pxDataGet("addtool_find_ffsummary_id_dvo.sql");
     328        // user supplied dvodb                                                                                                                                             
     329        psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
     330      } else {
     331        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_ffsummary_id.sql\n%s\n",stage);
     332        // find the skycal_id of all the exposures that we want to queue up.                                                                                                   
     333        bare_query = pxDataGet("addtool_find_ffsummary_id.sql");
     334        // inherit dvodb from skycalRun, avoid matching NULL                                                                                                                   
     335        psStringAppend(&dvodb_string, "(fullForceRun.dvodb IS NOT NULL AND previous_dvodb = fullForceRun.dvodb)");
     336        // this is silly, there is no dvodb in skycalRun...?
     337      }
     338    }
     339
    317340
    318341
     
    350373
    351374        }
     375        if (strcmp(stage,"fullforce_summary") == 0) {
     376          //ff needs the ra /deg stuff
     377          psStringAppend(&query, " AND radeg >= %f", minra);
     378          psStringAppend(&query, " AND radeg <= %f", maxra);
     379          psStringAppend(&query, " AND decdeg >= %f", mindec);
     380          psStringAppend(&query, " AND decdeg <= %f", maxdec);
     381
     382        }
    352383
    353384        psFree(whereClause);
     
    404435      if (strcmp(stage,"fullforce") == 0) {
    405436        psStringAppend(&query, " GROUP BY ff_id, warp_id ");  //this needs checking, but I think it shoul be fine? it groups by lots of stuff (including stack - we only want one of each stack in there
     437      }
     438      if (strcmp(stage,"fullforce_summary") == 0) {
     439        psStringAppend(&query, " GROUP BY ff_id ");  //needs to be checked, but should be fine: want 1 ff summary cmf.
    406440      }
    407441
     
    592626        psMetadata *md = output->data[i];
    593627
     628        fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
     629
     630        if (!row) {
     631          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
     632          psFree(output);
     633          return false;
     634        }
     635
     636        if (!dvodb) {  // there's no skycalRun.dvodb
     637          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, ff_id %" PRId64, row->label, row->ff_id);
     638          psFree(output);
     639          return false;
     640        }
     641        if (!workdir && !row->workdir) {
     642          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, ff_id %" PRId64, row->label, row->ff_id);
     643          psFree(output);
     644          return false;
     645        }
     646
     647        psFree(row);
     648      }
     649    }
     650
     651    if (strcmp(stage,"fullforce_summary") == 0) {
     652      for (long i = 0; i < psArrayLength(output); i++) {
     653        psMetadata *md = output->data[i];
     654        //i believe this is correct for ff_summary as well:
    594655        fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
    595656
     
    908969        psFree(row);
    909970    }
     971    }
     972    if (strcmp(stage,"fullforce_summary") == 0) {
     973      for (long i = 0; i < psArrayLength(output); i++) {
     974        psMetadata *md = output->data[i];
     975        psS64 stage_id =0;
     976       
     977        fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
     978        stage_id = row->ff_id;
     979        bool status = false;
     980       
     981        if (!row) {
     982            psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
     983            psFree(output);
     984            return false;
     985        }
     986
     987        // queue the exp
     988        if (!pxaddQueueByCamID(config,
     989                               stage,
     990                               stage_id,
     991                               0,
     992                               workdir     ? workdir   : row->workdir,
     993                               reduction   ? reduction : row->reduction,
     994                               label       ? label     : row->label,
     995                               data_group  ? data_group : (row->data_group ? row->data_group :  (label ? label : row->label)),
     996                               dvodb       ? dvodb     : NULL,
     997                               note        ? note      : NULL,
     998                               image_only,
     999                               minidvodb,
     1000                               minidvodb_group,
     1001                               minidvodb_name
     1002        )) {
     1003            if (!psDBRollback(config->dbh)) {
     1004                psError(PS_ERR_UNKNOWN, false, "database error sfg");
     1005            }
     1006            psError(PS_ERR_UNKNOWN, false,
     1007                    "failed to trying to queue stage %s %" PRId64,stage, stage_id);
     1008            psFree(row);
     1009            psFree(output);
     1010            return false;
     1011        }
     1012        psFree(row);
     1013    }
    9101014      }
    9111015
     
    9681072    if (strcmp(stage, "fullforce")==0) {
    9691073      query = psStringCopy("UPDATE addRun JOIN fullForceResult on (ff_id = stage_id and warp_id = stage_extra1 and stage = 'fullforce') JOIN fullForceRun on (ff_id)");
     1074    }
     1075    if (strcmp(stage, "fullforce_summary")==0) {
     1076      query = psStringCopy("UPDATE addRun JOIN fullForceSummary on (ff_id = stage_id and stage = 'fullforce_summary') JOIN fullForceRun on (ff_id)");
    9701077    }
    9711078
     
    10241131      query = pxDataGet("addtool_find_pendingexp_ff.sql");
    10251132    }
     1133    if (strcmp(stage, "fullforce_summary")==0) {
     1134      query = pxDataGet("addtool_find_pendingexp_ffsummary.sql");
     1135    }
    10261136
    10271137
     
    10661176      }
    10671177    }
    1068 
    1069     //    if (multi) {
    1070     //  psStringAppend(&query, " , %s", "stage_id");
    1071     //}
    1072 
     1178   
     1179    if (strcmp(stage, "fullforce_summary") == 0) {
     1180      //this group by is needed to join against all the warps (to get camera)
     1181      psStringAppend(&query, "GROUP BY %s", "ff_id");
     1182    }
    10731183
    10741184    // treat limit == 0 as "no limit"
     
    13051415    } else if (strcmp (stage,"fullforce") == 0) {
    13061416      query = pxDataGet("addtool_find_processedexp_ff.sql");
    1307 
     1417    } else if (strcmp (stage,"fullforce_summary") == 0) {
     1418      query = pxDataGet("addtool_find_processedexp_ffsummary.sql");
    13081419    } else {
    13091420        psFree(where);
     
    14301541    if (strcmp(stage, "fullforce") == 0) {
    14311542      query = pxDataGet("addtool_revertprocessedexp_ff.sql");
     1543    }
     1544    if (strcmp(stage, "fullforce_summary") == 0) {
     1545      query = pxDataGet("addtool_revertprocessedexp_ffsummary.sql");
    14321546    }
    14331547
Note: See TracChangeset for help on using the changeset viewer.