Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Using Perl to run a Windows command-line utility many times with ordered, parallel execution

by BrowserUk (Patriarch)
on Jan 26, 2014 at 21:08 UTC ( [id://1072150]=note: print w/replies, xml ) Need Help??


in reply to Using Perl to run a Windows command-line utility many times with ordered, parallel execution

Just add the DATA :)

#! perl -slw use strict; use threads stack_size => 4096; use threads::Q; sub thread { my $Q = shift; while( my $item = $Q->dq ) { system qq[ doit.exe $item ]; } } our $T //= 20; my @ordered_arguments = <DATA>; chomp @ordered_arguments; my $Q = threads::Q->new( $T * 2 ); my @threads = map async( \&thread, $Q ), 1 .. $T; $Q->nq( $_ ) for @ordered_arguments; $Q->nq( (undef) x $T ); $_->join for @threads; __DATA__ ...

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Using Perl to run a Windows command-line utility many times with ordered, parallel execution
  • Download Code

Replies are listed 'Best First'.
Re^2: Using Perl to run a Windows command-line utility many times with ordered, parallel execution
by jellisii2 (Hermit) on Jan 27, 2014 at 18:10 UTC

      Thread::Queue would work just as well, though it would consume a little more memory without some additional code to limit the size of the queue.

      But for the OPs 10k items and 20 threads that would still come in at less than 40mb.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1072150]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found