Parallel-Runner-0.013000755001750001750 012142115476 15044 5ustar00exodistexodist000000000000Parallel-Runner-0.013/META.yml000444001750001750 150612142115476 16454 0ustar00exodistexodist000000000000--- abstract: 'An object to manage running things in parallel processes.' author: - 'Chad Granum ' build_requires: Test::Exception::LessClever: 0 Test::More: 0 configure_requires: Module::Build: 0.40 dynamic_config: 1 generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.120630' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Parallel-Runner provides: Parallel::Runner: file: lib/Parallel/Runner.pm version: 0.013 requires: Child: 0.009 POSIX: 0 Time::HiRes: 0 resources: bugtracker: http://github.com/exodist/Parallel-Runner/issues homepage: http://open-exodus.net/projects/parrallel-runner license: http://dev.perl.org/licenses/ repository: http://github.com/exodist/Parallel-Runner version: 0.013 Parallel-Runner-0.013/README000444001750001750 1613412142115476 16106 0ustar00exodistexodist000000000000NAME Parallel::Runner - An object to manage running things in parallel processes. DESCRIPTION There are several other modules to do this, you probably want one of them. This module exists as a super specialised parallel task manager. You create the object with a proces limit and callbacks for what to do while waiting for a free process slot, as well as a callback for what a process shoudl do just before exiting. You must explicetly call $runner->finish() when you are done. If the runner is destroyed before it's children are finished a warning will be generated and your child processes will be killed, by force if necessary. If you specify a maximum of 1 then no forking will occur, and run() will block until the coderef returns. You can force a fork by providing a boolean true value as the second argument to run(), this will force the runner to fork before running the coderef, however run() will still block until it the child exits. SYNOPSYS #!/usr/bin/perl use strict; use warnings; use Parallel::Runner; my $runner = Parallel::Runner->new(4); $runner->run( sub { ... } ); $runner->run( sub { ... } ); $runner->run( sub { ... } ); $runner->run( sub { ... } ); # This will block until one of the previous 4 finishes $runner->run( sub { ... } ); # Do not forget this. $runner->finish; CONSTRUCTOR $runner = $class->new( $max, $accessor => $value, ... ); Create a new instance of Parallel::Runner. $accessor can be anything listed under the ACCESSORS section. $max should be the maximum number of processes allowed, defaults to 1. ACCESSORS These are simple accessors, provididng an argument sets the accessor to that argument, no argument it simply returns the current value. $val = $runner->data_callback( \&callback ) If this is specified than IPC will be automatically enabled, and the final return from each process will be passed into this handler in the main process. Due to the way IPC works only strings/numerical data is passed, if you need to pass a ref you will need to serialize it yourself before returning it, followed by deserializing it in your callback. Example: # Place to put the accumulated data my @accum_data; # Create the runner with a callback that pushes the data onto our array. $runner = $CLASS->new( 2, data_callback => sub { my ($data) = @_; push @accum_data => $data; }, ); # 4 processes that return data $runner->run( sub { return "foo" }); $runner->run( sub { return "bar" }); $runner->run( sub { return "baz" }); $runner->run( sub { return "bat" }); $runner->finish; # Verify the data (order is not predictable) is_deeply( [ sort @accum_data ], [ sort qw/foo bar baz bat/ ], "Got all data returned by subprocesses" ); $val = $runner->exit_callback( \&callback ) Codref to call just before a child exits (called within child) $val = $runner->iteration_delay( $float ); How long to wait per iterate if nothing has changed. $val = $runner->iteration_callback( $newval ) Coderef to call multiple times in a loop while run() is blocking waiting for a process slot. $val = $runner->reap_callback( $newval ) Codref to call whenever a pid is reaped using waitpid. The callback sub will be passed 3 values The first is the exit status of the child process. The second is the pid of the child process. The third used to be the return of waitpid, but this is depricated as Child is now used and throws an exception when waitpid is not what it should be. The third is simply the pid of the child process again. The final argument is the child process object itself. $runner->reap_callback( sub { my ( $status, $pid, $pid_again, $proc ) = @_; # Status as returned from system, so 0 is good, 1+ is bad. die "Child $pid did not exit 0" if $status; }); @children = $runner->children( @append ) Returns a list of Child::Link::Proc objects. $val = $runner->pid() pid of the parent process $val = $runner->max( $newval ) Maximum number of children OBJECT METHODS run( $code ) run( $code, $force_fork ) Run the specified code in a child process. Blocks if no free slots are available. Force fork can be used to force a fork when max is 1, however it will still block until the child exits. finish() finish( $timeout ) finish( $timeout, $timeoutcallback ) Wait for all children to finish, then clean up after them. If a timeout is specified it will return after the timeout regardless of wether or not children have all exited. If there is a timeout call back then that code will be run upon timeout just before the method returns. NOTE: DO NOT LET YOUR RUNNER BE DESTROYED BEFORE FINISH COMPLETES WITHOUT A TIMEOUT. the runner will kill all children, possibly with force if your runner is destroyed with children still running, or not waited on. killall( $sig ) Send all children the specified kill signal. DESTROY() Automagically called when the object is destroyed. If called while children are running it will forcefully clean up after you as follows: 1) Sends an ugly warning. 2) Will first give all your children 1 second to complete. Windows) Strawberry fails with processes, so on windows DESTROY will wait as long as needed, possibly forever. 3) Sends kill signal 15 to all children then waits up to 4 seconds. 4) Sends kill signal 9 to any remaining children then waits up to 10 seconds 5) Gives up and returns FENNEC PROJECT This module is part of the Fennec project. See Fennec for more details. Fennec is a project to develop an extendable and powerful testing framework. Together the tools that make up the Fennec framework provide a potent testing environment. The tools provided by Fennec are also useful on their own. Sometimes a tool created for Fennec is useful outside the greator framework. Such tools are turned into their own projects. This is one such project. Fennec - The core framework The primary Fennec project that ties them all together. AUTHORS Chad Granum exodist7@gmail.com COPYRIGHT Copyright (C) 2010 Chad Granum Parallel-Runner is free software; Standard perl licence. Parallel-Runner is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. Parallel-Runner-0.013/META.json000444001750001750 260212142115476 16622 0ustar00exodistexodist000000000000{ "abstract" : "An object to manage running things in parallel processes.", "author" : [ "Chad Granum " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.120630", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Parallel-Runner", "prereqs" : { "build" : { "requires" : { "Test::Exception::LessClever" : "0", "Test::More" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0.40" } }, "runtime" : { "requires" : { "Child" : "0.009", "POSIX" : "0", "Time::HiRes" : "0" } } }, "provides" : { "Parallel::Runner" : { "file" : "lib/Parallel/Runner.pm", "version" : "0.013" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://github.com/exodist/Parallel-Runner/issues" }, "homepage" : "http://open-exodus.net/projects/parrallel-runner", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/exodist/Parallel-Runner" } }, "version" : "0.013" } Parallel-Runner-0.013/CHANGES000444001750001750 4712142115476 16135 0ustar00exodistexodist000000000000v0.013 * Fixed force_fork on max == 1 Parallel-Runner-0.013/MANIFEST000444001750001750 21012142115476 16303 0ustar00exodistexodist000000000000Build.PL CHANGES lib/Parallel/Runner.pm MANIFEST This list of files META.json META.yml README t/Destruction.t t/Runner.t t/Timeouts.t Parallel-Runner-0.013/Build.PL000444001750001750 141112142115476 16472 0ustar00exodistexodist000000000000#!/usr/bin/perl use strict; use warnings; use Module::Build; my $build = Module::Build->new( module_name => 'Parallel::Runner', license => 'perl', dist_author => 'Chad Granum ', create_readme => 1, requires => { 'Time::HiRes' => 0, 'POSIX' => 0, 'Child' => '0.009' }, build_requires => { 'Test::More' => 0, 'Test::Exception::LessClever' => 0, }, meta_merge => { resources => { repository => 'http://github.com/exodist/Parallel-Runner', bugtracker => 'http://github.com/exodist/Parallel-Runner/issues', homepage => 'http://open-exodus.net/projects/parrallel-runner' }, } ); $build->create_build_script; Parallel-Runner-0.013/t000755001750001750 012142115476 15307 5ustar00exodistexodist000000000000Parallel-Runner-0.013/t/Destruction.t000444001750001750 471612142115476 20144 0ustar00exodistexodist000000000000#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::Exception::LessClever; use Child qw/child/; my $CLASS = 'Parallel::Runner'; use_ok( $CLASS ); my $one = $CLASS->new(2); $one->_children([child { sleep 10 }]); # Test::Warn does not handle multi-line warnings properly # https://rt.cpan.org/Public/Bug/Display.html?id=25427 { my @warn; local $SIG{__WARN__} = sub { push @warn => @_ }; $one = undef; ok( @warn, "Got a warning" ); is( $warn[0], < @_ }; $one = $CLASS->new(2); $one->run( sub { sleep 30 }); $one = undef; sleep 10; } "Did not kill self"; } SKIP: { skip ( "Kill tests are only run when \$ENV{RUN_KILL_TESTS} is set", 5 ) unless $ENV{'RUN_KILL_TESTS'}; $one = $CLASS->new(3); $one->run( sub { sleep 30 }); $one->run( sub { sleep 30 }); lives_ok { my @warn; local $SIG{__WARN__} = sub { push @warn => @_ }; local $SIG{ALRM} = sub { die( 'alarm' )}; alarm 10; $one->killall(15, 1); $one->finish; alarm 0; like( $warn[0], qr/\d+ - Killing: /, "Warn for first pid" ); like( $warn[1], qr/\d+ - Killing: /, "Warn for second pid" ); } "Killed, no timeout"; { my @warn; local $SIG{__WARN__} = sub { push @warn => @_ }; $one = $CLASS->new(2); $one->run( sub { local $SIG{TERM} = sub { sleep 30 }; sleep 30; }); $one = undef; sleep 8; my ( $siga, $sigb ) = map { s/\s+.*//s; $_ } @warn[-2,-1]; my $diff = $sigb - $siga; ok( $diff > 3, "First signal sent after delay" ); ok( $diff < 8, "Second signal sent before too long" ); }; { my @warn; local $SIG{__WARN__} = sub { push @warn => @_ }; my $one = $CLASS->new(3); $one = undef; ok( !@warn, "No warnings for out of scope w/o tasks" ); } }; lives_ok { my $one = $CLASS->new(); $one->_children(undef); $one = undef; } "Handles empty pids accessor"; done_testing; Parallel-Runner-0.013/t/Runner.t000444001750001750 642712142115476 17113 0ustar00exodistexodist000000000000#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::Exception::LessClever; my $CLASS = 'Parallel::Runner'; use_ok($CLASS); can_ok( $CLASS, qw/new exit_callback iteration_callback children _children pid max/ ); ok( my $one = $CLASS->new, "Created one" ); $one->reap_callback( sub { my ( $status, $pid, $pid_again, $proc ) = @_; ok( !$status, "Child exited cleanly" ); } ); isa_ok( $one, $CLASS ); is( $one->max, 1, "got max" ); is( $one->pid, $$, "Stored pid" ); is_deeply( $one, { iteration_delay => 0.1, max => 1, pid => $$, _children => [], reap_callback => $one->reap_callback, }, "Built properly" ); my $parent_pid = $$; $one->run( sub { if ( $$ == $parent_pid ) { warn "Did not fork!"; exit(1); } else { diag "Forked as expected"; } }, 'force_fork', ); $one->finish; throws_ok { my $one = $CLASS->new(2); $one->pid(0.5); $one->run( sub { 1 } ); } qr/Called run\(\) in child process/, "Do not run in fork"; my $ran = 0; my $iter_callback = sub { $ran++ }; my $reap_callback = sub { my ( $exit, $pid, $ret ) = @_; ok( !$exit, "Exited 0" ); is( $pid, $ret, "Return pid, not -1 or 0" ); }; $one = $CLASS->new( 2, iteration_callback => $iter_callback, reap_callback => $reap_callback, pipe => 1, ); is( $one->iteration_callback, $iter_callback, "Stored iter callback" ); is( $one->reap_callback, $reap_callback, "Stored reap callback" ); is( $one->pipe, 1, "Spawn with pipes" ); $one->run( sub { sleep 5 } ); $one->run( sub { sleep 5 } ); ok( !$ran, "No waiting yet" ); $one->run( sub { 1 } ); ok( $ran > 20, "Iterated while waiting" ); $one->finish; $ran = 0; $one->max(1); ok( !$ran, "No waiting yet" ); $one->run( sub { sleep 5 }, 1 ); ok( $ran > 20, "Iterated while waiting" ); $one->finish; my ( $read, $write ); unless ( pipe( $read, $write ) ) { skip "Pipe not available: $!", 1; done_testing; exit; } my $ecallback = sub { print $write "ran\n" }; $one = $CLASS->new( 2, exit_callback => $ecallback, reap_callback => $reap_callback, ); $one->run( sub { 1 } ); $one->finish; my $data; lives_ok { local $SIG{ALRM} = sub { die('alarm') }; alarm 5; $data = <$read>; alarm 0; } "read from pipe"; is( $data, "ran\n", "exit callback ran" ); my @accum_data; $one = $CLASS->new( 2, data_callback => sub { my ($data) = @_; push @accum_data => $data; }, ); $one->run( sub { return "foo" } ); $one->run( sub { return "bar" } ); $one->run( sub { return "baz" } ); $one->run( sub { return "bat" } ); $one->finish; is_deeply( [sort @accum_data], [sort qw/foo bar baz bat/], "Got all data returned by subprocesses" ); @accum_data = (); $one = $CLASS->new( 0, data_callback => sub { my ($data) = @_; push @accum_data => $data; }, ); $one->run( sub { return "foo" } ); $one->run( sub { return "bar" } ); $one->run( sub { return "baz" } ); $one->run( sub { return "bat" } ); $one->finish; is_deeply( [sort @accum_data], [sort qw/foo bar baz bat/], "Got all data returned when not forking" ); done_testing; Parallel-Runner-0.013/t/Timeouts.t000444001750001750 514412142115476 17446 0ustar00exodistexodist000000000000#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::Exception::LessClever; use Child qw/child/; sub timed_fork { my ( $count ) = @_; my $pid = fork; return $pid if $pid; sleep $count; exit; } my $CLASS = 'Parallel::Runner'; use_ok( $CLASS ); ok( my $one = $CLASS->new( 1 ), "Created one" ); isa_ok( $one, $CLASS ); my $fast_child = child {}; ok( $fast_child, "Created a fast child" ); $one->children($fast_child); lives_ok { local $SIG{ ALRM } = sub { die("fast child took too long")}; alarm 5; $one->finish; alarm 0; } "reaping"; $one->max(2); $one->children(child { sleep 10 }); $one->children(child { sleep 10 }); throws_ok { local $SIG{ ALRM } = sub { die("alarm")}; alarm 5; $one->run( sub { 1 }); alarm 0; } qr/alarm/, "Timed out"; $one->children(child { sleep 10 }); $one->children(child { sleep 10 }); lives_and { local $SIG{ ALRM } = sub { die("alarm")}; alarm 20; my $start = time; $one->run( sub { 1 }); ok( time - $start > 3, "was blocking" ); alarm 0; } "Subprocess did not exit"; $one->finish; $one->max(3); lives_ok { local $SIG{ ALRM } = sub { die("alarm")}; alarm 5; $one->run( sub { sleep 15 } ); $one->run( sub { sleep 15 } ); $one->run( sub { sleep 15 } ); alarm 0; } "3 processes w/o waiting" || diag $@; throws_ok { local $SIG{ ALRM } = sub { die("alarm")}; alarm 5; $one->run( sub { sleep 1 }); alarm 0 } qr/alarm/, "Blocked"; lives_and { local $SIG{ ALRM } = sub { die("alarm")}; alarm 30; my $start = time; $one->run( sub { sleep 1 }); ok( 1, "Eventually ran" ); ok( time - $start > 5, "Blocked a while" ); alarm 0 } "Blocked"; $one->finish; $one->max(1); lives_and { local $SIG{ ALRM } = sub { die("alarm")}; alarm 5; $one->run( sub { 1 }); alarm 0; ok( 1, "Not blocked" ); } "Not blocked"; my $temp; throws_ok { local $SIG{ ALRM } = sub { die("alarm")}; alarm 5; $one->run( sub { $temp = 'inside'; sleep 10 }); alarm 0; } qr/alarm/, "Run w/o fork"; ok( ! $one->children, "no new pids" ); is( $temp, 'inside', "Ran, but did not fork" ); $one->finish; $temp = 'fork'; throws_ok { local $SIG{ ALRM } = sub { die("alarm")}; alarm 5; $one->run( sub { $temp = 'no fork'; sleep 10 }, 1 ); alarm 0; } qr/alarm/, "fork but wait"; is( $temp, 'fork', "Forked" ); $one->finish; lives_and { local $SIG{ ALRM } = sub { die("alarm")}; alarm 15; my $start = time; $one->run( sub { sleep 7 }, 1 ); ok( time - $start > 4, "fork finished" ); alarm 0; } "fork finished"; $one->finish; done_testing; Parallel-Runner-0.013/lib000755001750001750 012142115476 15612 5ustar00exodistexodist000000000000Parallel-Runner-0.013/lib/Parallel000755001750001750 012142115476 17346 5ustar00exodistexodist000000000000Parallel-Runner-0.013/lib/Parallel/Runner.pm000444001750001750 2441412142115476 21337 0ustar00exodistexodist000000000000package Parallel::Runner; use strict; use warnings; use POSIX (); use Time::HiRes qw/sleep/; use Carp; use Child qw/child/; our $VERSION = '0.013'; for my $accessor (qw/ exit_callback data_callback iteration_callback _children pid max iteration_delay reap_callback pipe/) { my $sub = sub { my $self = shift; ( $self->{$accessor} ) = @_ if @_; return $self->{$accessor}; }; no strict 'refs'; *$accessor = $sub; } sub children { my $self = shift; my @active; for my $proc ( @{$self->_children || []}, @_ ) { if ( defined $proc->exit_status ) { if ( $self->data_callback ) { my $data = $proc->read(); $self->data_callback->($data); } $self->reap_callback->( $proc->exit_status, $proc->pid, $proc->pid, $proc ) if $self->reap_callback; next; } push @active => $proc; } $self->_children( \@active ); return @active; } sub new { my $class = shift; my ($max) = shift; return bless( { _children => [], pid => $$, max => $max || 1, iteration_delay => 0.1, @_, }, $class ); } sub run { my $self = shift; my ( $code, $force_fork ) = @_; croak("Called run() in child process") unless $self->pid == $$; my $fork = $force_fork || $self->max > 1; return $self->_fork($code) if $fork; my ($data) = $code->(); $self->data_callback->($data) if $self->data_callback; return; } sub _fork { my $self = shift; my ($code) = @_; # Wait for a slot $self->_iterate( sub { $self->children >= $self->max; } ); my $proc = Child->new( sub { my $parent = shift; $self->_children( [] ); my @return = $code->($parent); $self->exit_callback->(@return) if $self->exit_callback; $parent->write( $return[0] ) if $self->data_callback; }, $self->pipe || $self->data_callback ? ( pipe => $self->pipe ) : () )->start(); $self->_iterate( sub { !defined $proc->exit_status } ) if $self->max == 1; $self->children($proc); return $proc; } sub finish { my $self = shift; $self->_iterate( sub { $self->children }, @_ ); } sub _iterate { my $self = shift; my ( $condition, $timeout, $timeoutsub ) = @_; my $counter = 0; while ( $condition->() ) { $self->iteration_callback->($self) if $self->iteration_callback; $counter += $self->iteration_delay; last if $timeout and $counter >= $timeout; sleep $self->iteration_delay; } $timeoutsub->() if $timeout && $timeoutsub && $counter >= $timeout; 1; } sub killall { my $self = shift; my ( $sig, $warn ) = @_; if ($warn) { warn time . " - Killing: $_ - $sig\n" for grep { $_->pid } $self->children; } $_->kill($sig) for $self->children; } sub DESTROY { my $self = shift; return unless $self->pid == $$ && $self->children; warn <finish() if $^O eq 'MSWin32'; $self->finish( 1, sub { $self->killall( 15, 1 ); $self->finish( 4, sub { $self->killall( 9, 1 ); $self->finish(10); } ); } ); } 1; =pod =head1 NAME Parallel::Runner - An object to manage running things in parallel processes. =head1 DESCRIPTION There are several other modules to do this, you probably want one of them. This module exists as a super specialised parallel task manager. You create the object with a proces limit and callbacks for what to do while waiting for a free process slot, as well as a callback for what a process shoudl do just before exiting. You must explicetly call $runner->finish() when you are done. If the runner is destroyed before it's children are finished a warning will be generated and your child processes will be killed, by force if necessary. If you specify a maximum of 1 then no forking will occur, and run() will block until the coderef returns. You can force a fork by providing a boolean true value as the second argument to run(), this will force the runner to fork before running the coderef, however run() will still block until it the child exits. =head1 SYNOPSYS #!/usr/bin/perl use strict; use warnings; use Parallel::Runner; my $runner = Parallel::Runner->new(4); $runner->run( sub { ... } ); $runner->run( sub { ... } ); $runner->run( sub { ... } ); $runner->run( sub { ... } ); # This will block until one of the previous 4 finishes $runner->run( sub { ... } ); # Do not forget this. $runner->finish; =head1 CONSTRUCTOR =over 4 =item $runner = $class->new( $max, $accessor => $value, ... ); Create a new instance of Parallel::Runner. $accessor can be anything listed under the ACCESSORS section. $max should be the maximum number of processes allowed, defaults to 1. =back =head1 ACCESSORS These are simple accessors, provididng an argument sets the accessor to that argument, no argument it simply returns the current value. =over 4 =item $val = $runner->data_callback( \&callback ) If this is specified than IPC will be automatically enabled, and the final return from each process will be passed into this handler in the main process. Due to the way IPC works only strings/numerical data is passed, if you need to pass a ref you will need to serialize it yourself before returning it, followed by deserializing it in your callback. Example: # Place to put the accumulated data my @accum_data; # Create the runner with a callback that pushes the data onto our array. $runner = $CLASS->new( 2, data_callback => sub { my ($data) = @_; push @accum_data => $data; }, ); # 4 processes that return data $runner->run( sub { return "foo" }); $runner->run( sub { return "bar" }); $runner->run( sub { return "baz" }); $runner->run( sub { return "bat" }); $runner->finish; # Verify the data (order is not predictable) is_deeply( [ sort @accum_data ], [ sort qw/foo bar baz bat/ ], "Got all data returned by subprocesses" ); =item $val = $runner->exit_callback( \&callback ) Codref to call just before a child exits (called within child) =item $val = $runner->iteration_delay( $float ); How long to wait per iterate if nothing has changed. =item $val = $runner->iteration_callback( $newval ) Coderef to call multiple times in a loop while run() is blocking waiting for a process slot. =item $val = $runner->reap_callback( $newval ) Codref to call whenever a pid is reaped using waitpid. The callback sub will be passed 3 values The first is the exit status of the child process. The second is the pid of the child process. The third used to be the return of waitpid, but this is depricated as L is now used and throws an exception when waitpid is not what it should be. The third is simply the pid of the child process again. The final argument is the child process object itself. $runner->reap_callback( sub { my ( $status, $pid, $pid_again, $proc ) = @_; # Status as returned from system, so 0 is good, 1+ is bad. die "Child $pid did not exit 0" if $status; }); =item @children = $runner->children( @append ) Returns a list of L objects. =item $val = $runner->pid() pid of the parent process =item $val = $runner->max( $newval ) Maximum number of children =back =head1 OBJECT METHODS =over 4 =item run( $code ) =item run( $code, $force_fork ) Run the specified code in a child process. Blocks if no free slots are available. Force fork can be used to force a fork when max is 1, however it will still block until the child exits. =item finish() =item finish( $timeout ) =item finish( $timeout, $timeoutcallback ) Wait for all children to finish, then clean up after them. If a timeout is specified it will return after the timeout regardless of wether or not children have all exited. If there is a timeout call back then that code will be run upon timeout just before the method returns. NOTE: DO NOT LET YOUR RUNNER BE DESTROYED BEFORE FINISH COMPLETES WITHOUT A TIMEOUT. the runner will kill all children, possibly with force if your runner is destroyed with children still running, or not waited on. =item killall( $sig ) Send all children the specified kill signal. =item DESTROY() Automagically called when the object is destroyed. If called while children are running it will forcefully clean up after you as follows: 1) Sends an ugly warning. 2) Will first give all your children 1 second to complete. Windows) Strawberry fails with processes, so on windows DESTROY will wait as long as needed, possibly forever. 3) Sends kill signal 15 to all children then waits up to 4 seconds. 4) Sends kill signal 9 to any remaining children then waits up to 10 seconds 5) Gives up and returns =back =head1 FENNEC PROJECT This module is part of the Fennec project. See L for more details. Fennec is a project to develop an extendable and powerful testing framework. Together the tools that make up the Fennec framework provide a potent testing environment. The tools provided by Fennec are also useful on their own. Sometimes a tool created for Fennec is useful outside the greator framework. Such tools are turned into their own projects. This is one such project. =over 2 =item L - The core framework The primary Fennec project that ties them all together. =back =head1 AUTHORS Chad Granum L =head1 COPYRIGHT Copyright (C) 2010 Chad Granum Parallel-Runner is free software; Standard perl licence. Parallel-Runner is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.