mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 05:57:54 +00:00
parallel: --tty allows for more programs accessing /dev/tty in parallel.
This commit is contained in:
parent
94ac9fd72c
commit
f2b403b7fb
|
@ -210,6 +210,11 @@ Quote of the month:
|
||||||
<<>>
|
<<>>
|
||||||
|
|
||||||
New in this release:
|
New in this release:
|
||||||
|
|
||||||
|
* --tty allows for more programs accessing /dev/tty in parallel. Some programs require tty access without using it.
|
||||||
|
|
||||||
|
* env_parallel --session will record names in current environment in $PARALLEL_IGNORED_NAMES and exit. It is only used with env_parallel, and can work like --record-env but in a single session.
|
||||||
|
|
||||||
https://comquest.in/training
|
https://comquest.in/training
|
||||||
https://bash-prompt.net/guides/parallell-bash/
|
https://bash-prompt.net/guides/parallell-bash/
|
||||||
https://blog.uta.edu/xus/2017/09/29/an-easy-way-to-run-parallel-jobs-on-stampede2/
|
https://blog.uta.edu/xus/2017/09/29/an-easy-way-to-run-parallel-jobs-on-stampede2/
|
||||||
|
|
|
@ -27,7 +27,20 @@ B<env_parallel> is 100 ms slower at startup than pure GNU
|
||||||
B<parallel>, and takes up to 30% longer to start a job (typically 15 ms).
|
B<parallel>, and takes up to 30% longer to start a job (typically 15 ms).
|
||||||
|
|
||||||
Due to the problem with environment space (see below) the recommended
|
Due to the problem with environment space (see below) the recommended
|
||||||
usage is:
|
usage is either:
|
||||||
|
|
||||||
|
# Do --record-env into $PARALLEL_IGNORED_NAMES
|
||||||
|
env_parallel --session
|
||||||
|
|
||||||
|
# Define whatever you want to use
|
||||||
|
alias myalias=echo
|
||||||
|
myvar=it
|
||||||
|
myfunc() { myalias $1 $myvar works.; }
|
||||||
|
|
||||||
|
# env_parallel will not export names in $PARALLEL_IGNORED_NAMES
|
||||||
|
env_parallel -S localhost myfunc ::: Yay,
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
# Record the "clean" environment (this only needs to be run once)
|
# Record the "clean" environment (this only needs to be run once)
|
||||||
env_parallel --record-env
|
env_parallel --record-env
|
||||||
|
@ -42,7 +55,7 @@ usage is:
|
||||||
# Use --env _ to only transfer the names not in the "empty" environment
|
# Use --env _ to only transfer the names not in the "empty" environment
|
||||||
env_parallel --env _ -S localhost myfunc ::: Yay,
|
env_parallel --env _ -S localhost myfunc ::: Yay,
|
||||||
|
|
||||||
In B<csh>:
|
In B<csh> B<--session> is not supported:
|
||||||
|
|
||||||
# Record the "clean" environment (this only needs to be run once)
|
# Record the "clean" environment (this only needs to be run once)
|
||||||
env_parallel --record-env
|
env_parallel --record-env
|
||||||
|
|
10
src/parallel
10
src/parallel
|
@ -2449,7 +2449,6 @@ sub __RUNNING_THE_JOBS_AND_PRINTING_PROGRESS__ {}
|
||||||
# $Global::host{$sshlogin} = Pointer to SSHLogin-object
|
# $Global::host{$sshlogin} = Pointer to SSHLogin-object
|
||||||
# $Global::total_running = total number of running jobs
|
# $Global::total_running = total number of running jobs
|
||||||
# $Global::total_started = total jobs started
|
# $Global::total_started = total jobs started
|
||||||
# $Global::tty_taken = is the tty in use by a running job?
|
|
||||||
# $Global::max_procs_file = filename if --jobs is given a filename
|
# $Global::max_procs_file = filename if --jobs is given a filename
|
||||||
# $Global::JobQueue = JobQueue object for the queue of jobs
|
# $Global::JobQueue = JobQueue object for the queue of jobs
|
||||||
# $Global::timeoutq = queue of times where jobs timeout
|
# $Global::timeoutq = queue of times where jobs timeout
|
||||||
|
@ -2471,7 +2470,6 @@ sub init_run_jobs {
|
||||||
# Returns: N/A
|
# Returns: N/A
|
||||||
$Global::total_running = 0;
|
$Global::total_running = 0;
|
||||||
$Global::total_started = 0;
|
$Global::total_started = 0;
|
||||||
$Global::tty_taken = 0;
|
|
||||||
$SIG{USR1} = \&list_running_jobs;
|
$SIG{USR1} = \&list_running_jobs;
|
||||||
$SIG{USR2} = \&toggle_progress;
|
$SIG{USR2} = \&toggle_progress;
|
||||||
if(@opt::basefile) { setup_basefile(); }
|
if(@opt::basefile) { setup_basefile(); }
|
||||||
|
@ -3927,7 +3925,6 @@ sub reaper {
|
||||||
# Uses:
|
# Uses:
|
||||||
# %Global::sshmaster
|
# %Global::sshmaster
|
||||||
# %Global::running
|
# %Global::running
|
||||||
# $Global::tty_taken
|
|
||||||
# $opt::timeout
|
# $opt::timeout
|
||||||
# $Global::timeoutq
|
# $Global::timeoutq
|
||||||
# $opt::halt
|
# $opt::halt
|
||||||
|
@ -3969,10 +3966,6 @@ sub reaper {
|
||||||
|
|
||||||
debug("run", "seq ",$job->seq()," died (", $job->exitstatus(), ")");
|
debug("run", "seq ",$job->seq()," died (", $job->exitstatus(), ")");
|
||||||
$job->set_endtime(::now());
|
$job->set_endtime(::now());
|
||||||
if($stiff == $Global::tty_taken) {
|
|
||||||
# The process that died had the tty => release it
|
|
||||||
$Global::tty_taken = 0;
|
|
||||||
}
|
|
||||||
my $sshlogin = $job->sshlogin();
|
my $sshlogin = $job->sshlogin();
|
||||||
$sshlogin->dec_jobs_running();
|
$sshlogin->dec_jobs_running();
|
||||||
if($job->should_be_retried()) {
|
if($job->should_be_retried()) {
|
||||||
|
@ -8588,7 +8581,7 @@ sub start {
|
||||||
}
|
}
|
||||||
$job->set_fh(0,"w",$stdin_fh);
|
$job->set_fh(0,"w",$stdin_fh);
|
||||||
if($opt::tee) { $job->set_virgin(0); }
|
if($opt::tee) { $job->set_virgin(0); }
|
||||||
} elsif ($opt::tty and not $Global::tty_taken and -c "/dev/tty" and
|
} elsif ($opt::tty and -c "/dev/tty" and
|
||||||
open(my $devtty_fh, "<", "/dev/tty")) {
|
open(my $devtty_fh, "<", "/dev/tty")) {
|
||||||
# Give /dev/tty to the command if no one else is using it
|
# Give /dev/tty to the command if no one else is using it
|
||||||
# The eval is needed to catch exception from open3
|
# The eval is needed to catch exception from open3
|
||||||
|
@ -8605,7 +8598,6 @@ sub start {
|
||||||
|| ::die_bug("open3-/dev/tty");
|
|| ::die_bug("open3-/dev/tty");
|
||||||
1;
|
1;
|
||||||
};
|
};
|
||||||
$Global::tty_taken = $pid;
|
|
||||||
close $devtty_fh;
|
close $devtty_fh;
|
||||||
$job->set_virgin(0);
|
$job->set_virgin(0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2041,6 +2041,8 @@ Record names in current environment in B<$PARALLEL_IGNORED_NAMES> and
|
||||||
exit. Only used with B<env_parallel>. Aliases, functions, and
|
exit. Only used with B<env_parallel>. Aliases, functions, and
|
||||||
variables with names in B<$PARALLEL_IGNORED_NAMES> will not be copied.
|
variables with names in B<$PARALLEL_IGNORED_NAMES> will not be copied.
|
||||||
|
|
||||||
|
Only supported in B<Ash, Bash, Dash, Ksh, Sh, and Zsh>.
|
||||||
|
|
||||||
See also B<--env>, B<--record-env>.
|
See also B<--env>, B<--record-env>.
|
||||||
|
|
||||||
|
|
||||||
|
@ -2328,13 +2330,13 @@ Silent. The job to be run will not be printed. This is the default.
|
||||||
Can be reversed with B<-v>.
|
Can be reversed with B<-v>.
|
||||||
|
|
||||||
|
|
||||||
=item B<--tty>
|
=item B<--tty> (alpha testing)
|
||||||
|
|
||||||
Open terminal tty. If GNU B<parallel> is used for starting an
|
Open terminal tty. If GNU B<parallel> is used for starting a program
|
||||||
interactive program then this option may be needed. It will start only
|
that accesses the tty (such as an interactive program) then this
|
||||||
one job at a time (i.e. B<-j1>), not buffer the output (i.e. B<-u>),
|
option may be needed. It will default to starting only one job at a
|
||||||
and it will open a tty for the job. When the job is done, the next job
|
time (i.e. B<-j1>), not buffer the output (i.e. B<-u>), and it will
|
||||||
will get the tty.
|
open a tty for the job.
|
||||||
|
|
||||||
You can of course override B<-j1> and B<-u>.
|
You can of course override B<-j1> and B<-u>.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue