Changeset 28691
- Timestamp:
- Jul 20, 2010, 10:10:58 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/scripts/ippToPsps_run.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/scripts/ippToPsps_run.pl
r28661 r28691 49 49 my $quit = 0; 50 50 print "\n"; 51 if (!defined $batchType) {print "* ERROR: need to define a batch type (-b)\n"; $quit=1;} 52 if (!defined $output) {print "* ERROR: need to provide an output path (-o)\n"; $quit=1;} 53 if (!defined $dvodb) {print "* ERROR: need to provide a DVO Db path (-d)\n"; $quit=1;} 54 if (!defined $survey and !defined $singleExpId) {print "* ERROR: need to provide a survey type (-s) or an exposure ID (-e)\n"; $quit=1;} 51 if (!defined $batchType) {print "* REQUIRED: need to define a batch type: -b <init|det|diff|stack>\n"; $quit=1;} 52 if (!defined $output) {print "* REQUIRED: need to provide an output path: -o <path>\n"; $quit=1;} 53 if (!defined $dvodb) {print "* REQUIRED: need to provide a DVO Db path: -d <path>\n"; $quit=1;} 54 if (!defined $survey and !defined $singleExpId) {print "* REQUIRED: need to provide a survey type (-s <ThreePi|STS|SAS|etc>) or an exposure ID (-e <expID>)\n"; $quit=1;} 55 if (!defined $datastoreProduct) {print "* OPTIONAL: datastore producth: -p <product>\n";} 55 56 print "\n\n"; 56 57 … … 289 290 290 291 my $query = $db->prepare(<<SQL); 291 292 292 UPDATE batches 293 293 SET processed = $processed, on_datastore = $published, total_detections = $totalDetections … … 296 296 SQL 297 297 298 $query->execute; # TODO check response of th ese298 $query->execute; # TODO check response of this 299 299 } 300 300 … … 380 380 elsif ($batchType =~ /diff/) { 381 381 $success = produceDiffs($gpc1Db, $expId, $expName, $surveyType, $batchDir, $resultsFilePath); 382 } 383 elsif ($batchType =~ /test/) { 384 $success = produceDetections($gpc1Db, $expId, $expName, $surveyType, $batchDir, $resultsFilePath); 382 385 } 383 386 … … 622 625 my ($gpc1Db, $expId, $expName, $surveyType, $outputPath, $resultsFilePath) = @_; 623 626 624 # query to retrieve nebulous key of camera smf file for this exposure 625 my $query = 626 "SELECT camProcessedExp.path_base ". 627 "FROM warpRun ". 628 "JOIN fakeRun USING(fake_id) ". 629 "JOIN camRun USING(cam_id) ". 630 "JOIN camProcessedExp USING(cam_id) ". 631 "JOIN chipRun USING(chip_id) ". 632 "JOIN rawExp USING (exp_id) ". 633 "WHERE rawExp.exp_id = $expId AND camRun.magicked ". 634 "ORDER BY camRun.cam_id DESC LIMIT 1"; # make sure we get most recently processed 635 636 if ($verbose) { print"* $query\n";} 637 638 639 # execute query and check results 640 my $results = $gpc1Db->selectall_arrayref( $query ); 641 my $size = @$results; 642 if ($size < 1) {print "* No smf files found for this exposure\n"; return 0;} 643 644 # loop round db results TODO should only be one result 627 # DESC and LIMIT 1 is to make sure we get most recently processed 628 my $query = $gpc1Db->prepare(<<SQL); 629 SELECT 630 camProcessedExp.path_base 631 FROM warpRun 632 JOIN fakeRun USING(fake_id) 633 JOIN camRun USING(cam_id) 634 JOIN camProcessedExp USING(cam_id) 635 JOIN chipRun USING(chip_id) 636 JOIN rawExp USING (exp_id) 637 WHERE rawExp.exp_id = $expId AND camRun.magicked 638 ORDER BY camRun.cam_id DESC LIMIT 1 639 SQL 640 641 $query->execute; 642 my $nebPath = $query->fetchrow_array(); 643 if (!$nebPath) { print "* No smf files found for this exposure\n"; return 0; } 644 645 645 my $success = 0; 646 for my $row (@$results) { 647 648 # get real filename from neb 'key' 649 my ($nebPath) = @$row; 650 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",$nebPath) or return 0; 651 my $realFile = $ipprc->file_resolve($fpaObjects) or return 0; 652 653 # now write the path to this file out to temp file 654 my ($tempFile, $tempName) = tempfile( "/tmp/ippToPsps_inputFileList.XXXX", UNLINK => !$save_temps); 655 print $tempFile $realFile . "\n"; 656 close $tempFile; 657 658 $success = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType, $resultsFilePath); 659 return $success; 660 } 646 647 # get real filename from neb 'key' 648 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",$nebPath) or return 0; 649 my $realFile = $ipprc->file_resolve($fpaObjects) or return 0; 650 651 # now write the path to this file out to temp file 652 my ($tempFile, $tempName) = tempfile( "/tmp/ippToPsps_inputFileList.XXXX", UNLINK => !$save_temps); 653 print $tempFile $realFile . "\n"; 654 close $tempFile; 655 656 $success = runProgram($tempName, $outputPath, $expId, $expName, $surveyType, $batchType, $resultsFilePath); 657 return $success; 661 658 } 662 659
Note:
See TracChangeset
for help on using the changeset viewer.
