Preventing runaway costs with Cloud Environment autopause

Allie Hajian
  • Updated

To prevent runaway charges when no computational work is being done in a cloud environment, the virtual machine (VM) automatically pauses when there is no web browser or kernel activity (notebooks only) for 30 minutes. Note: Kernel activity only prevents autopause for up to 24 hours and only for notebook analyses. This article explains how autopause on Terra works by default, when you might want to override it, and how to manually override the default settings.

Autopause overview

Autopause (default) is based on browser inactivity. Browser inactivity includes:

  • Closing the browser tab that contains the still running Terra cloud environment
  • Closing your computer, which causes your laptop to go to sleep
  • If your laptop goes to sleep on its own (due to configuration settings)

Once you do any of the above and 30 minutes pass, the cloud environment autopauses.

What actions prevent the default autopause based on browser inactivity?

  • If you come back (click into the browser) before 30 minutes pass, you prevent autopause.
  • If you run a notebook analysis and the kernel is active, there is no autopause.
  • Your cloud environment will never pause if you don't close your cloud environment browser tab and your computer is set to never go to sleep. Note: This can be dangerous, as it could incur large and unanticipated costs. 

What happens after autopausing?

If you come back after 30 minutes of inactivity, you have to unpause your cloud environment, which can take up to two minutes.

You won't lose any output that was already explicitly written to a file, since the cloud environment (aka "boot disk") is not deleted. And of course, you won't lose any output you copied to an external Google bucket. However, notebook output generated while the browser is inactive will not show up in the notebook cells. 

Environment variables (such as workspace name or billing project) will be reset. For example, to do queries within a notebook, you need to rerun the cells that grab the environment variables.

How does autopause work?

  • Autopause attempts to trigger every 30 minutes when no browser activity is detected.

Notebooks only

  • If the kernel is still busy after 30 minutes, the notebook continues to run.
  • When the kernel shuts off, autopause occurs at the end of the next 30-minute interval.
  • Because the notebook isn't connected to the browser, outputs written to cells won't be visible in the notebook user interface. However, any output written to external files can be accessed directly.
  • Kernel activity only prevents autopause for 24 hours

Kernel activity prevents autopause for up to 24 hours (notebooks)

To allow long-running notebook jobs that generate output files to finish, kernel activity prevents autopause (notebooks only), even if the browser is inactive for 30 minutes.

To protect you from out-of-control costs linked with executing an operation that unintentionally keeps the kernel active, autopause pauses the Cloud Environment - even if the kernel is active - after 24 hours. 

Accessing analysis output generated when the browser is inactiveNote: In this case, because the browser is inactive, outputs written to notebook cells won't be visible in the notebook user interface. Only outputs written to files external to the notebook are retained.

How do I know the kernel is running (notebooks only)?

When the kernel autopauses, the Cloud Environment goes from Running -> Stopping -> Stopped in the user interface. In the screenshot below, you see the Cloud Environment is running. You can click the pause button to pause the Cloud Environment. 

Note: The kernel indicator icon (circled in orange) is only filled in when a cell is running in the notebook, and empty when no cells are running (i.e., when the kernel is "idle"):

Screenshots of kernel indicators highlighting a filled in dot at the top and an empty dot at the bottom

Adjusting/overriding autopause

You may want to override the default settings for autopause

  • If you want a longer or shorter autopause threshold.
  • If you are running a long RStudio or Galaxy analysis and will be away from your browser for more than half an hour.

You can adjust the minutes of activity that trigger autopause when you customize your Cloud Environment.

Screenshot of Cloud Environment configuration pane with the Enable Autopause option highlighted

Overriding autopause can leave you vulnerable to accruing considerable costsIt is important to be very careful when adjusting the default settings.

For more information, see this article on Adjusting autopause for Cloud Environments using Swagger.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.