in reply to Parallel tasks

I wrote this module: Parallel::ForkControl because I couldn't find any modules at the time that abstracted out the forking code in a way that let me adjust the forking performance so me and my co-workers could focus on the function of the code. I'd be interested in hearing your comments on the functionality of the module.
use Parallel::ForkControl; my $forker = new Parallel::ForkControl( MaxKids => 5000, MinKids => 5, WatchLoad => 1, MaxLoad => 5.50, Code => \&mySub ); foreach my $col (@collections) { $forker->run($col); } $forker->cleanup(); sub mySub { my $collection = shift; ...... return; }

Thanks,

UPDATED: I fixed the code parameter in the example to be a code ref.

-brad..

Replies are listed 'Best First'.
Re^2: Parallel tasks
by john.goor (Acolyte) on Jul 14, 2004 at 08:18 UTC
    I tried your example (see code below) but it didn't work.

    What am I doing wrong?

    #perl.exe -w # INIT ---- use Parallel::ForkControl; # VARS ---- my @collections = qw( adw adw_wet_compleet ag-dou ag-gi ag-hc ag-hlo a +g-its-sol ag-its-sol-hot agents alg_diversen alg_dossier_juris_en_res +o alg_ellis alg_ellis_en alg_kb alg_kfb alg_kluwer_rest alg_pdf alg_r +est alg_sdu am b_adw b_adw_wet_compleet b_ag-dou b_ag-gi b_ag-hc b_ag +-hlo b_ag-its-sol b_ag-its-sol-hot b_agents b_alg_diversen b_alg_doss +ier_juris_en_reso b_alg_ellis b_alg_ellis_en b_alg_kb b_alg_kfb b_alg +_kluwer_rest b_alg_pdf b_alg_rest b_alg_sdu b_am b_bibliotheek b_bm b +_bna-mix b_browsedocs b_curbel b_fmod b_help b_hvg b_hvg-kluwer b_mrp + b_pz b_refdocs b_tss b_tss-pdf bibliotheek bm bna-mix browsedocs cu +rbel fmod help hvg hvg-kluwer images mrp pz refdocs tss tss-pdf ); # SUBS ---- sub mySub { my $collection = shift; print "Col: $collection\n"; return; } # MAIN ---- my $forker = new Parallel::ForkControl( MaxKids => 5000, MinKids => 5, WatchLoad => 1, MaxLoad => 5.50, Code => &mySub ); foreach my $col (@collections) { $forker->run($col); } $forker->cleanup();

    The output I get is:
    Col: CANNOT RUN A IN RUN()
Re^2: Parallel tasks
by reyjrar (Hermit) on Jul 14, 2004 at 17:21 UTC
    My bad.. I forgot a \ try this:
    my $forker = new Parallel::ForkControl( MaxKids => 5000, MinKids => 5, WatchLoad => 1, MaxLoad => 5.50, Code => \&mySub );
    -brad..