Skip to content
Snippets Groups Projects
Commit 02d04216 authored by Moe Jette's avatar Moe Jette
Browse files

-- Add new SLURM configure time parameter of --enable-salloc-background. If

    set, then salloc can execute in the background. Otherwise a message will be
    printed and the job allocation halted until brought into the foreground.
parent 6c30b354
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,9 @@ documents those changes that are of interest to users and admins.
-- BLUEGENE - Fix for bad conn-type set when running small blocks in HTC mode.
-- If salloc's --no-shell option is used, then do not attempt to preserve the
terminal's state.
-- Add new SLURM configure time parameter of --enable-salloc-background. If
set, then salloc can execute in the background. Otherwise a message will be
printed and the job allocation halted until brought into the foreground.
* Changes in SLURM 2.2.1
========================
......
......@@ -91,5 +91,22 @@ AC_DEFUN([X_AC_DEBUG], [
fi
AC_MSG_RESULT([${x_ac_partial_attach=no}])
AC_MSG_CHECKING([whether to permit salloc to execute in the background])
AC_ARG_ENABLE(
[salloc-background],
AS_HELP_STRING(--enable-salloc-background,enable salloc to execute in the background),
[ case "$enableval" in
yes) x_ac_salloc_background=yes ;;
no) x_ac_salloc_background=no ;;
*) AC_MSG_RESULT([doh!])
AC_MSG_ERROR([bad value "$enableval" for --enable-salloc-background]) ;;
esac
]
)
if test "$x_ac_salloc_background" = yes; then
AC_DEFINE(SALLOC_RUN_BACKGROUND, 1, [Define to 1 to permit salloc to run in the background.])
fi
AC_MSG_RESULT([${x_ac_salloc_background=no}])
]
)
......@@ -389,6 +389,9 @@
/* Define the project's release. */
#undef RELEASE
/* Define to 1 to permit salloc to run in the background. */
#undef SALLOC_RUN_BACKGROUND
/* Define to 1 if sched_getaffinity takes three arguments. */
#undef SCHED_GETAFFINITY_THREE_ARGS
......
......@@ -1014,6 +1014,7 @@ enable_debug
enable_memory_leak_debug
enable_front_end
enable_partial_attach
enable_salloc_background
with_slurmctld_port
with_slurmd_port
with_slurmdbd_port
......@@ -1691,6 +1692,8 @@ Optional Features:
--enable-front-end enable slurmd operation on a front-end
--disable-partial-attach
disable debugger partial task attach support
--enable-salloc-background
enable salloc to execute in the background
--enable-multiple-slurmd
enable multiple-slurmd support
 
......@@ -7202,13 +7205,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:7205: $ac_compile\"" >&5)
(eval echo "\"\$as_me:7208: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:7208: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:7211: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:7211: output\"" >&5)
(eval echo "\"\$as_me:7214: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
......@@ -8413,7 +8416,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 8416 "configure"' > conftest.$ac_ext
echo '#line 8419 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
......@@ -10202,11 +10205,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10205: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10208: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:10209: \$? = $ac_status" >&5
echo "$as_me:10212: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
......@@ -10541,11 +10544,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10544: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10547: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:10548: \$? = $ac_status" >&5
echo "$as_me:10551: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
......@@ -10646,11 +10649,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10649: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10652: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:10653: \$? = $ac_status" >&5
echo "$as_me:10656: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -10701,11 +10704,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10704: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10707: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:10708: \$? = $ac_status" >&5
echo "$as_me:10711: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -13085,7 +13088,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 13088 "configure"
#line 13091 "configure"
#include "confdefs.h"
 
#if HAVE_DLFCN_H
......@@ -13181,7 +13184,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 13184 "configure"
#line 13187 "configure"
#include "confdefs.h"
 
#if HAVE_DLFCN_H
......@@ -15137,11 +15140,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15140: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15143: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15144: \$? = $ac_status" >&5
echo "$as_me:15147: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
......@@ -15236,11 +15239,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15239: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15242: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15243: \$? = $ac_status" >&5
echo "$as_me:15246: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -15288,11 +15291,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15291: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15294: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15295: \$? = $ac_status" >&5
echo "$as_me:15298: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -19428,6 +19431,29 @@ $as_echo "#define DEBUGGER_PARTIAL_ATTACH 1" >>confdefs.h
$as_echo "${x_ac_partial_attach=no}" >&6; }
 
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to permit salloc to execute in the background" >&5
$as_echo_n "checking whether to permit salloc to execute in the background... " >&6; }
# Check whether --enable-salloc-background was given.
if test "${enable_salloc_background+set}" = set; then :
enableval=$enable_salloc_background; case "$enableval" in
yes) x_ac_salloc_background=yes ;;
no) x_ac_salloc_background=no ;;
*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: doh!" >&5
$as_echo "doh!" >&6; }
as_fn_error $? "bad value \"$enableval\" for --enable-salloc-background" "$LINENO" 5 ;;
esac
fi
if test "$x_ac_salloc_background" = yes; then
$as_echo "#define SALLOC_RUN_BACKGROUND 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${x_ac_salloc_background=no}" >&5
$as_echo "${x_ac_salloc_background=no}" >&6; }
 
if test "x$ac_debug" = "xtrue"; then
DEBUG_MODULES_TRUE=
......
......@@ -218,13 +218,17 @@ int main(int argc, char *argv[])
if ((!opt.no_shell) && isatty(STDIN_FILENO)) {
bool sent_msg = false;
is_interactive = true;
/*
* Job control: interactive sub-processes run in the foreground
* process group of the controlling terminal. In order to grant
* this (tcsetpgrp), salloc needs to be in the foreground first.
*/
while (tcgetpgrp(STDIN_FILENO) != (pid = getpgrp())) {
pid = getpgrp();
#ifdef SALLOC_RUN_BACKGROUND
if (tcgetpgrp(STDIN_FILENO) == pid)
is_interactive = true;
#else
while (tcgetpgrp(STDIN_FILENO) != pid) {
if (!sent_msg) {
error("Waiting for program to be placed in "
"the foreground");
......@@ -232,11 +236,14 @@ int main(int argc, char *argv[])
}
killpg(pid, SIGTTIN);
}
/*
* Save tty attributes and reset at exit, in case a child
* process died before properly resetting terminal.
*/
is_interactive = true;
#endif
}
/*
* Save tty attributes and reset at exit, in case a child
* process died before properly resetting terminal.
*/
if (is_interactive) {
tcgetattr (STDIN_FILENO, &saved_tty_attributes);
atexit (_reset_input_mode);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment