IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 4, 2008, 4:48:11 PM (18 years ago)
Author:
bills
Message:

Query newImfile instead of rawImfile to reduce latency for 'real time'
iq analysis. Old behavior can be requested with --registered.
Also allow ota33 style values for class_id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/ipp_image_path.pl

    r17862 r17928  
    1919use Pod::Usage qw( pod2usage );
    2020
    21 my ($exp_name, $class_id, $dbname, $verbose);
     21my ($exp_name, $class_id, $from_registered, $dbname, $verbose);
    2222
    2323GetOptions(
    2424    'exp_name|e=s'  => \$exp_name,
    2525    'class_id|c=s'  => \$class_id,
     26    'registered|r'  => \$from_registered,
    2627    'dbname|d=s'    => \$dbname, # Database name   
    2728    'verbose'       => \$verbose,   # Print to stdout
     
    3334    defined $exp_name;
    3435
     36my $ota_num;
    3537if ($class_id) {
    3638    $class_id = lc($class_id);
     39    my $extra;
     40    (undef, $ota_num, $extra) = $class_id =~ m/(\D*)(\d\d)(.*)/;
     41    if ($extra || !$ota_num) {
     42        print STDERR "$class_id is not a valid class_id\n";
     43        exit 1;
     44    }
    3745}
    3846
     
    5462    # XXX: If there are multiple exposures with the same exposure name
    5563    # this query will return them all
    56     my $query = "SELECT exp_id, class_id, uri FROM rawImfile"
     64    my $query;
     65    if ($from_registered) {
     66        $query = "SELECT exp_id, class_id, uri FROM rawImfile"
    5767                . " WHERE exp_name = \'$exp_name\'";
    58     if ($class_id) {
    59         $query .= " AND class_id = \'$class_id\'";
     68        $query .= " AND class_id = \'xy$ota_num\'" if ($ota_num);
     69    } else {
     70        $query = "SELECT exp_id FROM newExp WHERE tmp_exp_name = ?";
     71        my $stmt = $dbh->prepare($query);
     72        $stmt->execute($exp_name);
     73        my $exp_ref = $stmt->fetchrow_hashref();
     74        if (!$exp_ref) {
     75            print STDERR "exposure $exp_name not found\n";
     76            exit 1;
     77        }
     78        $stmt->finish();
     79        $query = "SELECT exp_id, tmp_class_id, uri FROM newImfile WHERE exp_id = $exp_ref->{exp_id}";
     80        $query .= " AND tmp_class_id = \'ota$ota_num\'" if ($ota_num);
    6081    }
    6182
Note: See TracChangeset for help on using the changeset viewer.