Attention: If using a Notebook Runtime Environment created before August 1, 2019, the new "Edit" and "Playground" modes are incompatible and further action is required. Please keep reading for next steps. Otherwise, please skip ahead to the "What is a Notebook "Lock"?" section to learn about the new features!
When a Notebook is opened in an incompatible Runtime Environment, the edit functionality is disabled (shown below in screenshot). Selecting "Edit (Disabled)" will prompt the user to choose between "Recreate Notebook Runtime" and "Run in Playground Mode". The former will delete the old Runtime Environment and create a new compatible one and the latter will open the Notebook in "Playground" mode where users can access and copy any previously generated outputs to a permanent location before deleting and re-creating Runtime Environments (See below for full details of "Playground" mode). A compatible Runtime is required to open Notebooks in full "Edit" mode.
When opening a Notebook in "Playground" mode (from an incompatible Runtime Environment) users will see a banner prompting to re-create the Runtime environment. If any outputs were generated in an old Runtime that need to be saved, access them from Playground state and copy them to a permanent location using the steps outlined in the "Copying Notebook output to a Google bucket" document. Once desired data is saved, delete and re-create the incompatible Runtime to access "Edit" mode.
What is a Notebook "Lock"?
When multiple users have access to the same Notebook in a single workspace, the "lock" prevents multiple users from editing and overwriting each others’ work. In order to protect users from this problem, we have developed a feature to make it possible for one user to edit the version of the Notebook that persists (and is autosaved frequently), and others to confidently interact with the same code without harming the persistent version.
"Lock" mode protects Notebook users from overwriting each other
When a user with “Writer” access opens a Notebook in “Edit” Mode, the Notebook becomes "locked". When “locked”, a second user cannot open the Notebook in "Edit" mode. You can see whether a Notebook is “locked” by the presence of the lock icon in the corner of the Notebook's title card, as shown below.
Above: The lock icon indicates that another user is currently using the Notebook in "Edit" mode. Hovering over the icon shows the email of the user currently editing the notebook.
What options are available when a Notebook is "locked"?
This does NOT mean the next user loses the ability to open or interact with the Notebook! They have three options for opening the Notebook, even while it is locked by another user:
- Preview (Read Only) option allows you to open a Notebook in read-only mode based on the last saved version. This is the same as preview mode shown while a Notebook is starting up, and is available when the Notebook is "locked" or "unlocked".
- Playground Mode allows you to open and use/edit a Notebook, but not save changes - whatever happens in playground mode will be lost, unless you download a copy from the "File" -> "Download" menu, and is also available whether the Notebook is "locked" or "unlocked". We encourage users to use Playground Mode in situations when a notebook needs to be run, rather than edited.
- Copying the Notebook allows you to create a duplicate of the desired notebook and access “Edit” Mode of the copy.
If a user attempts to open a "locked" Notebook, a pop-up will prompt them to either launch the Notebook in Playground Mode, or to make a new copy of the Notebook, which will open in regular “Edit” Mode. If the user clicks "Cancel" in the pop-up, they will remain on the “Preview” mode.
Above: Click on "Edit (In Use)" and the UI informs of current activity and also prompts between the option to "Make a Copy" and "Run in Playground Mode". Users can open the Notebook copy with regular "Edit".
1. "Preview (Read Only)"
In a "Preview (Read Only)" state, the Notebook can be viewed but no edits can be made. This is useful for quick review of the contents of a Notebook.
Above: The Notebook is current in Preview (Read Only) mode and the Notebook is rendered as simple text that cannot be modified.
"Locked" Notebooks can be accessed in "Playground" mode where code can be modified and cells can be executed, but changes cannot be saved to the original copy. However the "Playground" edits can be saved by downloading the Notebook from the "File" -> "Download" menu.
Above: A Notebook opened in "Playground" mode will have notation in orange to denote the transient mode where changes are not saved.
Getting Back to "Edit" mode
Once the user who locked the Notebook closes their “Edit” mode instance, the lock icon will disappear indicating that the Notebook is "unlocked" another user is now free to edit. The tabs along the top of the Notebook provide a quick way to toggle between “Edit”, “Playground”, and “Preview” modes.