I want to use Perl 5.14 (ActiveState ActivePerl) to manage many thousands of executions of an external command-line utility under Microsoft Windows, each with a different argument. If I run them in sequence in a simple loop, they'll take too long to finish, so I want to run them in parallel as well as in an ordered sequence, n at a time (where the optimum value of n is probably going to be 20). I've never done this kind of job control before using Perl, so I need help getting started. Before now, I've used both tricks with the start command in funky systems of batch files and the nifty Unix xargs utility under both the MKS Toolkit and Cygwin. Now, for several important reasons, I need to use Perl instead.
So let's say I want to run a command-line utility named doit.exe 10,000 times on the arguments toit0000, toit0001, toit0002, …, toit9999. I want to invoke the jobs generally in that order, but I want to run them in parallel, 20 at a time. How do I do this in Perl? Assume I have a simple array of the ordered arguments; for example: my @ordered_arguments = <DATA>; chomp @ordered_arguments;.
Jim
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|