Changeset 28849 for trunk/ippToPsps/perl/ippToPsps_run.pl
- Timestamp:
- Aug 5, 2010, 12:26:50 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/perl/ippToPsps_run.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/perl/ippToPsps_run.pl
r28842 r28849 18 18 my $camera = 'GPC1'; 19 19 my $batchType = undef; 20 my $survey = undef; 21 my $dvodb = undef; 20 my $dvoPath = undef; 21 my $dvoDb = undef; 22 my $fullDvoPath = undef; 22 23 my $verbose = undef; 23 24 my $save_temps = undef; … … 34 35 'output|o=s' => \$output, 35 36 'batch|b=s' => \$batchType, 36 'dvo db|d=s' => \$dvodb,37 ' survey|s=s' => \$survey,37 'dvopath=s' => \$dvoPath, 38 'dvodb|d=s' => \$dvoDb, 38 39 'expid|e=s' => \$singleExpId, 39 40 'product|p=s' => \$datastoreProduct, … … 49 50 print "* \n"; 50 51 if (@ARGV) { 51 print "* UNKNKOWN: option @ARGV\n"; $quit=1;} 52 $quit=1; 53 print "* UNKNKOWN: option @ARGV\n"; 54 } 52 55 if (!defined $output) { 53 print "* REQUIRED: need to provide an output path -o <path>\n"; $quit=1;} 56 $quit=1; 57 print "* REQUIRED: need to provide an output path -o <path>\n"; 58 } 54 59 if (!defined $batchType) { 55 print "* REQUIRED: need to define a batch type -b <init|det|diff|stack>\n"; $quit=1;} 56 if (!defined $dvodb) { 57 print "* REQUIRED: need to provide a DVO Db path -d <path>\n"; $quit=1;} 58 if (!defined $survey and !defined $singleExpId) { 59 print "* REQUIRED: need to provide a survey type -s <ThreePi|STS|SAS|M31|MD01|MD02|etc> ***OR***\n"; 60 print "* an exposure ID -e <expID>\n"; $quit=1;} 60 $quit=1; 61 print "* REQUIRED: need to define a batch type -b <init|det|diff|stack>\n"; 62 } 63 if (!defined $dvoDb) { 64 $quit=1; 65 print "* REQUIRED: need to provide a DVO Db name -d <name>\n"; 66 } 67 if (!defined $dvoPath) { 68 $dvoPath="/data/ipp037.0/gpc1/catdirs"; 69 print "* OPTIONAL: path to DVO Db -dvopath <path> default = '$dvoPath'\n"; 70 } 71 if (!defined $singleExpId) { 72 73 print "* OPTIONAL: an single exposure ID -e <expID> default = none\n"; 74 } 61 75 if (!defined $datastoreProduct) { 62 print "* OPTIONAL: datastore product -p <product>\n";} 76 77 print "* OPTIONAL: datastore product -p <product> default = none (i.e. data will not be published)\n"; 78 } 63 79 if (!defined $verbose) { 64 print "* OPTIONAL: run in verbose mode -v\n"; $verbose = 0;} 80 $verbose = 0; 81 print "* OPTIONAL: run in verbose mode -v default = $verbose\n"; 82 } 65 83 if (!defined $save_temps) { 66 print "* OPTIONAL: keep temp files -t\n"; $save_temps = 0;} 84 $save_temps = 0; 85 print "* OPTIONAL: keep temp files -t default = $save_temps\n"; 86 } 67 87 if (!defined $no_update) { 68 print "* OPTIONAL: don't update database -u\n"; $no_update = 0;} 88 $no_update = 0; 89 print "* OPTIONAL: don't update database -u default = $no_update\n"; 90 } 69 91 if (!defined $force) { 70 print "* OPTIONAL: force if already processed -f\n"; $force = 0;} 92 $force = 0; 93 print "* OPTIONAL: force if already processed -f default = $force\n"; 94 } 71 95 if (!defined $dontTarNZip) { 72 print "* OPTIONAL: don't tar and zip output -z\n"; $dontTarNZip = 0;} 73 print "*\n*******************************************************************************\n"; 96 $dontTarNZip = 0; 97 print "* OPTIONAL: don't tar and zip output -z default = $dontTarNZip\n"; 98 } 99 print "*\n*******************************************************************************\n"; 74 100 75 101 if ($quit) { exit; } 102 103 $fullDvoPath = $dvoPath . "/" . $dvoDb; 76 104 77 105 my $gpc1Db = new ippToPsps::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser", $verbose, $save_temps); … … 85 113 if ($batchType eq "init") {$initBatch = 1;} 86 114 else {$initBatch = 0;} 87 process(); 115 116 if (!process()) {print "* Finished unsuccessfully\n";} 117 else {print "* Finished successfully\n";} 88 118 89 119 ####################################################################################### … … 114 144 my ($resultsFile, $resultsFilePath) = tempfile( "/tmp/ippToPsps_results.XXXX", UNLINK => !$save_temps); 115 145 my $lastExpId = $ippToPspsDb->getLastExpId(); 116 my $ rows = undef;146 my $exposures; 117 147 118 148 my $query; 119 149 if ($initBatch) { 120 121 my @row = (0, 'NULL', 'ThreePi'); 122 @{$rows} = (\@row); 123 } 124 elsif ($singleExpId) {$rows = $gpc1Db->getSingleExposureInfo($singleExpId);} 125 else {$rows = $gpc1Db->getExposureListFromSurvey($survey);} 126 127 # TODO check if there are no exposures and give a warning 150 151 my @exposure = (0, 'NULL', 'ThreePi'); 152 @{$exposures} = (\@exposure); 153 } 154 # get single exposure 155 elsif ($singleExpId) { 156 157 if (!$gpc1Db->getSingleExposureFromDvoDb($dvoDb, $singleExpId, \$exposures)) {return 0;} 158 } 159 # get all exposures in this DVO Db 160 else { 161 162 if (!$gpc1Db->getExposureListFromDvoDb($dvoDb, \$exposures)) {return 0;} 163 } 128 164 129 165 my $batchId = 0; … … 132 168 133 169 #my $batchId = -1; 134 my $row; 135 foreach $row ( @{$rows} ) { 136 my ($expId, $expName, $distGroup) = @{$row}; 137 # print "JHGHGHGHGH2 $expId, $expName, $distGroup\n"; 138 139 # loop round exposures 140 #while (my @row = $query->fetchrow_array()) { 141 # my ($expId, $expName, $distGroup) = @row; 170 my $exposure; 171 foreach $exposure ( @{$exposures} ) { 172 my ($expId, $expName, $distGroup) = @{$exposure}; 142 173 143 174 if (!$initBatch && $ippToPspsDb->isExposureAlreadyProcessed($expId)) { 144 145 if ($force) {print "* Forcing....\n";}146 else {next};175 176 if ($force) {print "* Forcing....\n";} 177 else {next}; 147 178 } 148 179 … … 457 488 my ($expId, $expName, $surveyType, $outputPath, $resultsFilePath) = @_; 458 489 459 my $nebPath = $gpc1Db->getCameraStageSmf ($expId);490 my $nebPath = $gpc1Db->getCameraStageSmfForThisDvoDb($dvoDb, $expId); 460 491 if (!$nebPath) { return 0; } 461 492 … … 527 558 $command .= " -input $input"; 528 559 $command .= " -output $output"; 529 $command .= " -D CATDIR $ dvodb";560 $command .= " -D CATDIR $fullDvoPath"; 530 561 $command .= " -config ../config"; # TODO 531 $command .= " -expid $expid";562 $command .= " -expid $expid"; 532 563 $command .= " -expname $expName"; 533 564 $command .= " -survey $surveyType";
Note:
See TracChangeset
for help on using the changeset viewer.
