Jupyter Notebook
Run an unmodified Jupyter Notebook container that checkpoints on suspend and resumes on browser access.
This demo runs a Jupyter Notebook on Agent Substrate. It shows how an unmodified container image (quay.io/jupyter/base-notebook) runs as a Substrate actor that checkpoints on suspend and resumes when accessed through your browser.
Prerequisites
- A Kubernetes cluster with Agent Substrate installed as in the Quickstart or Operator Install Guide.
atenet-routerconfigured with--ingress-allowed-spiffe-ids=spiffe://cluster.local/ns/ate-system/sa/atenet-client(ATE_INGRESS_ALLOWED_SPIFFE_IDS); see Ingress to actors.- A snapshot location (
SNAPSHOT_LOCATION, see Snapshot storage) and image repository (KO_DOCKER_REPO, orko.dockerRepoin--config) forate-setup deploy demo. On kind,export ATE_INSTALL_KIND=trueconfigures local defaults (gs://ate-snapshots/andlocalhost:5001) automatically.
Deploy the Jupyter Notebook Demo
go run ./cmd/ate-setup deploy demo jupyter
Creating and Accessing Your Jupyter Actor
Once the infrastructure and template are deployed, you can create instances (actors) of Jupyter Notebook.
1. Create the Actor
First, ensure you have the kubectl-ate CLI installed:
go install ./cmd/kubectl-ate
The deploy created the jupyter actor template in the ate-demo-jupyter
atespace. Create your jupyter-notebook actor there (--template names the
template in the actor’s atespace):
kubectl ate create actor jupyter-notebook -a ate-demo-jupyter --template jupyter
2. Access Jupyter via the Proxy
Start the local actor proxy:
Keep this running in a separate terminal:
kubectl ate proxy actor jupyter-notebook 8888:80 -a ate-demo-jupyterVerify from the command line or open your browser:
Query the Jupyter Server
/apiendpoint to wake the actor and confirm it is serving (HEAD /labviacurl -Ireturns405 Method Not Allowed):curl -s http://localhost:8888/apiOr open your web browser and visit
http://localhost:8888/lab.
The JupyterLab interface opens without a password because the template passes --ServerApp.token='' and --ServerApp.password=''.
Create a new notebook and try running:
print("hello world")
3. Suspending and Resuming the Notebook
When you are finished using the notebook, checkpoint and suspend the actor:
kubectl ate suspend actor jupyter-notebook -a ate-demo-jupyter
Check the actor status to confirm it is suspended:
kubectl ate get actor jupyter-notebook -a ate-demo-jupyter
The STATE column shows ACTOR_STATE_SUSPENDED.
To resume the notebook, you can either explicitly resume it via CLI:
kubectl ate resume actor jupyter-notebook -a ate-demo-jupyter
Or refresh http://localhost:8888/lab in your browser (or run curl -s http://localhost:8888/api) while the actor is suspended. atenet-router automatically resumes the actor from its snapshot and serves the request.
Clean up
Stop the kubectl ate proxy actor process in your proxy terminal, then uninstall the demo deployment. This deletes the demo’s actors, the jupyter actor template, the ate-demo-jupyter atespace, the jupyter WorkerPool, and the ate-demo-jupyter namespace:
go run ./cmd/ate-setup delete demo jupyter