- Timestamp:
- May 28, 2010, 3:09:59 PM (16 years ago)
- Location:
- branches/czw_branch/20100519
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/scripts/ippToPsps_run.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100519
- Property svn:mergeinfo changed
/trunk (added) merged: 28046-28057,28062-28069,28072-28076,28079-28100
- Property svn:mergeinfo changed
-
branches/czw_branch/20100519/ippToPsps/scripts/ippToPsps_run.pl
r28023 r28164 87 87 my ($distGroup) = @_; 88 88 89 if ($distGroup eq "MD01") {return $distGroup;} 90 if ($distGroup eq "MD02") {return $distGroup;} 91 if ($distGroup eq "MD03") {return $distGroup;} 92 if ($distGroup eq "MD04") {return $distGroup;} 93 if ($distGroup eq "MD05") {return $distGroup;} 94 if ($distGroup eq "MD06") {return $distGroup;} 95 if ($distGroup eq "MD07") {return $distGroup;} 96 if ($distGroup eq "MD08") {return $distGroup;} 97 if ($distGroup eq "MD09") {return $distGroup;} 98 if ($distGroup eq "MD10") {return $distGroup;} 99 if ($distGroup eq "M31") {return $distGroup;} 100 if ($distGroup eq "sts") {return "STS";} 101 if ($distGroup eq "SweetSpot") {return "SS";} 102 if ($distGroup eq "3PI") {return $distGroup;} 103 if ($distGroup eq "ThreePi") {return "3PI";} 104 if ($distGroup eq "SAS") {return "3PI";} 105 106 print "* Do not understand distribution group: '$distGroup'\n"; 89 if ($distGroup =~ m/^MD([0-1][0-9])$/i) {return "MD$1";} 90 if ($distGroup =~ m/^M31$/i) {return "M31";} 91 if ($distGroup =~ m/^sts$/i) {return "STS";} 92 if ($distGroup =~ m/^SweetSpot$/i) {return "SSS";} 93 if ($distGroup =~ m/^(3PI)|(ThreePi)|(SAS)$/i) {return "3PI";} 94 95 print "* Unknown distribution group: '$distGroup'\n"; 107 96 return undef; 108 97 } … … 114 103 ####################################################################################### 115 104 sub process { 105 my $lastExpId = getLastExpId(); 106 107 print "*******************************************************************************\n*\n"; 108 print "* Last successfully processed exposure ID was $lastExpId\n"; 116 109 117 110 # Set up the database … … 137 130 AND chipRun.exp_id = rawExp.exp_id 138 131 AND camRun.label LIKE '%$label%' 132 AND rawExp.exp_id > $lastExpId 139 133 ORDER BY rawExp.exp_id ASC 140 134 SQL … … 153 147 my $batchId = 0; 154 148 my $batchesPerJob = 1; 155 156 # get a new jobId157 my $jobId = getJobId();158 $jobId++;159 if ($jobId < 0) { print "* Cannot find sensible jobId ($jobId)\n";160 return 0;161 }162 163 print "*******************************************************************************\n*\n";164 165 149 my $anyBatches = 0; 166 150 167 168 151 $query->execute; 169 152 170 153 open (LOGFILE, ">> $logFile"); 154 155 my $jobId = -1; 171 156 172 157 # loop round exposures … … 174 159 my ($expId, $distGroup) = @row; 175 160 176 print "* Exposure ID = $expId with dist group = '$distGroup'\n"; 161 $jobId = getNewJobId(); 162 163 print "* Exposure ID = $expId with dist group = '$distGroup' as job ID $jobId\n"; 177 164 178 165 my $surveyType = getSurveyTypeFromDistGroup($distGroup); … … 192 179 mkdir($jobOutputPath, 0777); 193 180 mkdir($batchOutputPath, 0777); 194 setJobId($jobId);195 181 196 182 # run IppToPsps program … … 222 208 print LOGFILE "$jobId $expId\n"; 223 209 224 $jobId++;225 210 $batchId = 0; 226 211 $anyBatches = 0; … … 228 213 else { 229 214 230 print "* No batches to publish\n" 215 print "* No batches to publish\n"; 216 print LOGFILE "$jobId $expId ERROR\n"; 231 217 } 232 218 } 219 else { 220 print LOGFILE "$jobId $expId ERROR\n"; 221 } 233 222 234 223 if ($batchType eq "init" ) {print "* Wrote initialisation batch\n"; last;} … … 246 235 ####################################################################################### 247 236 # 237 # Gets the last processed exposure ID (ini file for now - will be Db eventually TODO) 238 # 239 ######################################################################################## 240 sub getLastExpId { 241 242 my $lastExpId = `tail $logFile -n 1 | awk '{print \$2}'`; 243 chomp($lastExpId); 244 return $lastExpId; 245 } 246 247 ####################################################################################### 248 # 248 249 # Gets the current jobId (ini file for now - will be Db eventually TODO) 249 250 # 250 251 ######################################################################################## 251 sub get JobId {252 sub getNewJobId { 252 253 253 254 my $jobId = -1; … … 260 261 close (MYFILE); 261 262 262 if ($verbose) { print "* Current jobId = $jobId\n"; } 263 264 return $jobId; 265 } 266 267 ####################################################################################### 268 # 269 # Sets the current jobId (in file for now - will be Db eventually TODO) 270 # 271 ######################################################################################## 272 sub setJobId { 273 my ($jobId) = @_; 263 $jobId++; 274 264 275 265 open (MYFILE, "> $jobIdFilePath"); … … 277 267 close (MYFILE); 278 268 279 if ($verbose) { print "* New jobId = $jobId\n"; }280 } 281 282 ####################################################################################### 283 # 284 # run IppToPsps269 return $jobId; 270 } 271 272 ####################################################################################### 273 # 274 # run IppToPsps 285 275 # 286 276 #######################################################################################
Note:
See TracChangeset
for help on using the changeset viewer.
