-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote R hanging due to stty settings #1229
Comments
@epruesse I am running a similar setup, but without the a wrapper script to launch R, and the cluster is running a different software. Right now I run the This problem might be related to: |
I had partial success with this issue by using The problem shows up again when using a shell to connect to the cluster, launching R, and calling |
@gui-salome I am using bioconda so I've got my R inside of a conda environment. I set init.el: (use-package ess
:defer t
:ensure t
:custom
(inferior-R-program-name "~/bin/run_R" "Script to redirect to cluster when on discovery")
[...] ~/bin/run_R: RFLAGS="--no-save --no-restore-history --quiet"
CORES=16
RAM=50G
ENV=R4
echo "Activating $ENV conda environment"
. ~/miniconda3/etc/profile.d/conda.sh
conda activate $ENV
if command -v srun >/dev/null 2>/dev/null; then
echo "Submitting to cluster ($CORES cores, $RAM)"
# Save stty settings (necessary for emacs/tramp)
stty_settings=$(stty --save)
exec srun --x11 --pty --mem 50G --cpus-per-task 16 bash -c "
echo Running on $HOSTNAME
echo Fixing stty...
stty $stty_settings 2>/dev/null
echo Launching $(which R) $RFLAGS $*
R --version | head -n1
R $RFLAGS $*
"
else
echo Running locally on $HOSTNAME
echo Launching $(which R) $RFLAGS $*
R --version | head -n1
exec R $RFLAGS "$@"
fi ~/.ssh/config for completeness
So I usually just ^x ^f to /ssh:discovery:/path/to/some.R and then use ^RET to launch R. |
Oh, also rather at the top of ~/.bashrc
This is to prevent it loading conda stuff (slow) for mere tramp sessions and to leave PS1 trivial. |
|
Oh, this is interesting, I didn't know that was a possibility. In my case, I was just passing the path to the right version of R I want to use. I am going to try using a similar approach here. Thanks for sharing!! |
The problem is still persisting after testing it more. As soon as |
@epruesse Have you tried reverting to the older version of Emacs you used? What version was it by the way? I did not have this issue either on the version I installed back in 2020, but I am not sure what version it was. |
You can always
No. Don't know what it was.
ESS can, and does, do way more. Although it would be good to have a fall back option to just turn everything off in case things break. Ultimately, anything rendering an entire emacs session unusable isn't good. Just know way too little about ESS and TRAMP to understand why this is happening. There are time out guards in place... |
I probably haven't used the "way more" from ESS to miss that much, but the simple execution should definitely have a fallback or simpler mechanism. |
This is eldoc. Try setting What version of ESS do you have? I recommend always running the latest devel version. |
ok you have the latest, so there seems to be a bad interaction between ESS and some property of your setup.
This disables all contextual help, like eldoc and company completions. |
My set up is vanilla. I am using the out of the box configuration of |
Do you still see that behaviour with latest dev ESS? When I run |
In my hands, that I had been experiencing such problems when running R within a bash session on a interactive slurm-allocated compute host on our_HPC_Cluster, viz: meta-x shell
meta-x ess-remote I find ess-remote fails unless I uncomment the I am unsure if there is a profitable way of ensuring that ess-remote runs in an environment in which stty is configured as required. For now I know to call |
Related to possibly #1110, #1162, #1152 and others.
After an update of emacs and ESS my remote R sessions started to hang my entire
lifeemacs. It took most of a day to figure out why, posting here mostly to document workaround and potentially inform a fix in ESS.Background: I am using TRAMP to SSH into a compute cluster and running a small wrapper script to launch R on a compute node. The cluster is running SLURM, so the wrapper script essentially does
exec srun --mem 50G -c16 -p interactive --pty PATH_TO_R --no-save --vanilla "$@"
. This worked fine with my 2020 Emacs+ESS, but failed after I brazenly upgraded to get|>
indentation support.The cause of the issue was
stty
settings. TRAMP sends a series ofstty
command early on:These settings are not kept by SLURM when redirecting to a compute node via
srun
. So within that R session on the cluster, echo was on again and erase set to backspace. Somehow this led to the hangs within ESS.A functioning workaround for slurm is running this within the wrapper:
It might help to simply run
as the very first bit inside of
LOADREMOTE
or.load.R
to ensure the pty settings are as expected.I can make a PR to that end, but this is fragile territory, what fixes things for me might break them for others.
The text was updated successfully, but these errors were encountered: