IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 28, 2010, 3:09:59 PM (16 years ago)
Author:
watersc1
Message:

JPEG work should be done. Transitioning to try to pick up stackAssociation concept in this branch as well.

Location:
branches/czw_branch/20100519
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20100519

  • branches/czw_branch/20100519/ippToPsps/scripts/ippToPsps_run.pl

    r28023 r28164  
    8787    my ($distGroup) = @_;
    8888
    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";
    10796    return undef;
    10897}
     
    114103#######################################################################################
    115104sub process {
     105    my $lastExpId = getLastExpId();
     106
     107    print "*******************************************************************************\n*\n";
     108    print "* Last successfully processed exposure ID was $lastExpId\n";
    116109
    117110    # Set up the database
     
    137130            AND chipRun.exp_id = rawExp.exp_id
    138131            AND camRun.label LIKE '%$label%'
     132            AND rawExp.exp_id > $lastExpId
    139133            ORDER BY rawExp.exp_id ASC
    140134SQL
     
    153147    my $batchId = 0;
    154148    my $batchesPerJob = 1;
    155 
    156     # get a new jobId
    157     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 
    165149    my $anyBatches = 0;
    166150
    167 
    168151    $query->execute;
    169152
    170153    open (LOGFILE, ">> $logFile");
     154
     155    my $jobId = -1;
    171156
    172157    # loop round exposures
     
    174159        my ($expId, $distGroup) = @row;
    175160
    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";
    177164
    178165        my $surveyType = getSurveyTypeFromDistGroup($distGroup);
     
    192179        mkdir($jobOutputPath, 0777);
    193180        mkdir($batchOutputPath, 0777);
    194         setJobId($jobId);
    195181
    196182        # run IppToPsps program
     
    222208                print LOGFILE "$jobId $expId\n";
    223209
    224                 $jobId++;
    225210                $batchId = 0;
    226211                $anyBatches = 0;
     
    228213            else {
    229214
    230                 print "* No batches to publish\n"
     215                print "* No batches to publish\n";
     216                print LOGFILE "$jobId $expId ERROR\n";
    231217            }
    232218        }
     219        else {
     220            print LOGFILE "$jobId $expId ERROR\n";
     221        }
    233222
    234223        if ($batchType eq "init" ) {print "* Wrote initialisation batch\n"; last;}
     
    246235#######################################################################################
    247236#
     237# Gets the last processed exposure ID (ini file for now - will be Db eventually TODO)
     238#
     239########################################################################################
     240sub getLastExpId {
     241
     242    my $lastExpId = `tail $logFile -n 1 | awk '{print \$2}'`;
     243    chomp($lastExpId);
     244    return $lastExpId;
     245}
     246
     247#######################################################################################
     248#
    248249# Gets the current jobId (ini file for now - will be Db eventually TODO)
    249250#
    250251########################################################################################
    251 sub getJobId {
     252sub getNewJobId {
    252253
    253254    my $jobId = -1;
     
    260261    close (MYFILE);
    261262
    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++;
    274264
    275265    open (MYFILE, "> $jobIdFilePath");
     
    277267    close (MYFILE);
    278268
    279     if ($verbose) { print "* New jobId = $jobId\n"; }
    280 }
    281 
    282 #######################################################################################
    283 #
    284 #run IppToPsps
     269    return $jobId;
     270}
     271
     272#######################################################################################
     273#
     274# run IppToPsps
    285275#
    286276#######################################################################################
Note: See TracChangeset for help on using the changeset viewer.