IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 3, 2010, 4:37:28 PM (16 years ago)
Author:
bills
Message:

Add timestamp and poll interval to pstampDataStore. Don't poll for new
requests at each data store unless the time since the last poll is greater
than the requested interval
Add label to pstampDataStore. Use it to set label for requests.
Support -label in the query modes of pstamptool.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstamp_queue_requests.pl

    r24831 r27172  
    8383
    8484    if (@$stdout_buf == 0) {
    85         print STDERR "no data stores registered\n" if $verbose;
     85        print STDERR "no data stores ready\n" if $verbose;
    8686        exit 0;
    8787    }
     
    111111    my $outProduct = $ds->{outProduct};
    112112    my $ds_id = $ds->{ds_id};
     113    my $ds_label = $ds->{label};
     114    $ds_label = undef if $ds_label eq "NULL";
    113115    my @lines;
    114116    {
     
    124126            # don't die on "common faults"
    125127            # perhaps after some number of these we should mark the data store as disabled
    126             next if ($exit_status == 200);  # 500 cannot connect (data store down)
    127             next if ($exit_status == 104);  # 404 not found
    128 #            next if ($exit_status == 100);  # 400 bad request
     128            if (($exit_status == 200) or ($exit_status == 104)) {
     129                ## now update the last_fileset column in pstampDataStore
     130                update_ds_timestamp($ds_id, $dbname, $dbserver);
     131                next;
     132            }
     133
    129134
    130135            die("Unable to perform $command: $error_code");
     
    133138        if (@$stdout_buf == 0) {
    134139            print STDERR "no new request files in data store $ds_id\n" if $verbose;
     140            update_ds_timestamp($ds_id, $dbname, $dbserver);
    135141            next; # next data store
    136142        }
     
    184190            {
    185191                my $command = "$pstamptool -addreq -uri $req_uri -ds_id $ds_id";
     192                $command .= " -label $ds_label" if $ds_label;
    186193                $command .= " -dbname $dbname" if $dbname;
    187194                $command .= " -dbserver $dbserver" if $dbserver;
     
    199206        {
    200207        ## now update the last_fileset column in pstampDataStore
    201         my $command = "$pstamptool -ds_id $ds_id -moddatastore -last_fileset $lastFileset";
     208        my $command = "$pstamptool -ds_id $ds_id -moddatastore -set_last_fileset $lastFileset";
    202209        $command .= " -dbname $dbname" if $dbname;
    203210        $command .= " -dbserver $dbserver" if $dbserver;
     
    213220
    214221exit 0;
     222
     223sub update_ds_timestamp {
     224    my $ds_id = shift;
     225    my $dbname = shift;
     226    my $dbserver = shift;
     227
     228    my $command = "$pstamptool -ds_id $ds_id -moddatastore -update_timestamp";
     229                $command .= " -dbname $dbname" if $dbname;
     230                $command .= " -dbserver $dbserver" if $dbserver;
     231    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     232        run(command => $command, verbose => $verbose);
     233    unless ($success) {
     234        die("Unable to perform pstamptool -moddatastore: $error_code");
     235    }
     236}
Note: See TracChangeset for help on using the changeset viewer.