in reply to Re^2: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
in thread Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
Not tested. Not even a little bit.my $total_children = 1000; my @job_list = 1..$total_children; my $max_children = 100; my $job_size = 10; my $main_pfm = P::FM->new( int($max_children/$job_size) ); my $sleep_time; while ( my @batch = splice(@job_list, 0, $job_size) ) { $sleep_time++; $main_pfm->start and next; run_job( @batch ); $main_pfm->finish; } sub run_job { my @jobs = @_; my $job_pfm = P::FM->new( scalar(@jobs) ); foreach ( @jobs ) { $job_pfm->start and next; print "Starting job $_\n"; sleep $sleep_time; $job_pfm->finish; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
by zwon (Abbot) on Dec 03, 2011 at 12:48 UTC | |
|
Re^4: Parallel::ForkManager How to wait when 1st 10 Child processe are over out of 100
by admiral_grinder (Pilgrim) on Dec 05, 2011 at 20:25 UTC |