IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28084


Ignore:
Timestamp:
May 25, 2010, 8:42:34 AM (16 years ago)
Author:
rhenders
Message:

now remembering 'last' exposure ID and handling getting a new job ID better

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/scripts/ippToPsps_run.pl

    r28083 r28084  
    103103#######################################################################################
    104104sub process {
     105    my $lastExpId = getLastExpId();
     106
     107    print "* Last successfully processed exposure ID was $lastExpId\n";
    105108
    106109    # Set up the database
     
    126129            AND chipRun.exp_id = rawExp.exp_id
    127130            AND camRun.label LIKE '%$label%'
     131            AND rawExp.exp_id > $lastExpId
    128132            ORDER BY rawExp.exp_id ASC
    129133SQL
     
    143147    my $batchesPerJob = 1;
    144148
    145     # get a new jobId
    146     my $jobId = getJobId();
    147     if ($jobId < 0) { print "* Cannot find sensible jobId ($jobId)\n";
    148         return 0;
    149     }
    150 
    151149    print "*******************************************************************************\n*\n";
    152150
     
    157155
    158156    open (LOGFILE, ">> $logFile");
     157
     158    my $jobId = -1;
    159159
    160160    # loop round exposures
    161161    while (my @row = $query->fetchrow_array()) {
    162162        my ($expId, $distGroup) = @row;
    163         $jobId++;
    164         setJobId($jobId);
     163
     164        $jobId = getNewJobId();
    165165
    166166        print "* Exposure ID = $expId with dist group = '$distGroup' as job ID $jobId\n";
     
    238238#######################################################################################
    239239#
     240# Gets the last processed exposure ID (ini file for now - will be Db eventually TODO)
     241#
     242########################################################################################
     243sub getLastExpId {
     244
     245    return `tail $logFile -n 1 | awk '{print \$2}'`;
     246}
     247
     248#######################################################################################
     249#
    240250# Gets the current jobId (ini file for now - will be Db eventually TODO)
    241251#
    242252########################################################################################
    243 sub getJobId {
     253sub getNewJobId {
    244254
    245255    my $jobId = -1;
     
    253263
    254264    if ($verbose) { print "* Current jobId = $jobId\n"; }
    255 
    256     return $jobId;
    257 }
    258 
    259 #######################################################################################
    260 #
    261 # Sets the current jobId (in file for now - will be Db eventually TODO)
    262 #
    263 ########################################################################################
    264 sub setJobId {
    265     my ($jobId) = @_;
     265    $jobId++;
     266    if ($verbose) { print "* New jobId = $jobId\n"; }
    266267
    267268    open (MYFILE, "> $jobIdFilePath");
     
    269270    close (MYFILE);
    270271
    271     if ($verbose) { print "* New jobId = $jobId\n"; }
    272 }
    273 
    274 #######################################################################################
    275 #
    276 #run IppToPsps
     272    return $jobId;
     273}
     274
     275#######################################################################################
     276#
     277# run IppToPsps
    277278#
    278279#######################################################################################
Note: See TracChangeset for help on using the changeset viewer.