parallel: functions needs to be exported when using --nice remotely.

This commit is contained in:
Ole Tange 2015-03-22 17:13:25 +01:00
parent 585a29c062
commit be70739bb7
5 changed files with 96 additions and 59 deletions

View file

@ -6236,7 +6236,7 @@ sub sshlogin_wrap {
# running @bashfunc on the command line, will set the functions # running @bashfunc on the command line, will set the functions
my @bashfunc = map { my @bashfunc = map {
my $v=$_; s/BASH_FUNC_(.*)(\(\)|%%)/$1/; "$_$ENV{$v};" } @bash_functions; my $v=$_; s/BASH_FUNC_(.*)(\(\)|%%)/$1/; "$_$ENV{$v};export -f $_ >/dev/null;" } @bash_functions;
# eval $bashfuncset will set $bashfunc # eval $bashfuncset will set $bashfunc
my $bashfuncset; my $bashfuncset;
if(@bashfunc) { if(@bashfunc) {

View file

@ -1572,7 +1572,15 @@
<p>Output:</p> <p>Output:</p>
<pre><code> ssh -tt -oLogLevel=quiet lo &#39;eval `echo $SHELL | grep &quot;/t\{0,1\}csh&quot; &gt; /dev/null &amp;&amp; echo setenv PARALLEL_SEQ &#39;$PARALLEL_SEQ&#39;\; setenv PARALLEL_PID &#39;$PARALLEL_PID&#39; || echo PARALLEL_SEQ=&#39;$PARALLEL_SEQ&#39;\;export PARALLEL_SEQ\; PARALLEL_PID=&#39;$PARALLEL_PID&#39;\;export PARALLEL_PID` ;&#39; tty\ \&gt;/dev/null\ \&amp;\&amp;\ stty\ isig\ -onlcr\ -echo\;echo\ bar; <pre><code> ssh lo exec perl\ -e\ \\\$ENV\\\{\\\&quot;PARALLEL_PID\\\&quot;\\\}=\\\&quot;2554030\\\&quot;\\\;\
\\$ENV\\\{\\\&quot;PARALLEL_SEQ\\\&quot;\\\}=\\\&quot;1\\\&quot;\\\;\\\$bashfunc\\\ =\\\ \\\&quot;\\\&quot;\
\\;@ARGV=\\\&quot;echo\\\ bar\\\&quot;\\\;\\\$SIG\\\{CHLD\\\}=sub\\\{\\\$done=1\\\;\\\}\
\\;\\\$pid=fork\\\;unless\\\(\\\$pid\\\)\\\{setpgrp\\\;exec\\\$ENV\\\{SHELL\\\
},\\\&quot;-c\\\&quot;,\\\(\\\$bashfunc.\\\&quot;@ARGV\\\&quot;\\\)\\\;die\\\&quot;exec:\\\$\\\!\\\\n\\
\&quot;\\\;\\\}do\\\{\\\$s=\\\$s\\\&lt;1\\\?0.001+\\\$s\\\*1.03:\\\$s\\\;select\\\(
undef,undef,undef,\\\$s\\\)\\\;\\\}until\\\(\\\$done\\\|\\\|getppid==1\\\)\\\;
kill\\\(SIGHUP,-\\\$\\\{pid\\\}\\\)unless\\\$done\\\;wait\\\;exit\\\(\\\$\\\?\
\\&amp;127\\\?128+\\\(\\\$\\\?\\\&amp;127\\\):1+\\\$\\\?\\\&gt;\\\&gt;8\\\);
bar</code></pre> bar</code></pre>
<p>When the command gets more complex, the output is so hard to read, that it is only useful for debugging:</p> <p>When the command gets more complex, the output is so hard to read, that it is only useful for debugging:</p>
@ -1585,11 +1593,33 @@
<p>Output will be similar to:</p> <p>Output will be similar to:</p>
<pre><code> ssh server mkdir -p .parallel/tmp/hk-31483-1; rsync -rlDzR -essh ./abc-file server:.parallel/tmp/hk-31483-1;ssh -tt -oLogLevel=quiet server &#39;eval `echo $SHELL | grep &quot;/t\{0,1\}csh&quot; &gt; /dev/null &amp;&amp; echo setenv PARALLEL_SEQ &#39;$PARALLEL_SEQ&#39;\; setenv PARALLEL_PID &#39;$PARALLEL_PID&#39; || echo PARALLEL_SEQ=&#39;$PARALLEL_SEQ&#39;\;export PARALLEL_SEQ\; PARALLEL_PID=&#39;$PARALLEL_PID&#39;\;export PARALLEL_PID` ;&#39; tty\ \&gt;/dev/null\ \&amp;\&amp;\ stty\ isig\ -onlcr\ -echo\;mkdir\ -p\ .parallel/tmp/hk-31483-1\;\ cd\ .parallel/tmp/hk-31483-1\ \&amp;\&amp;\ echo\ \$SHELL\ \|\ grep\ \&quot;/t\\\{0,1\\\}csh\&quot;\ \&gt;\ /dev/null\ \&amp;\&amp;\ setenv\ my_func3\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\\\ \\\&gt;\\\ \\\$1.out\&quot;&#39; <pre><code> ( ssh lo mkdir -p ./.parallel/tmp/aspire-2554425-1;rsync --protocol 30 -rlDzR
&#39;\&quot;\\\}\ \&amp;\&amp;\ setenv\ VAR\ foo\ \&amp;\&amp;\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39; -essh ./abc-file lo:./.parallel/tmp/aspire-2554425-1 );ssh lo exec perl -e \&#39;&#39;
&#39;\&quot;\\\}\ \|\|\ export\ my_func3=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\\\ \\\&gt;\\\ \\\$1.out\&quot;&#39; @GNU_Parallel=(&quot;use&quot;,&quot;IPC::Open3;&quot;,&quot;use&quot;,&quot;MIME::Base64&quot;);eval&quot;@GNU_Parallel&quot;;
&#39;\&quot;\\\}\ \&amp;\&amp;\ export\ VAR=foo\ \&amp;\&amp;\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39; $SIG{CHLD}=&quot;IGNORE&quot;;my$zip=(grep{-x$_}&quot;/usr/local/bin/bzip2&quot;)[0]||&quot;bzip2&quot;;my(
&#39;\&quot;\\\}\ \&amp;\&amp;\ eval\ my_func3\&quot;\$my_func3\&quot;\ \&amp;\&amp;\ eval\ my_func2\&quot;\$my_func2\&quot;\;\\nice\ -n17\ /bin/bash\ -c\ my_func3\\\ abc-file;_EXIT_status=$?; mkdir -p .; rsync --rsync-path=cd\ .parallel/tmp/hk-31483-1/.\;\ rsync -rlDzR -essh server:abc-file.out .;ssh server rm\ -f\ .parallel/tmp/hk-31483-1/abc-file\;rm\ -f\ .parallel/tmp/hk-31483-1/abc-file.out\;rm -rf .parallel/tmp/hk-31483-1\;; exit $_EXIT_status;</code></pre> $in,$out,$eval);open3($in,$out,&quot;&gt;&amp;STDERR&quot;,$zip,&quot;-dc&quot;);if(my$perlpid=fork){
close$in;$eval=join&quot;&quot;,&lt;$out&gt;;close$out;}else{close$out;print$in(decode_base64(
join&quot;&quot;,@ARGV));close$in;exit;}wait;eval$eval;&#39;\&#39; QlpoOTFBWSZTWayP388AAbdfgAAQd
X/+3//l/wS/7//vQAIq3U6bauIpk1NPUwnqGgND1NGI9TTQ0A0ADIDQNITU9NGqfonpPJRvU0ZQZAA
GhpoBoABpqaFNBMh+kGoybUaHogwCYBAADCSgRNqek1TxTeknqemhGyBqek8pk2jRPSeo002mQRo5f
oSZYrgzQFDd3HNWaskbx+MxNR89BdDzESFbADOJkI+QhIlnojHCWRVuGc2j2lzMzE41wC7auAMQ06c
S3AlqQfKcdo0gd506U0HzAAxMkGJBHjDCZULOMpVbowhIVxxaQz7yansTsBgurEZaGO/6K0Nc4iodr
BW4m9SXErqRbLNy5eANDvZ+TIt2c2GBcWSlmYuloxY5u2bGUdU/dGsO5EhyrvKCpZMhIgmQFAQhcwR
mD+jMKRawkRFJSGyTNC3PqWnE51ucPyx29Yxjnkyub98lytpyk+v8BUc4eA3xz98dMYjxvb0pgWksh
oHZ7HwGQRq1vuDyzKgkwPL9lwGIdL+WPNJFSljlVAahIhQpDCAOJpTqDhgmfoRQcy54PC9T0T3iMnV
JeTUdL8P0/s18NqDSUavMNV3qD0CtYi6entl0neNsOQN2VDSLHj0xOMls65LNPo+Wh28rJtVoh2JgE
7Q9Qo/XBr6krGIsYpQR6nRDuJCD/5aaQBBFFQGtv2VoFTwkXiUTxFP1CC4AGBznAaMklgWQvVtKguJ
zQnPqr9ABtHwbB5GTzPOQ4iWAmrUxvl4j5wqrVchOZcs3NYUQmGO2+VYBimFVxhGcaxDALMZ6bWEUo
yt8eC8W5o1ObFtTnHAvjOQgYEL/nHTcxU0G57QMKCzJcASQWFNpe2CpQcgYlBxIN4kwtfxdyRThQkK
yP388;_EXIT_status=$?; mkdir -p ./.; rsync --protocol 30 --rsync-path=cd\
./.parallel/tmp/aspire-2554425-1/./.\;\ rsync -rlDzR -essh lo:./abc-file.out
./.;ssh lo \(rm\ -f\ ./.parallel/tmp/aspire-2554425-1/abc-file\;\ sh\ -c\ \&#39;
rmdir\ ./.parallel/tmp/aspire-2554425-1/\ ./.parallel/tmp/\ ./.parallel/\ 2\&gt;
/dev/null\&#39;\;rm\ -rf\ ./.parallel/tmp/aspire-2554425-1\;\);ssh lo \(rm\ -f\
./.parallel/tmp/aspire-2554425-1/abc-file.out\;\ sh\ -c\ \&#39;rmdir\ ./.parallel
/tmp/aspire-2554425-1/\ ./.parallel/tmp/\ ./.parallel/\ 2\&gt;/dev/null\&#39;\;rm\
-rf\ ./.parallel/tmp/aspire-2554425-1\;\);ssh lo rm -rf .parallel/tmp/
aspire-2554425-1; exit $_EXIT_status;</code></pre>
<h1 id="pipe">--pipe</h1> <h1 id="pipe">--pipe</h1>
@ -2079,12 +2109,9 @@
<p>Profiles work the same way, but have to be referred to with --profile:</p> <p>Profiles work the same way, but have to be referred to with --profile:</p>
<pre><code> echo &#39;-S :,&#39;$SERVER1 &gt; ~/.parallel/cluster <pre><code> echo &#39;--nice 17&#39; &gt; ~/.parallel/nicetimeout
echo &#39;--nice 17&#39; &gt;&gt; ~/.parallel/cluster echo &#39;--timeout 300%&#39; &gt;&gt; ~/.parallel/nicetimeout
echo &#39;--filter-hosts&#39; &gt;&gt; ~/.parallel/cluster parallel --profile nicetimeout echo ::: A B C</code></pre>
echo &#39;--timeout 300%&#39; &gt;&gt; ~/.parallel/cluster
echo &#39;--env _&#39; &gt;&gt; ~/.parallel/cluster
parallel --profile cluster echo ::: A B C</code></pre>
<p>Output:</p> <p>Output:</p>
@ -2095,25 +2122,13 @@
<p>Profiles can be combined:</p> <p>Profiles can be combined:</p>
<pre><code> echo &#39;-vv --dry-run&#39; &gt; ~/.parallel/dryverbose <pre><code> echo &#39;-vv --dry-run&#39; &gt; ~/.parallel/dryverbose
parallel --profile dryverbose --profile cluster echo ::: A B C</code></pre> parallel --profile dryverbose --profile nicetimeout echo ::: A B C</code></pre>
<p>Output:</p> <p>Output:</p>
<pre><code> ssh -tt -oLogLevel=quiet lo &#39;eval `echo $SHELL | grep &quot;/t\{0,1\}csh&quot; &gt; /dev/null &amp;&amp; echo setenv PARALLEL_SEQ &#39;$PARALLEL_SEQ&#39;\; setenv PARALLEL_PID &#39;$PARALLEL_PID&#39; || echo PARALLEL_SEQ=&#39;$PARALLEL_SEQ&#39;\;export PARALLEL_SEQ\; PARALLEL_PID=&#39;$PARALLEL_PID&#39;\;export PARALLEL_PID` ;&#39; tty\ \&gt;/dev/null\ \&amp;\&amp;\ stty\ isig\ -onlcr\ -echo\;echo\ \$SHELL\ \|\ grep\ \&quot;/t\\\{0,1\\\}csh\&quot;\ \&gt;\ /dev/null\ \&amp;\&amp;\ setenv\ SERVER1\ lo\ \&amp;\&amp;\ setenv\ MYVAR\ foo\\\ bar\ \&amp;\&amp;\ setenv\ VAR\ foo\ \&amp;\&amp;\ setenv\ my_func\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\&quot;&#39; <pre><code> \nice -n17 /bin/bash -c echo\ A
&#39;\&quot;\\\}\ \&amp;\&amp;\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39; \nice -n17 /bin/bash -c echo\ B
&#39;\&quot;\\\}\ \|\|\ export\ SERVER1=lo\ \&amp;\&amp;\ export\ MYVAR=foo\\\ bar\ \&amp;\&amp;\ export\ VAR=foo\ \&amp;\&amp;\ export\ my_func=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\&quot;&#39; \nice -n17 /bin/bash -c echo\ C</code></pre>
&#39;\&quot;\\\}\ \&amp;\&amp;\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \&amp;\&amp;\ eval\ my_func\&quot;\$my_func\&quot;\ \&amp;\&amp;\ eval\ my_func2\&quot;\$my_func2\&quot;\;\\nice\ -n17\ /bin/bash\ -c\ echo\\\ A;
ssh -tt -oLogLevel=quiet lo &#39;eval `echo $SHELL | grep &quot;/t\{0,1\}csh&quot; &gt; /dev/null &amp;&amp; echo setenv PARALLEL_SEQ &#39;$PARALLEL_SEQ&#39;\; setenv PARALLEL_PID &#39;$PARALLEL_PID&#39; || echo PARALLEL_SEQ=&#39;$PARALLEL_SEQ&#39;\;export PARALLEL_SEQ\; PARALLEL_PID=&#39;$PARALLEL_PID&#39;\;export PARALLEL_PID` ;&#39; tty\ \&gt;/dev/null\ \&amp;\&amp;\ stty\ isig\ -onlcr\ -echo\;echo\ \$SHELL\ \|\ grep\ \&quot;/t\\\{0,1\\\}csh\&quot;\ \&gt;\ /dev/null\ \&amp;\&amp;\ setenv\ SERVER1\ lo\ \&amp;\&amp;\ setenv\ MYVAR\ foo\\\ bar\ \&amp;\&amp;\ setenv\ VAR\ foo\ \&amp;\&amp;\ setenv\ my_func\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \&amp;\&amp;\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \|\|\ export\ SERVER1=lo\ \&amp;\&amp;\ export\ MYVAR=foo\\\ bar\ \&amp;\&amp;\ export\ VAR=foo\ \&amp;\&amp;\ export\ my_func=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \&amp;\&amp;\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \&amp;\&amp;\ eval\ my_func\&quot;\$my_func\&quot;\ \&amp;\&amp;\ eval\ my_func2\&quot;\$my_func2\&quot;\;\\nice\ -n17\ /bin/bash\ -c\ echo\\\ B;
ssh -tt -oLogLevel=quiet lo &#39;eval `echo $SHELL | grep &quot;/t\{0,1\}csh&quot; &gt; /dev/null &amp;&amp; echo setenv PARALLEL_SEQ &#39;$PARALLEL_SEQ&#39;\; setenv PARALLEL_PID &#39;$PARALLEL_PID&#39; || echo PARALLEL_SEQ=&#39;$PARALLEL_SEQ&#39;\;export PARALLEL_SEQ\; PARALLEL_PID=&#39;$PARALLEL_PID&#39;\;export PARALLEL_PID` ;&#39; tty\ \&gt;/dev/null\ \&amp;\&amp;\ stty\ isig\ -onlcr\ -echo\;echo\ \$SHELL\ \|\ grep\ \&quot;/t\\\{0,1\\\}csh\&quot;\ \&gt;\ /dev/null\ \&amp;\&amp;\ setenv\ SERVER1\ lo\ \&amp;\&amp;\ setenv\ MYVAR\ foo\\\ bar\ \&amp;\&amp;\ setenv\ VAR\ foo\ \&amp;\&amp;\ setenv\ my_func\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \&amp;\&amp;\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \|\|\ export\ SERVER1=lo\ \&amp;\&amp;\ export\ MYVAR=foo\\\ bar\ \&amp;\&amp;\ export\ VAR=foo\ \&amp;\&amp;\ export\ my_func=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \&amp;\&amp;\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\&quot;&#39;
&#39;\&quot;\\\}\ \&amp;\&amp;\ eval\ my_func\&quot;\$my_func\&quot;\ \&amp;\&amp;\ eval\ my_func2\&quot;\$my_func2\&quot;\;\\nice\ -n17\ /bin/bash\ -c\ echo\\\ C;</code></pre>
<h1 id="Spread-the-word">Spread the word</h1> <h1 id="Spread-the-word">Spread the word</h1>
@ -2158,7 +2173,7 @@
</li> </li>
</ul> </ul>
<p>(C) 2013,2014 Ole Tange, GPLv3</p> <p>(C) 2013,2014,2015 Ole Tange, GPLv3</p>
</body> </body>

View file

@ -1553,7 +1553,15 @@ the workdir, and setting --nice value. -vv shows all of this.
Output: Output:
ssh -tt -oLogLevel=quiet lo 'eval `echo $SHELL | grep "/t\{0,1\}csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\; PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' tty\ \>/dev/null\ \&\&\ stty\ isig\ -onlcr\ -echo\;echo\ bar; ssh lo exec perl\ -e\ \\\$ENV\\\{\\\"PARALLEL_PID\\\"\\\}=\\\"2554030\\\"\\\;\
\\$ENV\\\{\\\"PARALLEL_SEQ\\\"\\\}=\\\"1\\\"\\\;\\\$bashfunc\\\ =\\\ \\\"\\\"\
\\;@ARGV=\\\"echo\\\ bar\\\"\\\;\\\$SIG\\\{CHLD\\\}=sub\\\{\\\$done=1\\\;\\\}\
\\;\\\$pid=fork\\\;unless\\\(\\\$pid\\\)\\\{setpgrp\\\;exec\\\$ENV\\\{SHELL\\\
},\\\"-c\\\",\\\(\\\$bashfunc.\\\"@ARGV\\\"\\\)\\\;die\\\"exec:\\\$\\\!\\\\n\\
\"\\\;\\\}do\\\{\\\$s=\\\$s\\\<1\\\?0.001+\\\$s\\\*1.03:\\\$s\\\;select\\\(
undef,undef,undef,\\\$s\\\)\\\;\\\}until\\\(\\\$done\\\|\\\|getppid==1\\\)\\\;
kill\\\(SIGHUP,-\\\$\\\{pid\\\}\\\)unless\\\$done\\\;wait\\\;exit\\\(\\\$\\\?\
\\&127\\\?128+\\\(\\\$\\\?\\\&127\\\):1+\\\$\\\?\\\>\\\>8\\\);
bar bar
When the command gets more complex, the output is so hard to read, that it is only useful for debugging: When the command gets more complex, the output is so hard to read, that it is only useful for debugging:
@ -1566,11 +1574,33 @@ When the command gets more complex, the output is so hard to read, that it is on
Output will be similar to: Output will be similar to:
ssh server mkdir -p .parallel/tmp/hk-31483-1; rsync -rlDzR -essh ./abc-file server:.parallel/tmp/hk-31483-1;ssh -tt -oLogLevel=quiet server 'eval `echo $SHELL | grep "/t\{0,1\}csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\; PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' tty\ \>/dev/null\ \&\&\ stty\ isig\ -onlcr\ -echo\;mkdir\ -p\ .parallel/tmp/hk-31483-1\;\ cd\ .parallel/tmp/hk-31483-1\ \&\&\ echo\ \$SHELL\ \|\ grep\ \"/t\\\{0,1\\\}csh\"\ \>\ /dev/null\ \&\&\ setenv\ my_func3\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\\\ \\\>\\\ \\\$1.out\"' ( ssh lo mkdir -p ./.parallel/tmp/aspire-2554425-1;rsync --protocol 30 -rlDzR
'\"\\\}\ \&\&\ setenv\ VAR\ foo\ \&\&\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"' -essh ./abc-file lo:./.parallel/tmp/aspire-2554425-1 );ssh lo exec perl -e \''
'\"\\\}\ \|\|\ export\ my_func3=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\\\ \\\>\\\ \\\$1.out\"' @GNU_Parallel=("use","IPC::Open3;","use","MIME::Base64");eval"@GNU_Parallel";
'\"\\\}\ \&\&\ export\ VAR=foo\ \&\&\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"' $SIG{CHLD}="IGNORE";my$zip=(grep{-x$_}"/usr/local/bin/bzip2")[0]||"bzip2";my(
'\"\\\}\ \&\&\ eval\ my_func3\"\$my_func3\"\ \&\&\ eval\ my_func2\"\$my_func2\"\;\\nice\ -n17\ /bin/bash\ -c\ my_func3\\\ abc-file;_EXIT_status=$?; mkdir -p .; rsync --rsync-path=cd\ .parallel/tmp/hk-31483-1/.\;\ rsync -rlDzR -essh server:abc-file.out .;ssh server rm\ -f\ .parallel/tmp/hk-31483-1/abc-file\;rm\ -f\ .parallel/tmp/hk-31483-1/abc-file.out\;rm -rf .parallel/tmp/hk-31483-1\;; exit $_EXIT_status; $in,$out,$eval);open3($in,$out,">&STDERR",$zip,"-dc");if(my$perlpid=fork){
close$in;$eval=join"",<$out>;close$out;}else{close$out;print$in(decode_base64(
join"",@ARGV));close$in;exit;}wait;eval$eval;'\' QlpoOTFBWSZTWayP388AAbdfgAAQd
X/+3//l/wS/7//vQAIq3U6bauIpk1NPUwnqGgND1NGI9TTQ0A0ADIDQNITU9NGqfonpPJRvU0ZQZAA
GhpoBoABpqaFNBMh+kGoybUaHogwCYBAADCSgRNqek1TxTeknqemhGyBqek8pk2jRPSeo002mQRo5f
oSZYrgzQFDd3HNWaskbx+MxNR89BdDzESFbADOJkI+QhIlnojHCWRVuGc2j2lzMzE41wC7auAMQ06c
S3AlqQfKcdo0gd506U0HzAAxMkGJBHjDCZULOMpVbowhIVxxaQz7yansTsBgurEZaGO/6K0Nc4iodr
BW4m9SXErqRbLNy5eANDvZ+TIt2c2GBcWSlmYuloxY5u2bGUdU/dGsO5EhyrvKCpZMhIgmQFAQhcwR
mD+jMKRawkRFJSGyTNC3PqWnE51ucPyx29Yxjnkyub98lytpyk+v8BUc4eA3xz98dMYjxvb0pgWksh
oHZ7HwGQRq1vuDyzKgkwPL9lwGIdL+WPNJFSljlVAahIhQpDCAOJpTqDhgmfoRQcy54PC9T0T3iMnV
JeTUdL8P0/s18NqDSUavMNV3qD0CtYi6entl0neNsOQN2VDSLHj0xOMls65LNPo+Wh28rJtVoh2JgE
7Q9Qo/XBr6krGIsYpQR6nRDuJCD/5aaQBBFFQGtv2VoFTwkXiUTxFP1CC4AGBznAaMklgWQvVtKguJ
zQnPqr9ABtHwbB5GTzPOQ4iWAmrUxvl4j5wqrVchOZcs3NYUQmGO2+VYBimFVxhGcaxDALMZ6bWEUo
yt8eC8W5o1ObFtTnHAvjOQgYEL/nHTcxU0G57QMKCzJcASQWFNpe2CpQcgYlBxIN4kwtfxdyRThQkK
yP388;_EXIT_status=$?; mkdir -p ./.; rsync --protocol 30 --rsync-path=cd\
./.parallel/tmp/aspire-2554425-1/./.\;\ rsync -rlDzR -essh lo:./abc-file.out
./.;ssh lo \(rm\ -f\ ./.parallel/tmp/aspire-2554425-1/abc-file\;\ sh\ -c\ \'
rmdir\ ./.parallel/tmp/aspire-2554425-1/\ ./.parallel/tmp/\ ./.parallel/\ 2\>
/dev/null\'\;rm\ -rf\ ./.parallel/tmp/aspire-2554425-1\;\);ssh lo \(rm\ -f\
./.parallel/tmp/aspire-2554425-1/abc-file.out\;\ sh\ -c\ \'rmdir\ ./.parallel
/tmp/aspire-2554425-1/\ ./.parallel/tmp/\ ./.parallel/\ 2\>/dev/null\'\;rm\
-rf\ ./.parallel/tmp/aspire-2554425-1\;\);ssh lo rm -rf .parallel/tmp/
aspire-2554425-1; exit $_EXIT_status;
=head1 --pipe =head1 --pipe
@ -2093,12 +2123,9 @@ a user by putting them in ~/.parallel/config.
Profiles work the same way, but have to be referred to with --profile: Profiles work the same way, but have to be referred to with --profile:
echo '-S :,'$SERVER1 > ~/.parallel/cluster echo '--nice 17' > ~/.parallel/nicetimeout
echo '--nice 17' >> ~/.parallel/cluster echo '--timeout 300%' >> ~/.parallel/nicetimeout
echo '--filter-hosts' >> ~/.parallel/cluster parallel --profile nicetimeout echo ::: A B C
echo '--timeout 300%' >> ~/.parallel/cluster
echo '--env _' >> ~/.parallel/cluster
parallel --profile cluster echo ::: A B C
Output: Output:
@ -2109,25 +2136,13 @@ Output:
Profiles can be combined: Profiles can be combined:
echo '-vv --dry-run' > ~/.parallel/dryverbose echo '-vv --dry-run' > ~/.parallel/dryverbose
parallel --profile dryverbose --profile cluster echo ::: A B C parallel --profile dryverbose --profile nicetimeout echo ::: A B C
Output: Output:
ssh -tt -oLogLevel=quiet lo 'eval `echo $SHELL | grep "/t\{0,1\}csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\; PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' tty\ \>/dev/null\ \&\&\ stty\ isig\ -onlcr\ -echo\;echo\ \$SHELL\ \|\ grep\ \"/t\\\{0,1\\\}csh\"\ \>\ /dev/null\ \&\&\ setenv\ SERVER1\ lo\ \&\&\ setenv\ MYVAR\ foo\\\ bar\ \&\&\ setenv\ VAR\ foo\ \&\&\ setenv\ my_func\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\"' \nice -n17 /bin/bash -c echo\ A
'\"\\\}\ \&\&\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"' \nice -n17 /bin/bash -c echo\ B
'\"\\\}\ \|\|\ export\ SERVER1=lo\ \&\&\ export\ MYVAR=foo\\\ bar\ \&\&\ export\ VAR=foo\ \&\&\ export\ my_func=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\"' \nice -n17 /bin/bash -c echo\ C
'\"\\\}\ \&\&\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"'
'\"\\\}\ \&\&\ eval\ my_func\"\$my_func\"\ \&\&\ eval\ my_func2\"\$my_func2\"\;\\nice\ -n17\ /bin/bash\ -c\ echo\\\ A;
ssh -tt -oLogLevel=quiet lo 'eval `echo $SHELL | grep "/t\{0,1\}csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\; PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' tty\ \>/dev/null\ \&\&\ stty\ isig\ -onlcr\ -echo\;echo\ \$SHELL\ \|\ grep\ \"/t\\\{0,1\\\}csh\"\ \>\ /dev/null\ \&\&\ setenv\ SERVER1\ lo\ \&\&\ setenv\ MYVAR\ foo\\\ bar\ \&\&\ setenv\ VAR\ foo\ \&\&\ setenv\ my_func\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\"'
'\"\\\}\ \&\&\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"'
'\"\\\}\ \|\|\ export\ SERVER1=lo\ \&\&\ export\ MYVAR=foo\\\ bar\ \&\&\ export\ VAR=foo\ \&\&\ export\ my_func=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\"'
'\"\\\}\ \&\&\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"'
'\"\\\}\ \&\&\ eval\ my_func\"\$my_func\"\ \&\&\ eval\ my_func2\"\$my_func2\"\;\\nice\ -n17\ /bin/bash\ -c\ echo\\\ B;
ssh -tt -oLogLevel=quiet lo 'eval `echo $SHELL | grep "/t\{0,1\}csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\; PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' tty\ \>/dev/null\ \&\&\ stty\ isig\ -onlcr\ -echo\;echo\ \$SHELL\ \|\ grep\ \"/t\\\{0,1\\\}csh\"\ \>\ /dev/null\ \&\&\ setenv\ SERVER1\ lo\ \&\&\ setenv\ MYVAR\ foo\\\ bar\ \&\&\ setenv\ VAR\ foo\ \&\&\ setenv\ my_func\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\"'
'\"\\\}\ \&\&\ setenv\ my_func2\ \\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"'
'\"\\\}\ \|\|\ export\ SERVER1=lo\ \&\&\ export\ MYVAR=foo\\\ bar\ \&\&\ export\ VAR=foo\ \&\&\ export\ my_func=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func\\\ \\\$1\"'
'\"\\\}\ \&\&\ export\ my_func2=\\\(\\\)\\\ \\\{\\\ \\\ echo\\\ in\\\ my_func2\\\ \\\$VAR\\\ \\\$1\"'
'\"\\\}\ \&\&\ eval\ my_func\"\$my_func\"\ \&\&\ eval\ my_func2\"\$my_func2\"\;\\nice\ -n17\ /bin/bash\ -c\ echo\\\ C;
=head1 Spread the word =head1 Spread the word
@ -2184,7 +2199,7 @@ https://my.fsf.org/donate/
=back =back
(C) 2013,2014 Ole Tange, GPLv3 (C) 2013,2014,2015 Ole Tange, GPLv3
=cut =cut

View file

@ -61,4 +61,7 @@ echo '### Uniq {=perlexpr=} in return - not used in command'
# Should be changed to --return '{=s:/f:/g:=}' and tested with csh - is error code kept? # Should be changed to --return '{=s:/f:/g:=}' and tested with csh - is error code kept?
echo '### functions and --nice'
myfunc() { echo OK $*; }; export -f myfunc; parallel --nice 10 --env myfunc -S parallel@lo myfunc ::: func
EOF EOF

View file

@ -101,3 +101,7 @@ echo '### Uniq {=perlexpr=} in return - not used in command'
cd /tmp; rm -f /tmp/parallel_perlexpr.2Parallel_PerlexPr; echo local > parallel_perlexpr; parallel -Sparallel@lo --trc {=s/pr/pr.2/=}{=s/p/P/g=} echo remote OK '>' {}.2{=s/p/P/g=} ::: parallel_perlexpr; cat /tmp/parallel_perlexpr.2Parallel_PerlexPr; rm -f /tmp/parallel_perlexpr.2Parallel_PerlexPr /tmp/parallel_perlexpr cd /tmp; rm -f /tmp/parallel_perlexpr.2Parallel_PerlexPr; echo local > parallel_perlexpr; parallel -Sparallel@lo --trc {=s/pr/pr.2/=}{=s/p/P/g=} echo remote OK '>' {}.2{=s/p/P/g=} ::: parallel_perlexpr; cat /tmp/parallel_perlexpr.2Parallel_PerlexPr; rm -f /tmp/parallel_perlexpr.2Parallel_PerlexPr /tmp/parallel_perlexpr
remote OK remote OK
# Should be changed to --return '{=s:/f:/g:=}' and tested with csh - is error code kept? # Should be changed to --return '{=s:/f:/g:=}' and tested with csh - is error code kept?
echo '### functions and --nice'
### functions and --nice
myfunc() { echo OK $*; }; export -f myfunc; parallel --nice 10 --env myfunc -S parallel@lo myfunc ::: func
OK func