Long-running cells

Some data analysis workflows require long-running tasks. This page explains what happens to your session if you run code that takes a long time to execute.

When you run code on DataLab, you run this code in an isolated environment on one of DataCamp-managed cloud servers, called a 'session'. When you are no longer working in your workbook for a while, your session will stop to avoid paying for unused server capacity.

When your session stops, all the variables in your notebook are gone. Any files that your code created will be saved and available for the next time when you open your workbook.

So when does the session stop?

  • For free users, the session will stop if there is no code running, and the last code cell execution or notebook edit happened:

    • 30 minutes ago if you still have the workbook open in a browser tab.

    • 5 minutes ago if you don't have the workbook open in a browser tab.

    Regardless of code running, your session will stop 24 hours after being started.

  • For paying users, the session will stop if there is no code running, and the last code cell execution or notebook edit happened:

    • 2 hours ago if you still have the workbook editor open in a browser tab.

    • 5 minutes ago if you don't have the workbook open in a browser tab.

In other words, if you are running cells that take a long time to complete, this cell will continue running until completion, after which you still have some time to pick up the work again.

Examples

Example 1: Mia is a free DataLab user and starts a workbook that does some hyperparameter tuning for a random forest regression model, which takes 4 hour to complete. She leaves the workbook tab open and comes back 10 minutes after the tuning step completed. The workbook session is still active, so Mia can interactively explore the variables that were created during the hyperparameter tuning. Mia then goes for dinner and returns back to her workbook. She finds that her workbook session closed, since she has been idle for more than 30 minutes. She can still view the notebook and other files in her workbook, but the variables are gone.

Example 2: Same as example 1, but Mia doesn't leave the workbook tab open and instead closes it. When Mia comes back 10 minutes after the tuning step completed, she'll find that her workbook session is shut down because the last code cell execution was more than 5 minutes ago. She can still view the notebook and other files in her workbook, but the variables are gone. To make sure that Mia doesn't lose the work of the hyperparameter tuning, she can update her code to save the final outcome to disk, so she can load it and continue working where she left off.

Last updated