IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 20, 2010, 2:30:45 PM (16 years ago)
Author:
watersc1
Message:

Attempting to bring branch in sync with trunk

Location:
branches/czw_branch/20101203
Files:
5 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20101203

  • branches/czw_branch/20101203/ippToPsps/perl/checkOdmStatus.pl

    r29652 r30118  
    3939        );
    4040
     41if (@ARGV) {
     42    print "* UNKNKOWN: option                          @ARGV\n";
     43}
    4144if (!defined $product) {
    4245    print "* OPTIONAL: a datastore product name            -p <name>\n";
     
    159162        $numBatchesToCheck++;
    160163
    161         # if not merged then update by polling ODM for status
     164        # if not merged or failed load, then update by polling ODM for status
    162165        if (!$merged && !$loadFailed) {
    163 
    164166            if (checkODM($batch->getName(), \$loadedToOdm, \$loadFailed, \$mergeWorthy, \$merged)) {
    165167               
  • branches/czw_branch/20101203/ippToPsps/perl/ippToPsps/DetectionBatch.pm

    r29236 r30118  
    7878    # get neb path of smf file
    7979    my $nebPath = $self->{_gpc1Db}->getCameraStageSmfForThisDvoDb($self->{_dvoDb}, $self->{_expId});
    80     if (!$nebPath) { return 0; }
     80    if (!$nebPath) { return undef; }
    8181
    8282    # get real filename from neb 'key'
  • branches/czw_branch/20101203/ippToPsps/perl/ippToPsps/IppToPspsDb.pm

    r29345 r30118  
    1111###########################################################################
    1212#
    13 # Returns a list of batches that have been processed and loaded to datastore
     13# Returns a list of batches created within the provided dates
    1414#
    1515###########################################################################
     
    3939    $query->execute;
    4040    ${$batches} = $query->fetchall_arrayref();
    41     my $count = scalar @{${$batches}};
    42 
    43    return $count;
     41    return scalar @{${$batches}};
    4442}
    4543
     
    7270    $query->execute;
    7371    ${$batches} = $query->fetchall_arrayref();
    74     my $count = scalar @{${$batches}};
    75 
    76    return $count;
     72    return scalar @{${$batches}};
     73}
     74
     75###########################################################################
     76#
     77# Returns a count of all distinct exposures between provided limits
     78#
     79###########################################################################
     80sub countExposures {
     81    my ($self, $fromExp, $toExp, $datastoreProduct, $batchType, $dvoDb) = @_;
     82
     83    my $query = $self->{_db}->prepare(<<SQL);
     84    SELECT COUNT(distinct exp_id)
     85        FROM batches
     86        WHERE exp_id >= $fromExp
     87        AND exp_id <= $toExp
     88        AND dvo_db = '$dvoDb'
     89        AND batch_type = '$batchType'
     90        AND datastore_product = '$datastoreProduct'
     91SQL
     92
     93    $query->execute;
     94    return scalar $query->fetchrow_array();
     95}
     96
     97###########################################################################
     98#
     99# Returns a count of exposures (between provided limits) that have been merged
     100#
     101###########################################################################
     102sub countMergedExposures {
     103    my ($self, $fromExp, $toExp, $datastoreProduct, $batchType, $dvoDb) = @_;
     104
     105    my $query = $self->{_db}->prepare(<<SQL);
     106    SELECT COUNT(distinct exp_id)
     107        FROM batches
     108        WHERE exp_id >= $fromExp
     109        AND exp_id <= $toExp
     110        AND dvo_db = '$dvoDb'
     111        AND batch_type = '$batchType'
     112        AND datastore_product = '$datastoreProduct'
     113        AND merged
     114SQL
     115
     116    $query->execute;
     117    return scalar $query->fetchrow_array();
     118}
     119
     120###########################################################################
     121#
     122# Returns a list of exposures (between provided limits) that have not been merged
     123#
     124###########################################################################
     125sub getUnmergedExposures {
     126    my ($self, $exposures, $fromExp, $toExp, $datastoreProduct, $batchType, $dvoDb) = @_;
     127
     128    my $query = $self->{_db}->prepare(<<SQL);
     129    SELECT batch_id, exp_id
     130        FROM batches
     131        WHERE exp_id >= $fromExp
     132        AND exp_id <= $toExp
     133        AND dvo_db = '$dvoDb'
     134        AND batch_type = '$batchType'
     135        AND datastore_product = '$datastoreProduct'
     136        AND !merged
     137        GROUP BY exp_id
     138SQL
     139
     140    $query->execute;
     141    ${$exposures} = $query->fetchall_arrayref();
     142    return scalar @{${$exposures}};
    77143}
    78144
     
    166232#######################################################################################
    167233#
     234# Checks whether this exposure failed to load to the ODM
     235#
     236########################################################################################
     237sub didLoadFail {
     238    my ($self, $expId) = @_;
     239
     240    my $query = $self->{_db}->prepare(<<SQL);
     241    SELECT COUNT(*)
     242        FROM batches
     243        WHERE exp_id = $expId
     244        AND load_failed
     245SQL
     246
     247    $query->execute;
     248
     249    return scalar $query->fetchrow_array();
     250}
     251
     252#######################################################################################
     253#
     254# Checks whether this exposure has a min object ID under old PSPS hard limit of 72010000000000001
     255#
     256########################################################################################
     257sub isMinObjIdUnderLimit {
     258    my ($self, $expId) = @_;
     259
     260    my $query = $self->{_db}->prepare(<<SQL);
     261    SELECT COUNT(*)
     262        FROM batches
     263        WHERE exp_id = $expId
     264        AND min_obj_id < 72010000000000001
     265SQL
     266
     267    $query->execute;
     268
     269    return scalar $query->fetchrow_array();
     270}
     271#######################################################################################
     272#
     273# Checks whether this exposure has been processed
     274#
     275########################################################################################
     276sub isExposureProcessed {
     277    my ($self, $expId) = @_;
     278
     279    my $query = $self->{_db}->prepare(<<SQL);
     280    SELECT COUNT(*)
     281        FROM batches
     282        WHERE exp_id = $expId
     283        AND processed
     284SQL
     285
     286    $query->execute;
     287
     288    return scalar $query->fetchrow_array();
     289}
     290
     291#######################################################################################
     292#
     293# Checks whether this exposure has been merged
     294#
     295########################################################################################
     296sub isExposureMerged {
     297    my ($self, $expId) = @_;
     298
     299    my $query = $self->{_db}->prepare(<<SQL);
     300    SELECT COUNT(*)
     301        FROM batches
     302        WHERE exp_id = $expId
     303        AND merged
     304SQL
     305
     306    $query->execute;
     307
     308    return scalar $query->fetchrow_array();
     309}
     310
     311#######################################################################################
     312#
     313# Checks whether this exposure has been loaded to ODM
     314#
     315########################################################################################
     316sub isExposureLoadedToOdm {
     317    my ($self, $expId) = @_;
     318
     319    my $query = $self->{_db}->prepare(<<SQL);
     320    SELECT COUNT(*)
     321        FROM batches
     322        WHERE exp_id = $expId
     323        AND loaded_to_ODM
     324SQL
     325
     326    $query->execute;
     327
     328    return scalar $query->fetchrow_array();
     329}
     330
     331#######################################################################################
     332#
    168333# Checks whether we have successfully processed this exposure and loaded it to the datastore
    169334#
     
    184349    my $processed = $query->fetchrow_array();
    185350
     351    # TODO can use return scalar $query->fetchrow_array();
    186352    return $processed;
    187353}
  • branches/czw_branch/20101203/ippToPsps/perl/ippToPsps_run.pl

    r29089 r30118  
    1515use ippToPsps::IppToPspsDb;
    1616use ippToPsps::Datastore;
     17#use ippToPsps::BatchManager;
    1718
    1819# globals
     
    112113my $datastore = undef;
    113114if ($datastoreProduct) {$datastore = new ippToPsps::Datastore($datastoreProduct, $verbose, $save_temps);}
     115#my $batchManager = new ippToPsps::BatchManager($ippToPspsDb, $output, $verbose, $save_temps);
    114116
    115117# check we can run programs and get camera config
Note: See TracChangeset for help on using the changeset viewer.