Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Calling a perl script from GNU Parallel

by stevee (Acolyte)
on Jul 10, 2012 at 18:42 UTC ( #980925=perlquestion: print w/replies, xml ) Need Help??

stevee has asked for the wisdom of the Perl Monks concerning the following question:

Greetings oh wise and venerable monks!

I need to be able to call a perl script on a number of servers (two in my test set-up) using GNU parallel that "does something" and returns the results through STDIN to the calling terminal. I have quite happily managed a form of command line distributed grep as thus

parallel -q --onall --sshloginfile mycomputers --tag grep -H -E '3864885157' ::: /home/stephen/TO174/Data/dgrep-test/*.txt

Now I want to run a perl script on the servers listed in the loginfile "mycomputers". I have tried

parallel -q -onall -sshloginfile mycomputers --tag ./test.pl

and a number of variations but I always get the error message about

parallel: Input is read from the terminal. Only experts do this on purpose. Press CTRL-D to exit.

I have looked at all the examples but nothing I try seems to work. Can anyone give me a hint, or the answer as it is late here and I have been on this screen since 0600 today!

Many thanks

Steve

Replies are listed 'Best First'.
Re: Calling a perl script from GNU Parallel
by kcott (Archbishop) on Jul 10, 2012 at 19:16 UTC

    I'm not a parallel user but here's some suggestions for things to check (a few are very basic but I don't know what you've tried):

    • Is ./test.pl executable?
    • Does ./test.pl have a shebang line that is incompatible with your target servers?
    • Is ./test.pl trying to read from stdin?
    • Does ./test.pl run without errors or warnings if use strict; and use warnings; are used?
    • Does calling parallel ... perl ./test.pl work any better?

    If none of that helps, please post the ./test.pl code.

    -- Ken

      Ken et al Thanks for the suggestions:

      the script is executable and has a compatible shebang, it runs successfully on both machines using strict.

      The original script is not trying to read from STDIN, so I can get away without passing arguments with parallel

      The suggested syntax does not work either unfortunately

      The test script is purely so I can get parallel working in the first instance so it just prints "Hello world\n"!

      Kind regards Stephen
Re: Calling a perl script from GNU Parallel
by zentara (Archbishop) on Jul 10, 2012 at 19:25 UTC

      Interesting bug report, but seems to garner a number of contradictory answers. I tried the --gnu switch but it unfortunately did not help!

      Thanks Steve
Re: Calling a perl script from GNU Parallel
by bennymack (Pilgrim) on Sep 21, 2012 at 12:35 UTC
    I believe you're looking for '--nonall' instead of '--onall'. The former needs no arguments where the latter wants an argument list. Try this:
    parallel -q --nonall --sshloginfile mycomputers --tag ./test.pl
Re: Calling a perl script from GNU Parallel
by Anonymous Monk on Jul 11, 2012 at 00:00 UTC

    Hi,

    Is test.pl on the remote machines? In the correct directory?

    J.C.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2022-06-25 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (83 votes). Check out past polls.

    Notices?