Dear Dorian,

Thank you for analyzing the problem and providing the patch. Your patch looks good to me, at least for Linux. In order to limit the risk of this change, I have applied it to version 15.08. You will need to use the patch with earlier versions of Slurm. The commit is here:
https://github.com/SchedMD/slurm/commit/03e156c525730c79232cdc822fdab37951ecb719

Thanks!

Quoting Dorian Krause <[email protected]>:
Dear all,

we noticed that debugX() and error() calls in srun mess up the output if the --pty flag is used. The reason for this behavior is that srun sets the terminal in raw mode and disables output processing. This is fine for the output forwarded from the remote damon but not for local printf()s by the srun process. This problem can be circumented by re-enabling OPOST after the cfmakeraw() call in srun(). A patch is pasted at the bottom of the mail. It works nicely on Linux but I am not 100% sure it may not have some undesirable side effects on other platforms.

Best regards,
Dorian


Example with current HEAD:

# /usr/local/slurm/bin/srun -v -n 1 --pty false
[snip]
srun: jobid 10: nodes(1):`node1', cpu counts: 1(x1)
srun: launching 10.0 on host node1, 1 tasks: 0
srun: route default plugin loaded srun: Node node1, 1 tasks started srun: Received task exit notification for 1 task (status=0x0100). srun: error: node1: task 0: Exited with exit code 1 #
Example with the patch applied:

# /usr/local/slurm/bin/srun -v -n 1 --pty false
[snip]
 srun: jobid 11: nodes(1):`node1', cpu counts: 1(x1)
srun: launching 11.0 on host node1, 1 tasks: 0
srun: route default plugin loaded
srun: Node node1, 1 tasks started
srun: Received task exit notification for 1 task (status=0x0100).
srun: error: node1: task 0: Exited with exit code 1
#

--------------------------------------------------------------------------------

index cad6fd8..9a6af34 100644
--- a/src/srun/srun.c
+++ b/src/srun/srun.c
@@ -252,6 +252,9 @@ int srun(int ac, char **av)
                tcgetattr(fd, &term);
                /* Set raw mode on local tty */
                cfmakeraw(&term);
+               /* Re-enable output processing such that debug() and
+                * and error() work properly. */
+               term.c_oflag |= OPOST;
                tcsetattr(fd, TCSANOW, &term);
                atexit(&_pty_restore);



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


--
Morris "Moe" Jette
CTO, SchedMD LLC
Commercial Slurm Development and Support

Reply via email to