parallel: support for multiple --profile.

This commit is contained in:
Ole Tange 2011-10-13 23:58:02 +02:00
parent 50edcdd38d
commit a25961d8d5
6 changed files with 51 additions and 12 deletions

View file

@ -179,9 +179,9 @@ cc:Peter Simons <simons@cryp.to>, Sandro Cazzaniga <kharec@mandriva.org>,
Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>, Jesse Alama
<jesse.alama@gmail.com>
Subject: GNU Parallel 20110922 ('Thorning-Schmidt') released
Subject: GNU Parallel 20111022 ('Ritchie') released
GNU Parallel 20110922 ('Thorning-Schmidt') has been released. It is
GNU Parallel 20111022 ('Ritchie') has been released. It is
available for download at: http://ftp.gnu.org/gnu/parallel/
New in this release:
@ -189,12 +189,27 @@ New in this release:
* --shellquote does not run the command but quotes it using \'s.
Useful for making quoted composed commands.
* GNU Parallel officially in Fedora 16
http://www.spinics.net/lists/fedora-package-announce/msg67130.html
* Blog post on recompression FLAC audio.
http://blog.oxplot.com/2011/08/reflac-flac-cleanser.html
* The most complex use of ::: I a seen so far.
http://agentzlerich.blogspot.com/2011/09/following-up-on-previous-failures-ive.html
* Example of using GNU Parallel with sudo.
http://loopkid.net/articles/2011/10/07/recursive-chmod-and-chown-on-files
* Use wget and gnu parallel to download mp3s at rocket speed.
http://sdbrain.posterous.com/use-wget-and-gnu-parallel-to-download-mp3s-at
* First CV referring to GNU Parallel.
http://www.peopleperhour.com/freelancers/stephen_/internet_researcher_and_protocol_develop/140602
* Cartwright labs usage of GNU Parallel.
http://cartwrightlab.wikispaces.com/The+Most+Bang+for+Your+Buck
* Bug fixes and man page updates.

View file

@ -14,7 +14,7 @@ build:
cd parallel-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]; dpkg-buildpackage -us -uc
@echo
@echo "To install the GNU Parallel Debian package, run:"
@echo -e \\t sudo dpkg -i `ls -rt parallel_*_all.deb | tail -n 1`
@echo " sudo dpkg -i "`ls -rt parallel_*_all.deb | tail -n 1`
clean:
rm -f parallel_*

View file

@ -425,7 +425,7 @@ sub options_hash {
"arg-sep|argsep=s" => \$::opt_arg_sep,
"arg-file-sep|argfilesep=s" => \$::opt_arg_file_sep,
"trim=s" => \$::opt_trim,
"profile|J=s" => \$::opt_profile,
"profile|J=s" => \@::opt_profile,
"pipe|spreadstdin" => \$::opt_pipe,
"recstart=s" => \$::opt_recstart,
"recend=s" => \$::opt_recend,
@ -733,8 +733,8 @@ sub read_options {
}
Getopt::Long::Configure("bundling","pass_through");
# Check if there is a --profile to set $::opt_profile
GetOptions("profile|J=s" => \$::opt_profile) || die_usage();
# Check if there is a --profile to set @::opt_profile
GetOptions("profile|J=s" => \@::opt_profile) || die_usage();
# Add options from .parallel/config and other profiles
my @ARGV_profile = ();
my @ARGV_env = ();
@ -743,9 +743,12 @@ sub read_options {
$ENV{'HOME'}."/.parallel/config",
$ENV{'HOME'}."/.parallelrc");
my @profiles = @config_profiles;
if($::opt_profile) {
if(@::opt_profile) {
# --profile overrides default profiles
@profiles = ($ENV{'HOME'}."/.parallel/".$::opt_profile);
@profiles = ();
for my $profile (@::opt_profile) {
push @profiles, $ENV{'HOME'}."/.parallel/".$profile;
}
}
for my $profile (@profiles) {
if(-r $profile) {

View file

@ -809,7 +809,7 @@ line.
This will set the owner of the homedir to the user:
B<tr ':' '\012' < /etc/passwd | parallel -N7 chown {1} {6}>
B<tr ':' '\n' < /etc/passwd | parallel -N7 chown {1} {6}>
Implies B<-X> unless B<-m> or B<--pipe> is set.
@ -865,8 +865,12 @@ on remote computers. See the section PROFILE FILES for examples.
I<profilename> corresponds to the file ~/.parallel/I<profilename>.
You can give multiple profiles by repeating B<--profile>. If parts of
the profiles conflict, the later ones will be used.
Default: config
=item B<--quote>
=item B<-q>
@ -1923,12 +1927,15 @@ Convert *.mp3 to *.ogg running one process per CPU core on local computer and se
To run the command B<uptime> on remote computers you can do:
B<parallel --nonall -S server1,server2 uptime>
B<parallel --tag --nonall -S server1,server2 uptime>
B<--nonall> reads no arguments. If you have a list of jobs you want
run on each computer you can do:
B<parallel --onall -S server1,server2 echo ::: 1 2 3>
B<parallel --tag --onall -S server1,server2 echo ::: 1 2 3>
Remove B<--tag> if you do not want the sshlogin added before the
output.
If you have a lot of hosts use '-j0' to access more hosts in parallel.
@ -2414,7 +2421,13 @@ variable $PARALLEL which takes precedence over the file
=head1 PROFILE FILES
If B<--profile> set, GNU B<parallel> will read the profile from that file instead of
~/.parallel/config.
~/.parallel/config. You can have multiple B<--profiles>.
Example: Profile for running a command on every sshlogin in
~/.ssh/sshlogins and prepend the output with the sshlogin:
echo --tag -S .. --nonall > ~/.parallel/n
parallel -Jn uptime
Example: Profile for running every command with B<-j-1> and B<nice>

View file

@ -66,3 +66,8 @@ parallel -v -J test_profile '<(echo {})' ::: foo
echo '### Test quoting of space in arguments (-S) from $PARALLEL'
PARALLEL='-k --jobs 1 --sshlogin ssh\ '$SERVER1'\ ssh\ parallel@'$SERVER2' perl -pe "\\$a=1; print \\$a" ' parallel -v '<(echo {})' ::: foo
echo '### Test merging of profiles - sort needed because -k only works on the single machine'
echo --tag > ~/.parallel/test_tag
echo -S .. > ~/.parallel/test_S..
parallel -Jtest_tag -Jtest_S.. --nonall echo a | sort

View file

@ -57,3 +57,6 @@ perl -pe '$a=1; print $a' <(echo foo)
### Test quoting of space in arguments (-S) from $PARALLEL
perl -pe "\$a=1; print \$a" <(echo foo)
1foo
### Test merging of profiles - sort needed because -k only works on the single machine
parallel-server3 a
parallel@parallel-server2 a