IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32832


Ignore:
Timestamp:
Nov 29, 2011, 11:46:43 AM (14 years ago)
Author:
heather
Message:

added 'staticsky_multi' stage to addstar to allow processing of staticsky
(multi_filter).

Location:
trunk
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/dbconfig/add.md

    r31378 r32832  
    33    add_id          S64     0       # Primary Key AUTO_INCREMENT
    44    stage           STR     64      # what the stage is (warp, cam, diff,
    5     stage_id          S64     0       # Key INDEX(add_id,cam_id) fkey(cam_id) ref camRun(cam_id)
     5    stage_id          S64     0       # Key INDEX(add_id,cam_id) fkey(cam_id)    ref camRun(cam_id)
     6    stage_extra1    S32     0       
    67    state           STR     64      # Key
    78    workdir         STR     255
  • trunk/ippScripts/scripts/addstar_run.pl

    r31377 r32832  
    3737}
    3838my $minidvodb_path;
    39 my ( $add_id, $camera, $stage, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
     39my ( $add_id, $camera, $stage, $multi_num, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
    4040     $no_op, $redirect, $save_temps);
    4141GetOptions(
     
    4343    'camera|c=s'        => \$camera, # Camera
    4444    'stage|s=s'        => \$stage, # Camera
    45    
     45    'multi_num|w=s'    => \$multi_num, # the number for a staticskymulti (for finding cmf)
    4646    'dbname|d=s'        => \$dbname, # Database name
    4747    'outroot|w=s'       => \$outroot, # output file base name
     
    114114   
    115115}
     116
     117if ($stage =~/staticsky_multi/) {
     118    $fpaObjects =~ s/smf$/cmf/; #this should do nothing because it was already modded above
     119    &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $multi_num);
     120    my $nice_num = sprintf ("%03d", $multi_num);
     121    $fpaObjects =~ s/cmf$/$nice_num.cmf/;  #this make it look for .001.cmf, etc
     122 
     123}
     124
    116125my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR);
    117126
     
    190199        $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference
    191200            $command .= " -image" if $image_only;
    192             if ($stage = ~/staticsky/) {
     201            if ($stage =~ /staticsky/) {
    193202                $command .= " -accept-astrom ";
    194             }
     203            }  #careful here - this matches staticsky and staticsky_multi
    195204        my $mjd_addstar_start = DateTime->now->mjd;   # MJD of starting script
    196205
  • trunk/ippTasks/addstar.pro

    r31376 r32832  
    2626    active true
    2727  end
     28  task addstar.exp.load.staticsky_multi
     29    active true
     30  end 
    2831  task addstar.exp.run
    2932    active true
     
    3942  end
    4043  task addstar.exp.load.staticsky
     44    active false
     45  end
     46  task addstar.exp.load.staticsky_multi
    4147    active false
    4248  end
     
    175181  end
    176182end
     183
    177184task           addstar.exp.load.staticsky
    178185  host         local
     
    229236  end
    230237end
     238
     239task           addstar.exp.load.staticsky_multi
     240  host         local
     241
     242  periods      -poll $LOADPOLL
     243  periods      -exec $LOADEXEC
     244  periods      -timeout 30
     245  npending     1
     246
     247  stdout NULL
     248  stderr $LOGDIR/addstar.exp.log
     249
     250  task.exec
     251   # if ($LABEL:n == 0) break
     252    $run = addtool -pendingexp -stage staticsky_multi
     253    if ($DB:n == 0)
     254      option DEFAULT
     255    else
     256      # save the DB name for the exit tasks
     257      option $DB:$addstar_DB
     258      $run = $run -dbname $DB:$addstar_DB
     259      $addstar_DB ++
     260      if ($addstar_DB >= $DB:n) set addstar_DB = 0
     261    end
     262    add_poll_args run
     263    add_poll_labels run
     264    command $run
     265  end
     266
     267  # success
     268  task.exit    0
     269    # convert 'stdout' to book format
     270    ipptool2book stdout addPendingExp -key add_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     271    if ($VERBOSE > 2)
     272      book listbook addPendingExp
     273    end
     274
     275    # delete existing entries in the appropriate pantaskStates
     276    process_cleanup addPendingExp
     277  end
     278
     279  # default exit status
     280  task.exit    default
     281    showcommand failure
     282  end
     283
     284  task.exit    crash
     285    showcommand crash
     286  end
     287
     288  # operation times out?
     289  task.exit    timeout
     290    showcommand timeout
     291  end
     292end
     293
     294
    231295# run the addstar script on pending exposures
    232296task           addstar.exp.run
     
    252316    book getword addPendingExp $pageName exp_tag -var EXP_TAG
    253317    book getword addPendingExp $pageName add_id -var ADD_ID
     318    book getword addPendingExp $pageName stage_extra1 -var STAGE_EXTRA1
    254319    book getword addPendingExp $pageName stageroot -var STAGEROOT
    255320    book getword addPendingExp $pageName stage -var STAGE 
     
    285350        sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID
    286351    end
     352    if ("$STAGE" == "staticsky_multi")
     353        sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID
     354    end
    287355    if ("$STAGE" == "stack")
    288356        sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID
     
    296364    if ("$REDUCTION" != "NULL")
    297365      $run = $run --reduction $REDUCTION
     366    end
     367    if ("$STAGE" == "staticsky_multi")
     368      $run = $run --multi_num $STAGE_EXTRA1
    298369    end
    299370    if ("$IMAGE_ONLY" == "T")
  • trunk/ippTasks/survey.pro

    r32680 r32832  
    3333 book create SURVEY_WARP_BG
    3434 book create SURVEY_PUBLISH
    35  book create SURVEY_STATICSKYSINGLE  
     35 book create SURVEY_STATICSKYSINGLE
    3636 $haveSurveyBooks = TRUE
    3737end
     
    4848$SURVEY_PUBLISH_DB = 0
    4949$SURVEY_STATICSKYSINGLE_DB = 0
    50 
    5150$SURVEY_EXEC = 120
    5251$SURVEY_POLL = 10
     
    839838        $run = $run -uncensored
    840839    end
     840    if ("$stage" == "staticsky_multi")
     841        #only queue uncensored staticsky (multi filter)
     842        $run = $run -uncensored
     843    end
     844
    841845    if ("$stage" == "stack")
    842846        #only queue uncensored stacks
  • trunk/ippTools/share/Makefile.am

    r32771 r32832  
    1010        addtool_find_sky_id_dvo.sql \
    1111        addtool_find_sky_id.sql \
     12        addtool_find_sky_id_multi_dvo.sql \
     13        addtool_find_sky_id_multi.sql \
    1214        addtool_find_stack_id_dvo.sql \
    1315        addtool_find_stack_id.sql \
     
    1618        addtool_find_pendingexp_stack.sql \
    1719        addtool_find_pendingexp_staticsky.sql \
     20        addtool_find_pendingexp_staticsky_multi.sql \
    1821        addtool_find_pendingmergeprocess.sql \
    1922        addtool_find_processedexp_cam.sql \
    2023        addtool_find_processedexp_stack.sql \
    2124        addtool_find_processedexp_staticsky.sql \
     25        addtool_find_processedexp_staticsky_multi.sql \
    2226        addtool_find_minidvodbprocessed.sql \
    2327        addtool_find_minidvodbrun.sql \
     
    2731        addtool_queue_stack_id.sql \
    2832        addtool_queue_sky_id.sql \
     33        addtool_queue_sky_id_multi.sql \
    2934        addtool_queue_minidvodbrun.sql \
    3035        addtool_revertminidvodbprocessed.sql \
     
    3237        addtool_revertprocessedexp_stack.sql \
    3338        addtool_revertprocessedexp_staticsky.sql \
     39        addtool_revertprocessedexp_staticsky_multi.sql \
    3440        bgtool_advancechip.sql \
    3541        bgtool_advancewarp.sql \
  • trunk/ippTools/share/addtool_queue_cam_id.sql

    r31375 r32832  
    44        'cam',          -- stage
    55        cam_id,         -- stage_id
     6        %d,             -- stage_extra1
    67        '%s',           -- state
    78        '%s',           -- workdir
  • trunk/ippTools/share/addtool_queue_sky_id.sql

    r31375 r32832  
    44        'staticsky',            -- stage
    55        sky_id,         -- stage_id
     6        %d,             -- stage_extra1
    67        '%s',           -- state
    78        '%s',           -- workdir
  • trunk/ippTools/share/addtool_queue_stack_id.sql

    r31375 r32832  
    44        'stack',                -- stage
    55        stack_id,         -- stage_id
     6        %d,               --stage_extra1
    67        '%s',           -- state
    78        '%s',           -- workdir
  • trunk/ippTools/src/addtool.c

    r32711 r32832  
    143143    pxAddLabelSearchArgs (config, where, "-filter",     "stackRun.filter", "=="); // define using camRun label
    144144    }
    145    
     145        if (strcmp(stage, "staticsky_multi")== 0) {
     146
     147    pxAddLabelSearchArgs (config, where, "-label",     "staticskyRun.label", "=="); // define using camRun label
     148    pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label
     149    PXOPT_COPY_STR(config->args, where,  "-reduction", "staticskyyRun.reduction", "==");
     150    //no filter here
     151    }
    146152    if (!psListLength(where->list)) {
    147153        psFree(where);
     
    237243    }
    238244
    239 
     245    if (strcmp(stage,"staticsky_multi") == 0) {
     246      if (dvodb ) {
     247        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_multi_dvo.sql\n%s\n", dvodb,stage);
     248        // find the cam_id of all the exposures that we want to queue up.
     249        bare_query = pxDataGet("addtool_find_sky_id_multi_dvo.sql");
     250        // user supplied dvodb
     251        psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
     252    } else {
     253      psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id_multi.sql\n%s\n",stage);
     254        // find the cam_id of all the exposures that we want to queue up.
     255        bare_query = pxDataGet("addtool_find_sky_id_multi.sql");
     256        // inherit dvodb from camRun, avoid matching NULL
     257        psStringAppend(&dvodb_string, "(staticskyRun.dvodb IS NOT NULL AND previous_dvodb = staticskyRun.dvodb)");
     258    }
     259    }
    240260
    241261    if (!bare_query) {
     
    292312        psStringAppend(&query, " GROUP BY stack_id");
    293313      }
    294 
     314    if (strcmp(stage,"staticsky_multi") == 0) {
     315      psStringAppend(&query, " GROUP BY sky_id");  //some reason it needs this
     316      }
    295317
    296318
     
    405427    }
    406428    }
     429    if (strcmp(stage,"staticsky_multi") == 0) {
     430    for (long i = 0; i < psArrayLength(output); i++) {
     431        psMetadata *md = output->data[i];
     432        bool status = false;
     433        psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
     434        if (!status) {
     435          psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs");
     436          return false;
     437        }
     438        if (num_inputs < 0) {
     439          psError(PS_ERR_UNKNOWN, true, "invalid value for num_inputs");
     440          return false;
     441        }
     442
     443        staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
     444       
     445        if (!row) {
     446            psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
     447            psFree(output);
     448            return false;
     449        }
     450
     451        if (!dvodb) {  //there's no staticsky.dvodb
     452            psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id);
     453            psFree(output);
     454            return false;
     455        }
     456        if (!workdir && !row->workdir) {
     457            psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id);
     458            psFree(output);
     459            return false;
     460        }
     461
     462        psFree(row);
     463    }
     464    }
     465
     466
     467
    407468
    408469    // start a transaction so we don't end up with an exp without any associted
     
    438499                               stage,
    439500                               stage_id,
     501                               0,
    440502                               workdir     ? workdir   : row->workdir,
    441503                               reduction   ? reduction : row->reduction,
     
    479541                               stage,
    480542                               stage_id,
     543                               0,
    481544                               workdir     ? workdir   : row->workdir,
    482545                               reduction   ? reduction : row->reduction,
     
    520583                               stage,
    521584                               stage_id,
     585                               0,
    522586                               workdir     ? workdir   : row->workdir,
    523587                               reduction   ? reduction : row->reduction,
     
    544608      }
    545609
     610    if (strcmp(stage,"staticsky_multi") == 0) {
     611    for (long i = 0; i < psArrayLength(output); i++) {
     612        psMetadata *md = output->data[i];
     613        psS64 stage_id =0;
     614        bool status = false;
     615        psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
     616        if (!status) {
     617          psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs");
     618          return false;
     619        }
     620        staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
     621        stage_id = row->sky_id;
     622       
     623        if (!row) {
     624            psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
     625            psFree(output);
     626            return false;
     627        }
     628
     629        // queue the exp
     630        for (int filter_id = 0; filter_id < num_inputs; filter_id++) { 
     631        if (!pxaddQueueByCamID(config,
     632                               stage,
     633                               stage_id,
     634                               filter_id,
     635                               workdir     ? workdir   : row->workdir,
     636                               reduction   ? reduction : row->reduction,
     637                               label       ? label     : row->label,
     638                               data_group  ? data_group : (row->data_group ? row->data_group :  (label ? label : row->label)),
     639                               dvodb       ? dvodb     : NULL,
     640                               note        ? note      : NULL,
     641                               image_only,
     642                               minidvodb,
     643                               minidvodb_group,
     644                               minidvodb_name
     645        )) {
     646            if (!psDBRollback(config->dbh)) {
     647                psError(PS_ERR_UNKNOWN, false, "database error sfg");
     648            }
     649            psError(PS_ERR_UNKNOWN, false,
     650                    "failed to trying to queue stage %s %" PRId64,stage, stage_id);
     651            psFree(row);
     652            psFree(output);
     653            return false;
     654        }
     655        }
     656        psFree(row);
     657    }
     658      }
     659
     660
     661
     662
    546663    psFree(output);
    547664
     
    585702    }
    586703    if (strcmp(stage, "staticsky")==0) {
     704    query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id");
     705    }
     706    if (strcmp(stage, "staticsky_multi")==0) {
    587707    query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id");
    588708    }
     
    626746    query = pxDataGet("addtool_find_pendingexp_staticsky.sql");
    627747    }
    628 
     748    if (strcmp(stage, "staticsky_multi")==0) {
     749    query = pxDataGet("addtool_find_pendingexp_staticsky_multi.sql");
     750    }
     751   
    629752
    630753    if (!query) {
     
    648771      psStringAppend(&query, " GROUP BY %s", "sky_id");
    649772    }
    650 
     773    if (strcmp(stage, "staticsky_multi") == 0) {
     774      //this group by is needed to join against all the warps (to get camera)
     775      psStringAppend(&query, " GROUP BY %s", "sky_id, stage_extra1");
     776    }
    651777    // treat limit == 0 as "no limit"
    652778    if (limit) {
     
    838964    query = pxDataGet("addtool_find_processedexp_staticsky.sql");
    839965    }
     966    if (strcmp (stage,"staticsky_multi") == 0) {
     967    query = pxDataGet("addtool_find_processedexp_staticsky_multi.sql");
     968    }
     969
    840970   
    841971    if (!query) {
     
    9481078         query = pxDataGet("addtool_revertprocessedexp_staticsky.sql");
    9491079      }
     1080   if (strcmp(stage, "staticsky_multi") == 0) {
     1081         query = pxDataGet("addtool_revertprocessedexp_staticsky_multi.sql");
     1082      }
     1083
     1084
     1085     
    9501086      if (!query) {
    9511087            // rollback
  • trunk/ippTools/src/flatcorr.c

    r31375 r32832  
    666666                "cam",
    667667                row->cam_id,
     668                0,
    668669                row->workdir,
    669670                row->reduction,
  • trunk/ippTools/src/pxadd.c

    r31375 r32832  
    131131                       char *stage,
    132132                       psS64 stage_id,
     133                       psS32 stage_extra1,
    133134                       char *workdir,
    134135                       char *reduction,
     
    159160        psMemSetPersistent(query, true);
    160161      }
     162      if (strcmp(stage,"staticsky_multi") == 0) {
     163        query = pxDataGet("addtool_queue_sky_id_multi.sql");
     164        psMemSetPersistent(query, true);
     165      }
    161166        if (!query) {
    162167            psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     
    170175    // on 32/64
    171176    if (!p_psDBRunQueryF(config->dbh, query,
     177                         stage_extra1 ? stage_extra1 : 0,
    172178                         "new", // state
    173179                         workdir  ? workdir   : "NULL",
  • trunk/ippTools/src/pxadd.h

    r31375 r32832  
    3333                       char *stage,
    3434                       psS64 stage_id,
     35                       psS32 stage_extra1,
    3536                       char *workdir,
    3637                       char *reduction,
Note: See TracChangeset for help on using the changeset viewer.