IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29094


Ignore:
Timestamp:
Sep 1, 2010, 1:14:42 PM (16 years ago)
Author:
rhenders
Message:

Added new BatchManager class to handle creation, delete etc of batches

Location:
trunk/ippToPsps/perl
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/perl/checkOdmStatus.pl

    r29093 r29094  
    55
    66use LWP::UserAgent;
    7 use IPC::Cmd 0.36 qw( can_run run );
    8 use IPC::Cmd 0.36 qw( can_run run );
    97use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    108use XML::LibXML;
     
    1210use ippToPsps::IppToPspsDb;
    1311use ippToPsps::Datastore;
     12use ippToPsps::BatchManager;
    1413
    1514my $singleBatch = undef;
     
    6160my $datastore = new ippToPsps::Datastore($product, 0, 0);
    6261my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps);
     62my $batchManager = new ippToPsps::BatchManager($ippToPspsDb, $filePath, $verbose, $save_temps);
    6363my $odmUrl = "http://web01.psps.ifa.hawaii.edu/a01/OdmWebService/OdmWebService.asmx/GetBatchStatus";
    6464my $ua = LWP::UserAgent->new;
     
    102102        $numBatchesToCheck++;
    103103
    104         my $batchName = getBatchName($batchId);
     104        my $batchName = $batchManager->getBatchName($batchId);
    105105
    106106        # if not merged then update by polling ODM for status
     
    119119            }
    120120        }
    121 
    122121        # if merged and already removed from datastore then delete files
    123122        if (defined $filePath && $merged && $deleted) {
    124123
    125             print "$command\n";
    126             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    127                 run(command => $command, verbose => $verbose);
    128             if (!$success) {print "* Unable to run: $command\n";}
    129             else {$numDeleted++;}
     124            if($batchManager->deleteBatch($batchId)) {$numDeleted++;}
    130125        }
    131126
     
    152147########################################################################################
    153148#
    154 # Returns batch name from batch_id TODO needs to be a batch class
    155 #
    156 ########################################################################################
    157 sub getBatchName {
    158     my ($batchId) = @_;
    159 
    160     return sprintf("B%08d", $batchId);
    161 }
    162 
    163 ########################################################################################
    164 #
    165149# Check a single batch
    166150#
Note: See TracChangeset for help on using the changeset viewer.