Restarting a cloud session does not clear environment

Any object that is created in a cloud project (e.g. vec <- 1:10) does not get removed after restarting the session (Shift + Cmd + 0 or Toolbar Session > Restart R). Is this expected behavior?

Restart does unload packages.

Huh. It seems that it’s necessary to have both the restore workspace setting and the save workspace data setting set to No in order for the global environment to be cleared on a session restart. Having restore workspace set to No and save workspace data set to Ask results in existing objects being reloaded. This does seem unexpected, at least to me! I don’t think I ever noticed it before because I always keep both settings on No.

(You can change these in the Global Options, too — Project Options just makes for a cleaner screenshot)

4 Likes

Thank you. I see -- it seems like this is the default on Desktop as well. I understand the reasons for not changing this default on IDE (Defaults of saving and restoring workspace).

That said, these Workspace Global Option settings in a "template" project will not carry over to subsequent creations of new projects in the same space. I wonder if this is intended as well? (cc @Robby)

In my own work I also have set these settings to "No" and "Never", which is partly why I had forgotten how the default Restart worked. Here I am using the cloud in a teaching setting, and thought changing the default so that restart clears the environment would actually be preferable.

2 Likes

We have work to do yet regarding how we handle Global & Project options in Cloud - and you're correct that Global Options currently are set per project, and do not carry over from one project to another. Here's our plan, and would love feedback on whether or not it seems like the right approach:

  • Global Options will be persistent for the user and apply across all their projects.
  • Global Options will not be copied over if a different user makes a copy of a project.
  • Project Options will be persisted per project - and WILL be copied over when a different user makes a copy of a project.

Does that sounds like the right approach? Thanks!

2 Likes

I think that is great -- so an instructor can set the project option to clear the Environment at each restart, and then students who copy/derive projects from an instructor's assignment project will inherit those settings too on their copy of that project (as per your third point).

Then we can advise them to change their Global options later on.