Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

In On this page:

Table of Contents

...

Overview

As you work in RStudio, occasionally you might need to remove an active RStudio session in IDAS. This is useful if, for example, your RStudio session is struggling to load a previous workspace and you get a gray screen. Deleting the active session may allow your RStudio to start from a clean slate and load successfully.Image Removed

...

Remove an Active Session in RStudio

1. Log in to IDAS from https://notebooks.hpc.uiowa.edu/


2. Go to the Jupyter Notebook page JupyterLab interface for your IDAS session. 

a) If you are using the "Interactive Research" instance in IDAS, navigate to the following URL (fill in your HawkID):

Code Block
languagebash
https://notebooksidas.hpc.uiowa.edu/research-interactive/user/HAWKID/treelab

b) If you are using a class in IDAS,

  • First, note that the URL of the IDAS tab in your web browser follows the following format - https://notebooks.hpc.uiowa.edu/CLASS-NUMBER/user/HAWKID/rstudio/

  • Change the end of the URL from

    "

    rstudio

    "

    to

    "tree"

    lab, so that it looks like the following with your class number and your HawkID:

Code Block
languagebash
https://notebooks.hpc.uiowa.edu/CLASS-NUMBER/user/HAWKID/treelab/
  • Then press Enter. You will be redirected to a

    Jupyter Notebook

    JupyterLab page.


23. Start a Terminal session in IDAS.

  • In the upper right corner of the page, click New / Terminal to start a bash session:

        2020-01-21-new-button-terminal.pngImage Removed

...

  • Click the Terminal tile under Other in your JupyterLab page::

...

4. In Terminal, go to the directory where the active R sessions are stored. This directory will change depending on the R version you are using.

a) If you are using R version 3.6:

Code Block
languagebash
cd ~/.rstudio/sessions/active

b) If you are using R version 4.0 and later:

Code Block
languagebash
cd ~/.local/share/rstudio/sessions/active

45. View the active R sessions:

Code Block
languagebash
ls -a

The output of this command will show you the active sessions. For example, the output below shows the active session's name is "session-88cf35c4":

Code Block
languagebash
grudderham@idas-research-grudderham:~/.rstudio/sessions/active$ ls -a
.  ..  session-88cf35c4

56. Remove Move the active session(s) using the output from the previous step. Note that the name "session-88cf35c4" was in the output of the previous step. In this example, we are moving the active session to a folder called backup in the home directory. This will allow us to look back at the active session later if needed.

Code Block
languagebash
rm -r# create a folder called "backup" in your home directory
# skip this command if you have created the folder "backup" previously
mkdir ~/backup

# move the active session to the folder called "backup"
mv session-88cf35c4 ~/backup

67. Restart your IDAS session using the steps here:

...

8. If this doesn't help, you may need to reset your RStudio's state using the steps here: Resetting RStudio: https://uiowa.atlassian.net/wiki/x/wIaPB

Preventing Issues

1.  Changing R settings

It may be helpful to If you have very large objects in your RStudio workspace, RStudio may struggle to load them. In that case, you can change the settings in your RStudio session, so that every time your RStudio session starts , it starts on a clean slate instead of loading a previous workspace. Some users never changed this setting and that may be fine. However, issues may occur if you have very large objects in your previous workspace and RStudio struggles to load them

If you choose to use this setting, please also consider saving important R objects with the R commands saveRDS() and readRDS(). For more details, see https://uiowa.atlassian.net/wiki/spaces/hpcdocs/pages/76515046/Removing+Active+Sessions+in+RStudio#2.-Saving-your-R-objects.

In RStudio, select Tools -> Global Options -> uncheck the box “Restore .RData into workspace at startup”. 

Image previewImage Removed

...

For more information about different settings in RStudio, please see this support article from RStudio/Posit: https://support.posit.co/hc/en-us/articles/200549016-Customizing-the-RStudio-IDE.

2. Saving your R objects

You may want to save certain R objects, especially if those objects took a long time to create with your code. You can selectively save important R objects with the R commands saveRDS() and readRDS().

Contact

If you have any questions or comments, please contact research-computing@uiowa.edu.