view release on metacpan or search on metacpan
lib/TAP/Parser/Iterator/Stream/Selectable.pm view on Meta::CPAN
=cut
$VERSION = '0.01';
sub _initialize {
my ( $self, $args ) = @_;
unless ( $args->{handle} ) {
die "handle argument must be specified.\n";
}
my $chunk_size = delete $args->{_chunk_size} || 65536;
return unless ( $self->SUPER::_initialize( $args->{handle} ) );
$self->{out} = $args->{handle};
$self->{err} = $args->{handle};
$self->{sel} = IO::Select->new( $args->{handle} );
$self->{pid} = '';
$self->{exit} = undef;
$self->{chunk_size} = $chunk_size;
return $self;
}
=head3 C<get_select_handles>
lib/TAP/Parser/Iterator/Worker.pm view on Meta::CPAN
$self->{tear_down} = $args->{tear_down};
$self->{error_log} = $args->{error_log};
$self->{switches} = $args->{switches};
$self->{detach} = $args->{detach};
$self->{test_args} = $args->{test_args};
$self->{sync_type} = $args->{sync_type};
$self->{source_dir} = $args->{source_dir};
$self->{destination_dir} = $args->{destination_dir};
return
unless (
$self->SUPER::_initialize(
{ command => [ $self->initialize_worker_command->[0] ] }
)
);
return $self;
}
=head3 C<initialize_worker_command>
Initialize the command to be used to initialize worker.
lib/TAP/Parser/Iterator/Worker/LSF.pm view on Meta::CPAN
use TAP::Parser::Iterator::Worker ();
use vars qw($VERSION @ISA);
@ISA = 'TAP::Parser::Iterator::Worker';
# new() implementation supplied by TAP::Object
sub _initialize {
my ( $self, $args ) = @_;
$self->SUPER::_initialize($args);
my $out = $self->{out};
my $lsf_job_info = <$out>;
if ( $lsf_job_info && $lsf_job_info =~ /Job <(\d+)>/ ) {
$self->{lsf_job_id} = $1;
}
else {
print STDERR "failed to start an LSF job.\n";
return;
}
return $self;
lib/TAP/Parser/Iterator/Worker/LSF.pm view on Meta::CPAN
=head3 C<initialize_worker_command>
Initialize the command to be used to initialize worker.
For your specific command, you can subclass this to put your command in this method.
=cut
sub initialize_worker_command {
my $self = shift;
my $commands = $self->SUPER::initialize_worker_command;
$commands->[0] = 'bsub ' . $commands->[0];
return $commands;
}
1;
__END__
##############################################################################
lib/TAP/Parser/Iterator/Worker/SSH.pm view on Meta::CPAN
The ssh to the specified hosts must be able
to be ssh to by the user without authenticate
by password.
=cut
# new() implementation supplied by TAP::Object
sub _initialize {
my ( $self, $args ) = @_;
$self->SUPER::_initialize($args);
=cut
my $out = $self->{out};
my $pid = <$out>;
if ( $pid ) {
$self->{ssh_pid} = $pid;
}
else {
print STDERR "failed to start an SSH job.\n";
return;
lib/TAP/Parser/Iterator/Worker/SSH.pm view on Meta::CPAN
=head3 C<initialize_worker_command>
Initialize the command to be used to initialize worker.
For your specific command, you can subclass this to put your command in this method.
=cut
sub initialize_worker_command {
my $self = shift;
my $commands = $self->SUPER::initialize_worker_command;
my $hostname = TAP::Parser::SourceHandler::Worker::SSH->get_next_host();
my $cwd = File::Spec->rel2abs('.');
my $escaped_command = "cd $cwd;" . $commands->[0];
$escaped_command =~ s/'/'"'"'/g;
$commands->[0] = "ssh $hostname '" . $escaped_command . "'";
$self->{host} = $hostname;
return $commands;
}
lib/TAP/Parser/SourceHandler/Worker/LSF.pm view on Meta::CPAN
my @active_workers = $class->get_active_workers;
Returns list of active workers.
=cut
sub get_active_workers {
my $class = shift;
my @workers = $class->SUPER::get_active_workers;
return unless (@workers);
my @active;
for my $worker (@workers) {
if ( $worker->{lsf_job_id} ) {
my @info = `bjobs $worker->{lsf_job_id}`;
unless ( $info[1] && $info[1] =~ /\s+(RUN|PEND)\s+/ ) {
$worker = undef;
next;
}
lib/TAP/Parser/SourceHandler/Worker/PBS.pm view on Meta::CPAN
my @active_workers = $class->get_active_workers;
Returns list of active workers.
=cut
sub get_active_workers {
my $class = shift;
my @workers = $class->SUPER::get_active_workers;
return unless (@workers);
my @active;
for my $worker (@workers) {
if ( $worker->{pbs_job_id} ) {
my @info = `qstat $worker->{pbs_job_id}`;
unless ( $info[2] && $info[2] =~ /\s+(Q|R)\s+/ ) {
$worker = undef;
next;
}
lib/TAP/Parser/SourceHandler/Worker/PBS.pm view on Meta::CPAN
my @active_workers = $class->load_options($app_prove_object, \@ARGV);
Returns boolean.
=cut
sub load_options {
my $class = shift;
my ( $app, $args ) = @_;
croak 'parent failed to load options.' unless($class->SUPER::load_options(@_));
{
local @ARGV = @$args;
Getopt::Long::Configure(qw(no_ignore_case bundling pass_through));
my %options;
for my $arg (
qw(server
wd name script tracer host nodes ppn account
partition queue begint ofile efile tfile pri mem pmem vmem pvmem cput
pcput wallt nice pbsid cmd prev next depend stagein stageout vars
shell maillist mailopt)
lib/TAP/Parser/SourceHandler/Worker/SSH.pm view on Meta::CPAN
my @active_workers = $class->get_active_workers;
Returns list of active workers.
=cut
sub get_active_workers {
my $class = shift;
my @workers = $class->SUPER::get_active_workers;
return unless (@workers);
my @active;
require Net::Ping;
my $ping = Net::Ping->new();
for my $worker (@workers) {
if ( $worker->{host} ) {
my $status = $ping->ping( $worker->{host} );
unless ($status) {
$worker = undef;
lib/TAP/Parser/SourceHandler/Worker/SSH.pm view on Meta::CPAN
my @active_workers = $class->load_options($app_prove_object, \@ARGV);
Returns boolean.
=cut
sub load_options {
my $class = shift;
my ( $app, $args ) = @_;
croak 'parent failed to load options.' unless($class->SUPER::load_options(@_));
{
local @ARGV = @$args;
Getopt::Long::Configure(qw(no_ignore_case bundling pass_through));
# Don't add coderefs to GetOptions
GetOptions( 'hosts=s' => \$app->{hosts}, )
or croak('Unable to continue');
@hosts = split /,/, $app->{hosts} if ( $app->{hosts} );
unless (@hosts) {
croak(