# Manage Notebook Lifecycle

You can run Valohai Notebooks on cloud machines, not "always ready" serverless containers. This design keeps your costs down when you're not actively working, but it means notebooks take time to start.

### Why Notebooks Take Time to Start

When you launch a notebook, Valohai provisions a fresh machine in your infrastructure. This involves:

1. Spinning up a new VM or container
2. Pulling your Docker image
3. Installing Jupyter (if not in the image)
4. Downloading input files from cloud storage

Expect **2–5 minutes** depending on:

* Your environment type (cloud auto-scale, Kubernetes, on-premise)
* Docker image size
* Input file sizes
* Current resource availability

This is a cold start. We don't keep machines hot between sessions because you'd pay for idle time.

### Stopping Your Notebook

When you stop a notebook:

1. Valohai saves the final notebook state
2. All outputs in `/valohai/outputs/` are versioned
3. The machine is released and scale down if there are no other executions in the queue
4. **Billing stops once the machine is scaled down**

You must manually stop notebooks. They don't time out automatically.

#### How to Stop

From the Valohai UI:

1. Go to the **Notebooks** tab in your project
2. Find your running notebook
3. Click **Stop**

The notebook execution moves to "Stopped" status. Your work is preserved and versioned—you can view the final `.ipynb` file and any outputs you saved.

> ⚠️ **Critical:** Notebooks left running cost the same as active training jobs, even if you're not using them. Always stop notebooks when done.

### Keeping a Machine Warm

If you need instant access and don't want to wait for cold starts, you can keep a notebook running between work sessions.

**This means:**

* Zero startup time when you return
* Your environment and installed packages persist
* **You pay for the machine continuously**, even when idle

#### When to Consider This

Keeping a machine warm makes sense if:

* You're actively iterating and need to switch in/out frequently
* The cost of idle time is less than the cost of your time waiting for restarts
* You're debugging time-sensitive issues

For most experimentation workflows, cold starts are the better choice.

### Next Steps

* [Save Your Work](/notebook-executions/save-and-version.md) — Version outputs and log metrics
* [Troubleshooting](/notebook-executions/troubleshooting.md) — Fix common notebook issues


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.valohai.com/notebook-executions/stop-restart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
