IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33525 for trunk


Ignore:
Timestamp:
Mar 14, 2012, 3:05:17 PM (14 years ago)
Author:
heather
Message:

dvodb changes: staticsky and staticsky_multi are now just staticsky

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/addstar_run.pl

    r33038 r33525  
    117117
    118118my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $stageroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR);
     119my $fpaObjectsAlt = $fpaObjects;
     120
    119121
    120122if ($stage =~ /cam/) {
     
    162164if (($stage =~/staticsky/) || ($stage =~/stack/)) {
    163165    $fpaObjects =~ s/smf$/cmf/;
    164 }
    165 if ($stage =~/staticsky_multi/) {
     166    $fpaObjectsAlt =~ s/smf$/cmf/;
     167}
     168my $checkalt = 0;
     169if ($stage =~/staticsky/) {
    166170    $fpaObjects =~ s/smf$/cmf/; #this should do nothing because it was already modded above
    167171    &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $multi_num);
    168172    my $nice_num = sprintf ("%03d", $multi_num);
    169173    $fpaObjects =~ s/cmf$/$nice_num.cmf/;  #this make it look for .001.cmf, etc
     174    if ($multi_num == 0) {
     175        $checkalt =1 ; #if it's staticsky and multi_num = 0 there's an alternate file to try if this one doesn't work
     176    }
    170177}
    171178
     
    222229            # get the names for the camera and the real input file
    223230            my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
    224             my $realFile = $ipprc->file_resolve($fpaObjects) or &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR);
    225            
     231           
     232            my $realFile = $ipprc->file_resolve($fpaObjects);
     233            if (!defined($realFile)) {
     234                print "can't find $fpaObjects\n";
     235                if ($checkalt)  {
     236                    $realFile = $ipprc->file_resolve($fpaObjectsAlt) or &my_die("Unable to resolve $fpaObjectsAlt", $add_id, $PS_EXIT_SYS_ERROR);
     237                    $fpaObjects = $fpaObjectsAlt; # want to make sure the correct value is used.
     238                } else {
     239                    # try the 'good one' again and fail i
     240                    #$realFile = $ipprc->file_resolve($fpaObjects) or
     241                    &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR);
     242                }
     243               
     244            }
     245
    226246            # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
    227247            my $command  = "$addstar -update"; # XXX optionally set -update?
  • trunk/ippTasks/addstar.pro

    r33030 r33525  
    2626    active true
    2727  end
    28   task addstar.exp.load.staticsky_multi
    29     active true
    30   end 
    3128  task addstar.exp.run
    3229    active true
     
    4441    active false
    4542  end
    46   task addstar.exp.load.staticsky_multi
    47     active false
    48   end
    4943  task addstar.exp.run
    5044    active false
     
    6256    active false
    6357  end
    64  task addstar.revert.staticsky_multi
    65     active false
    66   end
    6758end
    6859macro addstar.revert.on
     
    7162  end
    7263  task addstar.revert.stack
    73     active true
    74   end
    75   task addstar.revert.staticsky_multi
    7664    active true
    7765  end
     
    218206   # if ($LABEL:n == 0) break
    219207    $run = addtool -pendingexp -stage staticsky
    220     if ($DB:n == 0)
    221       option DEFAULT
    222     else
    223       # save the DB name for the exit tasks
    224       option $DB:$addstar_DB
    225       $run = $run -dbname $DB:$addstar_DB
    226       $addstar_DB ++
    227       if ($addstar_DB >= $DB:n) set addstar_DB = 0
    228     end
    229     add_poll_args run
    230     add_poll_labels run
    231     command $run
    232   end
    233 
    234   # success
    235   task.exit    0
    236     # convert 'stdout' to book format
    237     ipptool2book stdout addPendingExp -key add_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    238     if ($VERBOSE > 2)
    239       book listbook addPendingExp
    240     end
    241 
    242     # delete existing entries in the appropriate pantaskStates
    243     process_cleanup addPendingExp
    244   end
    245 
    246   # default exit status
    247   task.exit    default
    248     showcommand failure
    249   end
    250 
    251   task.exit    crash
    252     showcommand crash
    253   end
    254 
    255   # operation times out?
    256   task.exit    timeout
    257     showcommand timeout
    258   end
    259 end
    260 
    261 task           addstar.exp.load.staticsky_multi
    262   host         local
    263 
    264   periods      -poll $LOADPOLL
    265   periods      -exec $LOADEXEC
    266   periods      -timeout 30
    267   npending     1
    268 
    269   stdout NULL
    270   stderr $LOGDIR/addstar.exp.log
    271 
    272   task.exec
    273    # if ($LABEL:n == 0) break
    274     $run = addtool -pendingexp -stage staticsky_multi
    275208    if ($DB:n == 0)
    276209      option DEFAULT
     
    373306        sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID
    374307    end
    375     if ("$STAGE" == "staticsky_multi")
    376         sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID
    377     end
    378308    if ("$STAGE" == "stack")
    379309        sprintf outroot "%s.add.%s" $STAGEROOT $ADD_ID
     
    388318      $run = $run --reduction $REDUCTION
    389319    end
    390     if ("$STAGE" == "staticsky_multi")
     320    if ("$STAGE" == "staticsky")
    391321      $run = $run --multi_num $STAGE_EXTRA1
    392322    end
     
    529459  end
    530460end
     461
    531462task addstar.revert.staticsky
    532463  host         local
     
    544475    if ($LABEL:n == 0) break
    545476    $run = addtool -revertprocessedexp -stage staticsky
    546     if ($DB:n == 0)
    547       option DEFAULT
    548     else
    549       # save the DB name for the exit tasks
    550       option $DB:$addstar_revert_DB_SS
    551       $run = $run -dbname $DB:$addstar_revert_DB_SS
    552       $addstar_revert_DB_SS ++
    553       if ($addstar_revert_DB_SS >= $DB:n) set addstar_revert_DB_SS = 0
    554     end
    555     add_poll_labels run
    556     command $run
    557   end
    558 
    559   # success
    560   task.exit    0
    561   end
    562 
    563   # locked list
    564   task.exit    default
    565     showcommand failure
    566   end
    567 
    568   task.exit    crash
    569     showcommand crash
    570   end
    571 
    572   # operation times out?
    573   task.exit    timeout
    574     showcommand timeout
    575   end
    576 end
    577 task addstar.revert.staticsky_multi
    578   host         local
    579 
    580   periods      -poll 5.0
    581   periods      -exec 60.0
    582   periods      -timeout 1200
    583   npending     1
    584   active        false
    585 
    586   stdout NULL
    587   stderr $LOGDIR/revert.log
    588 
    589   task.exec
    590     if ($LABEL:n == 0) break
    591     $run = addtool -revertprocessedexp -stage staticsky_multi
    592477    if ($DB:n == 0)
    593478      option DEFAULT
  • trunk/ippTasks/survey.pro

    r33072 r33525  
    859859        $run = $run -uncensored
    860860    end
    861     if ("$stage" == "staticsky_multi")
    862         #only queue uncensored staticsky (multi filter)
    863         $run = $run -uncensored
    864     end
    865 
    866861    if ("$stage" == "stack")
    867862        #only queue uncensored stacks
  • trunk/ippTools/share/Makefile.am

    r33030 r33525  
    88        addtool_find_cam_id_dvo.sql \
    99        addtool_find_cam_id.sql \
    10         addtool_find_sky_id_dvo.sql \
    11         addtool_find_sky_id.sql \
    1210        addtool_find_sky_id_multi_dvo.sql \
    1311        addtool_find_sky_id_multi.sql \
     
    1715        addtool_find_pendingexp_cam.sql \
    1816        addtool_find_pendingexp_stack.sql \
    19         addtool_find_pendingexp_staticsky.sql \
    2017        addtool_find_pendingexp_staticsky_multi.sql \
    2118        addtool_find_pendingmergeprocess.sql \
    2219        addtool_find_processedexp_cam.sql \
    2320        addtool_find_processedexp_stack.sql \
    24         addtool_find_processedexp_staticsky.sql \
    2521        addtool_find_processedexp_staticsky_multi.sql \
    2622        addtool_find_minidvodbprocessed.sql \
     
    3026        addtool_queue_cam_id.sql \
    3127        addtool_queue_stack_id.sql \
    32         addtool_queue_sky_id.sql \
    3328        addtool_queue_sky_id_multi.sql \
    3429        addtool_queue_minidvodbrun.sql \
  • trunk/ippTools/share/addtool_find_pendingexp_staticsky_multi.sql

    r32832 r33525  
    2525WHERE
    2626    staticskyRun.state = 'full'
    27     AND stage = 'staticsky_multi'
     27    AND stage = 'staticsky'
    2828    AND ((addRun.state = 'new' AND addProcessedExp.add_id IS NULL) OR addRun.state = 'update')
    2929    AND addRun.dvodb IS NOT NULL
  • trunk/ippTools/share/addtool_find_sky_id.sql

    r31596 r33525  
    22    staticskyRun.*
    33FROM
    4      staticskyResult
    5 join staticskyRun using (sky_id)
     4     staticskyRun
     5join staticskyResult using (sky_id)
    66join staticskyInput using(sky_id)
    77JOIN stackRun USING(stack_id)
     
    1919    staticskyRun.state = 'full'
    2020    AND staticskyResult.quality = 0
    21     AND added_exp_id IS NULL
     21    AND added_sky_id IS NULL
    2222    -- addtool adds checks on exposure being added to the dvodb previously
  • trunk/ippTools/share/addtool_find_sky_id_dvo.sql

    r31596 r33525  
    1 SELECT staticskyRun.* FROM staticskyResult
    2 JOIN staticskyRun USING(sky_id)
     1SELECT staticskyRun.* FROM staticskyRun
     2JOIN staticskyResult USING(sky_id)
    33join staticskyInput using(sky_id)
    44JOIN stackRun USING(stack_id)
    55
    66WHERE staticskyRun.state = 'full' and staticskyResult.quality = 0
    7     AND sky_id NOT IN (SELECT sky_id
     7    AND stack_id NOT IN (SELECT stack_id
    88       FROM addRun
    99       JOIN staticskyResult on staticskyResult.sky_id = addRun.stage_id
    1010       JOIN staticskyRun USING(sky_id)
     11       JOIN staticskyInput USING(sky_id)
    1112       WHERE addRun.stage = 'staticsky' AND %s
    1213      )
  • trunk/ippTools/share/addtool_find_sky_id_multi.sql

    r32832 r33525  
    44    staticskyResult.num_inputs
    55FROM
    6      staticskyResult
    7 join staticskyRun using (sky_id)
     6     staticskyRun
     7join staticskyResult using (sky_id)
    88join staticskyInput using(sky_id)
    99JOIN stackRun USING(stack_id)
    1010
    11 LEFT JOIN (SELECT sky_id       AS added_sky_id,
     11LEFT JOIN (SELECT stack_id       AS added_stack_id,
    1212                  addRun.dvodb AS previous_dvodb
    1313           FROM addRun
    1414JOIN staticskyRun on sky_id = stage_id
    1515          ) as foo
    16      ON sky_id = added_sky_id
    17      AND stage = 'staticsky_multi'
     16     ON stack_id = added_stack_id
     17     AND stage = 'staticsky'
    1818     -- hook for qualifying the join on the previous_dvodb
    1919     AND %s
     
    2121    staticskyRun.state = 'full'
    2222    AND staticskyResult.quality = 0
    23     AND added_exp_id IS NULL
     23    AND added_stack_id IS NULL
    2424    -- addtool adds checks on exposure being added to the dvodb previously
  • trunk/ippTools/share/addtool_find_sky_id_multi_dvo.sql

    r32832 r33525  
    55
    66WHERE staticskyRun.state = 'full' and staticskyResult.quality = 0
    7     AND sky_id NOT IN (SELECT sky_id
     7    AND stack_id NOT IN (SELECT stack_id
    88       FROM addRun
    99       JOIN staticskyResult on staticskyResult.sky_id = addRun.stage_id
    1010       JOIN staticskyRun USING(sky_id)
    11        WHERE addRun.stage = 'staticsky_multi' AND %s
     11       JOIN staticskyInput USING(sky_id)
     12       WHERE addRun.stage = 'staticsky' AND %s
    1213      )
  • trunk/ippTools/share/addtool_queue_sky_id_multi.sql

    r32832 r33525  
    22    SELECT
    33        0,              -- add_id
    4         'staticsky_multi',              -- stage
     4        'staticsky',            -- stage
    55        sky_id,         -- stage_id
    66        %d,             -- stage_extra1
  • trunk/ippTools/share/addtool_revertprocessedexp_staticsky_multi.sql

    r32832 r33525  
    55    AND addProcessedExp.fault != 0
    66    AND addRun.state = 'new'
    7     AND addRun.stage = 'staticsky_multi'
     7    AND addRun.stage = 'staticsky'
  • trunk/ippTools/src/addtool.c

    r33030 r33525  
    141141    pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label
    142142    PXOPT_COPY_STR(config->args, where,  "-reduction", "staticskyyRun.reduction", "==");
    143     pxAddLabelSearchArgs (config, where, "-filter",     "stackRun.filter", "=="); // define using camRun label
    144     }
    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", "==");
    150143    //no filter here
    151144    }
     
    227220    }
    228221    }
     222 
    229223    if (strcmp(stage,"staticsky") == 0) {
    230     if (dvodb ) {
    231       psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_dvo.sql\n%s\n", dvodb,stage);
    232         // find the cam_id of all the exposures that we want to queue up.
    233         bare_query = pxDataGet("addtool_find_sky_id_dvo.sql");
    234         // user supplied dvodb
    235         psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
    236     } else {
    237       psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id.sql\n%s\n",stage);
    238         // find the cam_id of all the exposures that we want to queue up.
    239         bare_query = pxDataGet("addtool_find_sky_id.sql");
    240         // inherit dvodb from camRun, avoid matching NULL
    241         psStringAppend(&dvodb_string, "(staticskyRun.dvodb IS NOT NULL AND previous_dvodb = staticskyRun.dvodb)");
    242     }
    243     }
    244 
    245     if (strcmp(stage,"staticsky_multi") == 0) {
    246224      if (dvodb ) {
    247225        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_multi_dvo.sql\n%s\n", dvodb,stage);
     
    310288        psStringAppend(&query, " GROUP BY stack_id");
    311289      }
     290      //   if (strcmp(stage,"staticsky") == 0) {
     291      //   psStringAppend(&query, " GROUP BY stack_id");
     292      // }
    312293    if (strcmp(stage,"staticsky") == 0) {
    313         psStringAppend(&query, " GROUP BY stack_id");
    314       }
    315     if (strcmp(stage,"staticsky_multi") == 0) {
    316294      psStringAppend(&query, " GROUP BY sky_id");  //some reason it needs this
    317295      }
     
    402380    }
    403381    }
     382   
    404383    if (strcmp(stage,"staticsky") == 0) {
    405     for (long i = 0; i < psArrayLength(output); i++) {
    406         psMetadata *md = output->data[i];
    407 
    408         staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
    409        
    410         if (!row) {
    411             psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
    412             psFree(output);
    413             return false;
    414         }
    415 
    416         if (!dvodb) {  //there's no staticsky.dvodb
    417             psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id);
    418             psFree(output);
    419             return false;
    420         }
    421         if (!workdir && !row->workdir) {
    422             psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id);
    423             psFree(output);
    424             return false;
    425         }
    426 
    427         psFree(row);
    428     }
    429     }
    430     if (strcmp(stage,"staticsky_multi") == 0) {
    431384    for (long i = 0; i < psArrayLength(output); i++) {
    432385        psMetadata *md = output->data[i];
     
    566519    }
    567520      }
     521   
    568522    if (strcmp(stage,"staticsky") == 0) {
    569     for (long i = 0; i < psArrayLength(output); i++) {
    570         psMetadata *md = output->data[i];
    571         psS64 stage_id =0;
    572        
    573         staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
    574         stage_id = row->sky_id;
    575        
    576         if (!row) {
    577             psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
    578             psFree(output);
    579             return false;
    580         }
    581 
    582         // queue the exp
    583         if (!pxaddQueueByCamID(config,
    584                                stage,
    585                                stage_id,
    586                                0,
    587                                workdir     ? workdir   : row->workdir,
    588                                reduction   ? reduction : row->reduction,
    589                                label       ? label     : row->label,
    590                                data_group  ? data_group : (row->data_group ? row->data_group :  (label ? label : row->label)),
    591                                dvodb       ? dvodb     : NULL,
    592                                note        ? note      : NULL,
    593                                image_only,
    594                                minidvodb,
    595                                minidvodb_group,
    596                                minidvodb_name
    597         )) {
    598             if (!psDBRollback(config->dbh)) {
    599                 psError(PS_ERR_UNKNOWN, false, "database error sfg");
    600             }
    601             psError(PS_ERR_UNKNOWN, false,
    602                     "failed to trying to queue stage %s %" PRId64,stage, stage_id);
    603             psFree(row);
    604             psFree(output);
    605             return false;
    606         }
    607         psFree(row);
    608     }
    609       }
    610 
    611     if (strcmp(stage,"staticsky_multi") == 0) {
    612523    for (long i = 0; i < psArrayLength(output); i++) {
    613524        psMetadata *md = output->data[i];
     
    705616    query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id");
    706617    }
    707     if (strcmp(stage, "staticsky_multi")==0) {
    708     query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id");
    709     }
     618   
    710619
    711620    // pxUpdateRun gets parameters from config->args and runs the update query
     
    745654    }
    746655    if (strcmp(stage, "staticsky")==0) {
    747     query = pxDataGet("addtool_find_pendingexp_staticsky.sql");
    748     }
    749     if (strcmp(stage, "staticsky_multi")==0) {
    750656    query = pxDataGet("addtool_find_pendingexp_staticsky_multi.sql");
    751657    }
     
    768674      psStringAppend(&query, " GROUP BY %s", "stack_id");
    769675    }
     676    //if (strcmp(stage, "staticsky") == 0) {
     677    //  //this group by is needed to join against all the warps (to get camera)
     678    //  psStringAppend(&query, " GROUP BY %s", "sky_id");
     679    //}
    770680    if (strcmp(stage, "staticsky") == 0) {
    771       //this group by is needed to join against all the warps (to get camera)
    772       psStringAppend(&query, " GROUP BY %s", "sky_id");
    773     }
    774     if (strcmp(stage, "staticsky_multi") == 0) {
    775681      //this group by is needed to join against all the warps (to get camera)
    776682      psStringAppend(&query, " GROUP BY %s", "sky_id, stage_extra1");
     
    977883    }
    978884    if (strcmp (stage,"staticsky") == 0) {
    979     query = pxDataGet("addtool_find_processedexp_staticsky.sql");
    980     }
    981     if (strcmp (stage,"staticsky_multi") == 0) {
    982885    query = pxDataGet("addtool_find_processedexp_staticsky_multi.sql");
    983886    }
     
    1090993         query = pxDataGet("addtool_revertprocessedexp_stack.sql");
    1091994      }
    1092      if (strcmp(stage, "staticsky") == 0) {
    1093          query = pxDataGet("addtool_revertprocessedexp_staticsky.sql");
    1094       }
    1095    if (strcmp(stage, "staticsky_multi") == 0) {
     995    if (strcmp(stage, "staticsky") == 0) {
    1096996         query = pxDataGet("addtool_revertprocessedexp_staticsky_multi.sql");
    1097997      }
  • trunk/ippTools/src/pxadd.c

    r32832 r33525  
    157157      }
    158158      if (strcmp(stage,"staticsky") == 0) {
    159         query = pxDataGet("addtool_queue_sky_id.sql");
    160         psMemSetPersistent(query, true);
    161       }
    162       if (strcmp(stage,"staticsky_multi") == 0) {
    163159        query = pxDataGet("addtool_queue_sky_id_multi.sql");
    164160        psMemSetPersistent(query, true);
Note: See TracChangeset for help on using the changeset viewer.