IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2010, 3:01:48 PM (16 years ago)
Author:
rhenders
Message:

Better handling of 'init' batches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/scripts/ippToPsps_run.pl

    r28249 r28260  
    1212
    1313# globals
    14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $survey, $singleExpId, $no_publish, $force);
     14my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $survey, $singleExpId, $no_publish, $force, $initBatch);
    1515
    1616# default values for certain globals
     
    2525$datastoreProduct = "PSPS_test";
    2626$force = 0;
     27$initBatch = 0;
    2728
    2829# get user args
     
    6263defined $output and
    6364defined $dvodb and
    64 ( defined $survey or defined $singleExpId );
     65(( defined $survey or defined $singleExpId ) or ( $batchType eq "init"));
     66
     67if ($batchType eq "init") {$initBatch = 1;}
    6568
    6669# check we can run programs and get camera config
     
    130133
    131134    my $query;
    132     if (!$singleExpId) {
     135    if ($initBatch) {
     136   
     137        $query = $gpc1Db->prepare(<<SQL);
     138
     139        SELECT 0, 'NULL', 'ThreePi';
     140SQL
     141    }
     142    elsif ($singleExpId) {
     143
     144        $query = $gpc1Db->prepare(<<SQL);
     145
     146        SELECT DISTINCT rawExp.exp_id,  rawExp.exp_name, dist_group
     147            FROM rawExp, chipRun
     148            WHERE chipRun.exp_id = rawExp.exp_id
     149            AND rawExp.exp_id = $singleExpId
     150SQL
     151    }
     152    else {
    133153
    134154        $query = $gpc1Db->prepare(<<SQL);
     
    145165
    146166            #AND rawExp.dateobs <= '2010-03-12'
    147 
    148   #      SELECT DISTINCT rawExp.exp_id, camRun.dist_group
    149   #          FROM camRun, chipRun, rawExp
    150   #          WHERE camRun.chip_id = chipRun.chip_id
    151   #          AND chipRun.exp_id = rawExp.exp_id
    152   #          AND camRun.dist_group LIKE 'ThreePi'
    153   #          AND rawExp.exp_id > $lastExpId
    154   #          ORDER BY rawExp.exp_id ASC
    155 #SQL
    156167            #AND rawExp.exp_id > $lastExpId
    157168            #AND camRun.label LIKE '%$label%'
     
    160171            #AND rawExp.decl >= '-0.157079633' AND rawExp.decl <= '0.157079633' Jims Dec range
    161172    }
    162     else {
    163 
    164         $query = $gpc1Db->prepare(<<SQL);
    165 
    166         SELECT DISTINCT rawExp.exp_id,  rawExp.exp_name, dist_group
    167             FROM rawExp, chipRun
    168             WHERE chipRun.exp_id = rawExp.exp_id
    169             AND rawExp.exp_id = $singleExpId
    170 SQL
    171     }
    172173
    173174    my $batchId = 0;
     
    184185        my ($expId, $expName, $distGroup) = @row;
    185186
    186         if (isExposureAlreadyProcessed($ippToPspsDb, $expId)) {
     187        if (!$initBatch && isExposureAlreadyProcessed($ippToPspsDb, $expId)) {
    187188               
    188189                if ($force) {print "* Forcing....\n";}
     
    202203        my $batchDir = sprintf("B%03d", $batchId);
    203204        my $batchOutputPath = sprintf("$jobOutputPath/%s", $batchDir);
    204         print "* Preparing exposure $expId as job '$job'...\n";
    205 
    206         # make directories
    207205        mkdir($jobOutputPath, 0777);
    208206        mkdir($batchOutputPath, 0777);
     207
     208        print "* Preparing exposure $expId as job '$job'...\n";
    209209
    210210        # run IppToPsps program
     
    245245        }
    246246
    247         if ($batchType eq "init" ) {print "* Wrote initialisation batch\n"; last;}
    248 
     247        if ($initBatch) {print "* Wrote initialisation batch\n";}
    249248
    250249        print "*\n*******************************************************************************\n\n";
     
    676675    my ($outputPath) = @_;
    677676
    678     my $success = runProgram( "NULL", $outputPath, 0, $batchType);
     677    my $success = runProgram("NULL", $outputPath, 0, "NULL", "NULL", $batchType);
    679678    return $success;
    680679}
Note: See TracChangeset for help on using the changeset viewer.