IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2010, 3:55:49 PM (16 years ago)
Author:
eugene
Message:

update merges from trunk

Location:
branches/eam_branches/20100225
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20100225

  • branches/eam_branches/20100225/pstamp/scripts/pstamp_queue_requests.pl

    r24831 r27517  
    1919my $dbserver;
    2020my $limit;
     21my $timeout = 10;
    2122
    2223GetOptions(
     24    'timeout=i'     =>  \$timeout,
    2325    'verbose'       =>  \$verbose,
    2426    'dbname=s'      =>  \$dbname,
     
    6971
    7072my @dataStores;
    71 #Look up the list of data stores to monitor
     73#Look up the list of data stores that are ready to be queried
    7274{
    73     my $command = "$pstamptool -datastore";
     75    my $command = "$pstamptool -datastore -ready";
    7476    $command .= " -dbname $dbname" if $dbname;
    7577    $command .= " -dbserver $dbserver" if $dbserver;
     
    8385
    8486    if (@$stdout_buf == 0) {
    85         print STDERR "no data stores registered\n" if $verbose;
     87        print STDERR "no data stores ready\n" if $verbose;
    8688        exit 0;
    8789    }
     
    111113    my $outProduct = $ds->{outProduct};
    112114    my $ds_id = $ds->{ds_id};
     115    my $ds_label = $ds->{label};
     116    $ds_label = undef if $ds_label eq "NULL";
    113117    my @lines;
    114118    {
    115119        my $command = "$dsproductls --uri $ds->{uri}/index.txt";
    116120        $command .= " --last_fileset $ds->{lastFileset}" if $ds->{lastFileset};
     121        $command .= " --timeout $timeout";
    117122
    118123        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    124129            # don't die on "common faults"
    125130            # 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
     131            if (($exit_status == 200) or ($exit_status == 104)) {
     132                ## now update the last_fileset column in pstampDataStore
     133                update_ds_timestamp($ds_id, $dbname, $dbserver);
     134                next;
     135            }
     136
    129137
    130138            die("Unable to perform $command: $error_code");
     
    133141        if (@$stdout_buf == 0) {
    134142            print STDERR "no new request files in data store $ds_id\n" if $verbose;
     143            update_ds_timestamp($ds_id, $dbname, $dbserver);
    135144            next; # next data store
    136145        }
     
    184193            {
    185194                my $command = "$pstamptool -addreq -uri $req_uri -ds_id $ds_id";
     195                $command .= " -label $ds_label" if $ds_label;
    186196                $command .= " -dbname $dbname" if $dbname;
    187197                $command .= " -dbserver $dbserver" if $dbserver;
     
    199209        {
    200210        ## now update the last_fileset column in pstampDataStore
    201         my $command = "$pstamptool -ds_id $ds_id -moddatastore -last_fileset $lastFileset";
     211        my $command = "$pstamptool -ds_id $ds_id -moddatastore -set_last_fileset $lastFileset";
    202212        $command .= " -dbname $dbname" if $dbname;
    203213        $command .= " -dbserver $dbserver" if $dbserver;
     
    213223
    214224exit 0;
     225
     226sub update_ds_timestamp {
     227    my $ds_id = shift;
     228    my $dbname = shift;
     229    my $dbserver = shift;
     230
     231    my $command = "$pstamptool -ds_id $ds_id -moddatastore -update_timestamp";
     232                $command .= " -dbname $dbname" if $dbname;
     233                $command .= " -dbserver $dbserver" if $dbserver;
     234    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     235        run(command => $command, verbose => $verbose);
     236    unless ($success) {
     237        die("Unable to perform pstamptool -moddatastore: $error_code");
     238    }
     239}
Note: See TracChangeset for help on using the changeset viewer.