Changeset 17549 for gsdl/trunk


Ignore:
Timestamp:
2008-10-15T19:53:39+13:00 (16 years ago)
Author:
ak19
Message:

Changes to sudden wget download termination when OAIDownload.pm is used: OAIDownload.pm launches wget several times, one after another (after each previous wget instance has terminated). Therefore when the STOP signal is sent from GLI, the OAIDownload.pm script should stop altogether and issue no more calls to wget. This is now accomplished by checking the new member variable self->force_quit which is set to true when WgetDownload receives a STOP signal from GLI.

Location:
gsdl/trunk/perllib/downloaders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/downloaders/OAIDownload.pm

    r17207 r17549  
    209209        return; 
    210210    }
     211    if ($self->{'forced_quit'}) {
     212    return $strIDs;
     213    }
    211214
    212215    print STDERR "<<Download Information>>\n";
     
    226229
    227230    $strIDs =  $self->useWget($cmdWget);
     231    if ($self->{'forced_quit'}) {
     232        return $accumulated_strIDs;
     233    }
    228234
    229235    $self->parse_xml($strIDs);
     
    330336
    331337        my ($stdout_and_err2,$error2,$follow2) =  $self->useWgetMonitored($wget_cmd2);
     338        return $strRecord if $self->{'forced_quit'};
    332339
    333340        if($error2 ne "")
     
    397404
    398405        my ($stdout_and_err,$errors,$follow) =  $self->useWgetMonitored($wget_cmd);
     406        return $strRecord if $self->{'forced_quit'};
    399407
    400408        if($errors ne "")
     
    411419    if (!$had_valid_url)
    412420    {
    413         print  STDERR "\tNo souce document URL is specified in the OAI record (No (dc:)?identifier is provided)\n";
     421        print  STDERR "\tNo source document URL is specified in the OAI record (No (dc:)?identifier is provided)\n";
    414422    }
    415423    }
    416424    else
    417425    {
    418     print  STDERR "\tNo souce document URL is specified in the OAI record (No metadata field is provided)\n";
     426    print  STDERR "\tNo source document URL is specified in the OAI record (No metadata field is provided)\n";
    419427    }
    420428
  • gsdl/trunk/perllib/downloaders/WgetDownload.pm

    r17547 r17549  
    9696sub abrupt_end_handler {
    9797    my $termination_signal = shift (@_);
     98
    9899    if(defined $childpid) {
    99100    close($chld_out);
     
    275276        if($signal eq "<<STOP>>") {
    276277            print $client "Perl received STOP signal (on port $port): stopping wget\n";
    277             $loop = 0;
     278            $loop = 0;                          # out of outer while loop
     279            $self->{'forced_quit'} = 1;         # subclasses need to know we're quitting
    278280           
    279281            # Sometimes the wget process takes some time to start up. If the STOP signal
     
    301303            }
    302304            }
    303             last; # we're done here
     305            last;                               # out of foreach loop
    304306        }
    305307        }
     
    423425        if($signal eq "<<STOP>>") {
    424426            print $client "Perl received STOP signal (on port $port): stopping wget\n";
    425             $loop = 0;
     427            $loop = 0;                          # out of outer while loop
     428            $self->{'forced_quit'} = 1;         # subclasses need to know we're quitting
    426429           
    427430            # Sometimes the wget process takes some time to start up. If the STOP signal
     
    449452            }
    450453            }
    451             last; # we're done here
     454            last;                               # out of foreach loop
    452455        }
    453456        }
Note: See TracChangeset for help on using the changeset viewer.