- Timestamp:
- May 18, 2010, 5:06:01 PM (16 years ago)
- Location:
- branches/czw_branch/20100427
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/scripts/ippToPsps_run.pl (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100427
- Property svn:mergeinfo changed
-
branches/czw_branch/20100427/ippToPsps/scripts/ippToPsps_run.pl
r27729 r28017 12 12 13 13 # globals 14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $ product, $output, $dvodb, $datastoreProduct, $label, $singleExpId, $no_publish);14 my ($verbose, $save_temps, $no_op, $no_update, $camera, $batchType, $output, $dvodb, $datastoreProduct, $label, $singleExpId, $no_publish); 15 15 16 16 # TODO temporary until we use database to store current jobid … … 31 31 GetOptions( 32 32 'output|o=s' => \$output, 33 ' product|p=s' => \$product,33 'batch|b=s' => \$batchType, 34 34 'dvodb|d=s' => \$dvodb, 35 35 'label|l=s' => \$label, 36 36 'expid|e=s' => \$singleExpId, 37 ' dsproduct|s=s' => \$datastoreProduct,37 'product|p=s' => \$datastoreProduct, 38 38 'no_publish' => \$no_publish, 39 39 'verbose|v' => \$verbose, … … 48 48 pod2usage( 49 49 -msg => "\n Required options:\n\n". 50 "-- product<init|det|diff|stack>\n".50 "--batch <init|det|diff|stack>\n". 51 51 "--output <path>\n". 52 "--label <label> | --expid <expid>\n" . 53 "--dvodb <path>\n\n", 52 "--label <label> or --expid <expid>\n" . 53 "--dvodb <path>\n". 54 "\n Optional:\n\n". 55 "--product <datastoreProduct>\n". 56 "--no_publish - won't publish to datastore\n". 57 "--save_temps - will save temporary files\n". 58 "--no-op - ?\n". 59 "--no-update - will not update database\n", 54 60 -exitval => 3 55 61 ) unless 56 defined $ productand62 defined $batchType and 57 63 defined $output and 58 64 defined $dvodb and … … 128 134 WHERE camRun.chip_id = chipRun.chip_id 129 135 AND chipRun.exp_id = rawExp.exp_id 130 AND camRun.label like'%$label%'136 AND camRun.label LIKE '%$label%' 131 137 ORDER BY rawExp.exp_id ASC 132 138 SQL 139 #AND rawExp.exp_id > 136561 133 140 #AND camRun.dist_group LIKE 'sas' 134 141 #AND rawExp.decl >= '-0.157079633' AND rawExp.decl <= '0.157079633' Jims Dec range … … 138 145 $query = $db->prepare(<<SQL); 139 146 140 SELECT DISTINCT exp_id FROM rawExp WHERErawExp.exp_id = $singleExpId147 SELECT DISTINCT rawExp.exp_id, dist_group FROM rawExp, chipRun WHERE chipRun.exp_id = rawExp.exp_id AND rawExp.exp_id = $singleExpId 141 148 SQL 142 149 } … … 176 183 my $batchOutputPath = sprintf("$jobOutputPath/%s", $batchDir); 177 184 178 print "* Preparing exposure as job '$job'...\n";185 print "* Preparing exposure $expId as job '$job'...\n"; 179 186 180 187 # make directories 181 188 mkdir($jobOutputPath, 0777); 182 189 mkdir($batchOutputPath, 0777); 190 setJobId($jobId); 183 191 184 192 # run IppToPsps program 185 if (runIppToPsps($db, $expId, $batchOutputPath, $ product)) {193 if (runIppToPsps($db, $expId, $batchOutputPath, $batchType)) { 186 194 187 195 # write batch manifest and tar and zip up 188 if (writeBatchManifest($batchOutputPath, $batchDir, $ product)) {196 if (writeBatchManifest($batchOutputPath, $batchDir, $batchType)) { 189 197 190 198 if (tarAndZipDirectory($jobOutputPath, $batchDir)) { … … 207 215 } 208 216 209 setJobId($jobId);210 217 $jobId++; 211 218 $batchId = 0; … … 218 225 } 219 226 220 if ($ producteq "init" ) {print "* Wrote initialisation batch\n"; last;}227 if ($batchType eq "init" ) {print "* Wrote initialisation batch\n"; last;} 221 228 222 229 … … 271 278 ####################################################################################### 272 279 sub runIppToPsps { 273 my ($db, $expId, $batchOutputPath, $ product) = @_;280 my ($db, $expId, $batchOutputPath, $batchType) = @_; 274 281 275 282 my $success = 0; 276 283 277 284 # before anything else, we can publish the init batch 278 if ($ product=~ /init/) {285 if ($batchType =~ /init/) { 279 286 $success = produceInit($batchOutputPath); 280 287 } 281 elsif ($ product=~ /det/) {288 elsif ($batchType =~ /det/) { 282 289 $success = produceDetections($db, $expId, $batchOutputPath); 283 290 } 284 elsif ($ product=~ /diff/) {291 elsif ($batchType =~ /diff/) { 285 292 $success = produceDiffs($db, $expId, $batchOutputPath); 286 293 } … … 337 344 sub writeBatchManifest { 338 345 339 my ($path,$batch,$ product) = @_;346 my ($path,$batch,$batchType) = @_; 340 347 341 348 use XML::Writer; … … 352 359 # determine batch 'type' 353 360 my $type; 354 if($ producteq 'init') {$type = "IN";}355 elsif($ producteq 'det') {$type = "P2";}356 elsif ($ producteq 'stack') {$type = "ST";}357 elsif ($ producteq 'diff') {$type = "OB";}361 if($batchType eq 'init') {$type = "IN";} 362 elsif($batchType eq 'det') {$type = "P2";} 363 elsif ($batchType eq 'stack') {$type = "ST";} 364 elsif ($batchType eq 'diff') {$type = "OB";} 358 365 else {$type = "UNKNOWN";} 359 366 … … 366 373 my $maxObjId; 367 374 my $filename; 368 if($ producteq 'det') {375 if($batchType eq 'det') { 369 376 370 377 while (<MYFILE>) { … … 403 410 404 411 # write manifest element TODO untidy 405 if($ producteq 'det' && $filename eq $f) {412 if($batchType eq 'det' && $filename eq $f) { 406 413 407 414 $writer->startTag('manifest', … … 430 437 #$writer->startTag('md5'); $writer->characters("$md5sum"); $writer->endTag(); 431 438 432 #if($ producteq 'det' && $filename eq $f) {439 #if($batchType eq 'det' && $filename eq $f) { 433 440 434 441 # $writer->startTag('minObjId'); $writer->characters("$minObjId"); $writer->endTag(); … … 577 584 my ($outputPath) = @_; 578 585 579 my $success = runProgram( "NULL", $outputPath, 0, $ product);586 my $success = runProgram( "NULL", $outputPath, 0, $batchType); 580 587 return $success; 581 588 } … … 621 628 close $tempFile; 622 629 623 $success = runProgram($tempName, $outputPath, $expId, $ product);630 $success = runProgram($tempName, $outputPath, $expId, $batchType); 624 631 return $success; 625 632 } … … 670 677 } 671 678 672 my $ret = runProgram($tempName, $outputPath, $expId, $ product);679 my $ret = runProgram($tempName, $outputPath, $expId, $batchType); 673 680 674 681 close $tempFile; … … 683 690 ####################################################################################### 684 691 sub runProgram { 685 my ($input, $output, $expid, $ product) = @_;692 my ($input, $output, $expid, $batchType) = @_; 686 693 687 694 # build command … … 692 699 $command .= " -config config"; # TODO 693 700 $command .= " -expid $expid"; 694 $command .= " - product $product";701 $command .= " -batch $batchType"; 695 702 $command .= " -results $resultsFileName"; 696 703
Note:
See TracChangeset
for help on using the changeset viewer.
