Changeset 28205 for trunk/ippToPsps/scripts/ippToPsps_run.pl
- Timestamp:
- Jun 3, 2010, 3:33:37 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/scripts/ippToPsps_run.pl (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/scripts/ippToPsps_run.pl
r28120 r28205 12 12 13 13 # globals 14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $ label, $singleExpId, $no_publish, $force);14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $survey, $singleExpId, $no_publish, $force); 15 15 16 16 # default values for certain globals … … 31 31 'batch|b=s' => \$batchType, 32 32 'dvodb|d=s' => \$dvodb, 33 ' label|l=s' => \$label,33 'survey|s=s' => \$survey, 34 34 'expid|e=s' => \$singleExpId, 35 35 'product|p=s' => \$datastoreProduct, … … 49 49 "--batch <init|det|diff|stack>\n". 50 50 "--output <path>\n". 51 "-- label <label> or --expid <expid>\n" .51 "--survey <ThreePi|MD01,2 etc|STS|SAS|SweetSpot> or --expid <expid>\n" . 52 52 "--dvodb <path>\n". 53 53 "\n Optional:\n\n". … … 62 62 defined $output and 63 63 defined $dvodb and 64 ( defined $ labelor defined $singleExpId );64 ( defined $survey or defined $singleExpId ); 65 65 66 66 # check we can run programs and get camera config … … 118 118 ####################################################################################### 119 119 # 120 # Finds all exposures for the provided labeland generates PSPS FITS data for them120 # Finds all exposures for the provided TODO and generates PSPS FITS data for them 121 121 # 122 122 ####################################################################################### … … 132 132 if (!$singleExpId) { 133 133 134 # query to retrieve all exposures with the provided label135 134 $query = $gpc1Db->prepare(<<SQL); 136 135 137 SELECT DISTINCT rawExp.exp_id, camRun.dist_group 138 FROM camRun, chipRun, rawExp 139 WHERE camRun.chip_id = chipRun.chip_id 140 AND chipRun.exp_id = rawExp.exp_id 141 AND camRun.dist_group LIKE 'ThreePi' 142 AND rawExp.exp_id > $lastExpId 143 ORDER BY rawExp.exp_id ASC 136 SELECT rawExp.exp_id, rawExp.exp_name, camRun.dist_group 137 FROM camRun, chipRun, rawExp 138 WHERE camRun.state = 'full' 139 AND camRun.chip_id = chipRun.chip_id 140 AND chipRun.exp_id = rawExp.exp_id 141 AND camRun.dist_group = '$survey' 142 AND rawExp.exp_id > 145986 143 GROUP BY rawExp.exp_id 144 ORDER BY rawExp.exp_id ASC; 144 145 SQL 146 147 #AND rawExp.dateobs <= '2010-03-12' 148 149 # SELECT DISTINCT rawExp.exp_id, camRun.dist_group 150 # FROM camRun, chipRun, rawExp 151 # WHERE camRun.chip_id = chipRun.chip_id 152 # AND chipRun.exp_id = rawExp.exp_id 153 # AND camRun.dist_group LIKE 'ThreePi' 154 # AND rawExp.exp_id > $lastExpId 155 # ORDER BY rawExp.exp_id ASC 156 #SQL 145 157 #AND rawExp.exp_id > $lastExpId 146 158 #AND camRun.label LIKE '%$label%' … … 153 165 $query = $gpc1Db->prepare(<<SQL); 154 166 155 SELECT DISTINCT rawExp.exp_id, dist_group FROM rawExp, chipRun WHERE chipRun.exp_id = rawExp.exp_id AND rawExp.exp_id = $singleExpId 167 SELECT DISTINCT rawExp.exp_id, rawExp.exp_name, dist_group 168 FROM rawExp, chipRun 169 WHERE chipRun.exp_id = rawExp.exp_id 170 AND rawExp.exp_id = $singleExpId 156 171 SQL 157 172 } … … 168 183 # loop round exposures 169 184 while (my @row = $query->fetchrow_array()) { 170 my ($expId, $ distGroup) = @row;185 my ($expId, $expName, $distGroup) = @row; 171 186 172 187 if (isExposureAlreadyProcessed($ippToPspsDb, $expId)) { … … 174 189 if ($force) {print "* Forcing....\n";} 175 190 else {next}; 176 }191 } 177 192 178 193 my $surveyType = getSurveyTypeFromDistGroup($distGroup); … … 181 196 $jobId = getNewBatchId($ippToPspsDb, $expId, $surveyType); 182 197 183 # TODO quit here if no sensible job ID198 # TODO quit here if no sensible job ID 184 199 185 200 # generate batch and job paths from job and batch IDs … … 188 203 my $batchDir = sprintf("B%03d", $batchId); 189 204 my $batchOutputPath = sprintf("$jobOutputPath/%s", $batchDir); 190 191 205 print "* Preparing exposure $expId as job '$job'...\n"; 192 206 … … 196 210 197 211 # run IppToPsps program 198 if (runIppToPsps($gpc1Db, $expId, $ batchOutputPath, $batchType)) {212 if (runIppToPsps($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType)) { 199 213 200 214 # write batch manifest and tar and zip up … … 358 372 ####################################################################################### 359 373 sub runIppToPsps { 360 my ($gpc1Db, $expId, $ batchOutputPath, $batchType) = @_;374 my ($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath, $batchType) = @_; 361 375 362 376 my $success = 0; 363 377 364 # before anything else, we can publish the init batch365 378 if ($batchType =~ /init/) { 366 379 $success = produceInit($batchOutputPath); 367 380 } 368 381 elsif ($batchType =~ /det/) { 369 $success = produceDetections($gpc1Db, $expId, $ batchOutputPath);382 $success = produceDetections($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath); 370 383 } 371 384 elsif ($batchType =~ /diff/) { 372 $success = produceDiffs($gpc1Db, $expId, $ batchOutputPath);385 $success = produceDiffs($gpc1Db, $expId, $expName, $surveyType, $batchOutputPath); 373 386 } 374 387 … … 673 686 ####################################################################################### 674 687 sub produceDetections { 675 my ($gpc1Db, $expId,$outputPath) = @_;688 my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_; 676 689 677 690 # query to retrieve nebulous key of camera smf file for this exposure … … 709 722 close $tempFile; 710 723 711 $success = runProgram($tempName, $outputPath, $expId, $ batchType);724 $success = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType); 712 725 return $success; 713 726 } … … 720 733 ####################################################################################### 721 734 sub produceDiffs { 722 my ($gpc1Db, $expId,$outputPath) = @_;735 my ($gpc1Db, $expId, $expName, $surveyType, $outputPath) = @_; 723 736 724 737 my $query = … … 758 771 } 759 772 760 my $ret = runProgram($tempName, $outputPath, $expId, $ batchType);773 my $ret = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType); 761 774 762 775 close $tempFile; … … 771 784 ####################################################################################### 772 785 sub runProgram { 773 my ($input, $output, $expid, $ batchType) = @_;786 my ($input, $output, $expid, $expName, $surveyType, $batchType) = @_; 774 787 775 788 # build command … … 780 793 $command .= " -config config"; # TODO 781 794 $command .= " -expid $expid"; 795 $command .= " -expname $expName"; 782 796 $command .= " -batch $batchType"; 783 797 $command .= " -results $resultsFileName";
Note:
See TracChangeset
for help on using the changeset viewer.
