Skip to content

Commit 72984a5

Browse files
committed
docs: Update readme.md
1 parent 297781e commit 72984a5

2 files changed

Lines changed: 33 additions & 133 deletions

File tree

examples/science/af3-slurm/examples/simple_ipynb_launcher/Setup-post-cluster-deployment.md

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# Setup: Post-Cluster Deployment
2-
3-
This guide explains how to deploy and access the Jupyter Notebook environment for AlphaFold **after the af3-slurm.yaml cluster has already been deployed** with SLURM REST support enabled.
1+
# Setup: Setup AF3 with Simple Ipynb Launcher - PART 2: IPython notebook setup
2+
This guide explains how to deploy and access the Jupyter Notebook environment for AlphaFold **after the af3-slurm.yaml cluster has been deployed** with **SLURM REST support enabled**. If you have not followed the steps outlined in [Setup-pre-cluster-deployment.md](./Setup-pre-cluster-deployment.md) before, please do so before continuing.
43

54
## Prerequisites
6-
75
Before proceeding, ensure the following configuration values were set correctly in your `af3-slurm-deployment.yaml` file **prior to deploying the SLURM cluster**:
86

97
```yaml
@@ -12,18 +10,10 @@ slurm_rest_token_secret_name: "<your-secret-name>" # Name of your Sec
1210
af3ipynb_bucket: "<your-pre-existing-bucket-name>" # Existing Cloud Storage bucket name
1311
```
1412
15-
> [!WARNING]
16-
> This guide assumes that the SLURM cluster is already deployed with REST API support enabled—i.e., the values above were correctly set before deployment.
17-
> If any of the values above were omitted or misconfigured, you must destroy the cluster, update the deployment configuration, and redeploy. These settings are essential for enabling SLURM REST-based notebook functionality.
18-
> This document focuses exclusively on deploying and accessing the Jupyter Notebook environment **after** the cluster is running and properly configured. It does not cover modifying or redeploying the cluster.
19-
20-
If you have **not yet deployed** the cluster, or if you need help setting the appropriate variables prior to deployment, refer to [Setup-pre-cluster-deployment.md](./Setup-pre-cluster-deployment.md) guide.
21-
2213
## Deploying the Jupyter Notebook Blueprint
2314
2415
### 1. Upload the required Notebook to the Cloud Storage Bucket
25-
26-
First, access the controller node of your deployed SLURM cluster. Replace placeholders `<controller-node-name>` and `<your-zone>` with your actual node and zone.
16+
Access the controller node of your deployed cluster (replace placeholders `<controller-node-name>` and `<your-zone>` with your actual node and zone):
2717

2818
```bash
2919
gcloud compute ssh <controller-node-name> --zone=<your-zone>
@@ -37,12 +27,11 @@ ansible-playbook ipynb-upload-config.yml
3727
```
3828

3929
This step uploads the notebook (`slurm-rest-api-notebook.ipynb`) along with its required scripts and libraries to the bucket defined in the `af3ipynb_bucket` variable in `af3-slurm-deployment.yaml` file.
40-
Make sure that this bucket was created and specified during the SLURM cluster deployment process.
4130

4231
### 2. Grant Secret Access to the Notebook's Service Account
32+
**Where to run**: **On your local machine** (where the gcloud CLI is authenticated with access to your GCP project).
4333

44-
This setting ensures that the notebook server can successfully retrieve the specified secret by name.
45-
Make sure the service account running the Jupyter Notebook instance (typically the Compute Engine default service account) has permission to access the Secret Manager secret that stores your SLURM REST token.
34+
This setting ensures that the notebook server can successfully retrieve the specified secret by name. For this you need to make sure that the service account running the Jupyter Notebook instance (typically the Compute Engine default service account) has permission to access the Secret Manager secret that stores your SLURM REST token.
4635

4736
The following command grants the Compute Engine default service account the `roles/secretmanager.secretAccessor` role, allowing it to access the specified secret in Secret Manager. The attached condition always evaluates to true, ensuring access is consistently granted.
4837

@@ -57,7 +46,8 @@ You can verify this configuration in the Secret Manager section of the Google Cl
5746

5847
<img src="adm/secret-manager.png" alt="secret-manager" width="1000">
5948

60-
### 4. Launch the Notebook Environment
49+
### 3. Deploy the Notebook Environment
50+
**Where to run**: **On your local machine**, inside your cluster-toolkit directory.
6151

6252
Deploy the Jupyter Notebook environment using the following command:
6353

@@ -68,10 +58,7 @@ cd cluster-toolkit
6858
examples/science/af3-slurm/examples/simple_ipynb_launcher/af3-slurm-ipynb.yaml --auto-approve
6959
```
7060

71-
This brings up the Jupyter Notebook deployment.
72-
73-
### 5. Access the Notebook via Vertex AI Workbench
74-
61+
### 4. Access the Notebook via Vertex AI Workbench
7562
In the Google Cloud Console:
7663

7764
1. Navigate to `Vertex AI` → `Workbench` → `Instances`
@@ -80,7 +67,8 @@ In the Google Cloud Console:
8067

8168
3. Locate and open the `slurm-rest-api-notebook.ipynb` file. If you haven't modified the default value of `af3ipynb_bucket_local_mount` in the `af3-slurm-deployment.yaml`, the notebook should be available at `/home/jupyter/alphafold` folder.
8269

83-
### 6. Verify REST Token Access
70+
### 5. Verify REST Token Access
71+
**Where to run**: **Inside the JupyterLab terminal** of your deployed Vertex AI Workbench instance.
8472

8573
To verify that Secret Manager access is properly configured, open a terminal within JupyterLab and run the following command:
8674

@@ -93,7 +81,6 @@ If the command returns the secret value successfully, it confirms that the noteb
9381
<img src="adm/rest_api.png" alt="slrum rest api" width="1000">
9482

9583
## Teardown
96-
9784
To remove the Jupyter Notebook deployment when it is no longer needed, run the following command:
9885

9986
```bash
@@ -105,7 +92,10 @@ To remove the Jupyter Notebook deployment when it is no longer needed, run the f
10592
> Additionally, any Cloud Storage buckets you created (via the CLI or console) will not be automatically deleted. You are responsible for cleaning them up manually to avoid unnecessary charges.
10693
> For deleting the buckets consult [Delete buckets](https://cloud.google.com/storage/docs/deleting-buckets).
10794

108-
## Notes and Customization
95+
## Customization
10996
You can adjust the notebook setup behavior using blueprint variables in the deployment YAML.
11097
All configurations should be validated before running jobs.
11198
If further modifications to SLURM REST/API Server behavior are required, you must destroy and redeploy the cluster with the updated settings.
99+
100+
## Using the environment
101+
Go to [Ipynb.md](./Ipynb.md) for documentation on how to use the IPython environment.
Lines changed: 19 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# Setup: Pre-Cluster Deployment
2-
This guide explains how to properly set up and launch the Simple IPython Launcher environment **before deploying the `af3-slurm.yaml` cluster**.
1+
# Setup AF3 with Simple Ipynb Launcher - PART 1: specific cluster settings
2+
This guide explains the additional steps needed to deploy the AF3 solution with the Slurm REST-API required by the [Simple Ipynb launcher](./README.md).
33

4-
> **Important:** This setup documentation is intended to be followed **before** deploying the SLURM cluster (as referenced [here](../../README.md#deploy-slurm-cluster)).
5-
> If you have **already deployed** the cluster, please refer to [`post-cluster-deployment.md`](./Setup-post-cluster-deployment.md) instead.
4+
> [!NOTE]
5+
> **Important:** The steps described here are intended to be followed **before** deploying the SLURM cluster (as referenced [here](../../README.md#deploy-slurm-cluster)).
6+
> If you have **already deployed** the cluster, you should tear down the cluster and redeploy after the steps outlined here. Once your cluster is deployed, you will have to follow the steps outlined in [Setup AF3 with Simple Ipynb Launcher - PART 2: IPython notebook setup](./Setup-post-cluster-deployment.md)
67
78
## Prerequisites
89

9-
### Set up Jobs Bucket
10-
11-
If you want to use the simple service launcher, you need to create an additional bucket, that should
12-
be located in the region where you stand up your cluster:
10+
### Set up Bucket for IPython Notebook
11+
If you want to use the Simple ipynb launcher, you need to create an additional bucket for the IPython Notebook that is provided by Google Vertex AI Workbench. It should be located in the region where you stand up your cluster:
1312

1413
```bash
1514
#!/bin/bash
1615

17-
UNIQUE_JOB_BUCKET=<your-bucket>
16+
UNIQUE_AF3IPYNB_BUCKET=<your-bucket>
1817
PROJECT_ID=<your-gcp-project>
1918
REGION=<your-preferred-region>
2019

@@ -24,118 +23,29 @@ gcloud storage buckets create gs://${UNIQUE_JOB_BUCKET} \
2423
--uniform-bucket-level-access
2524
```
2625

27-
## Deploying a Jupyter Notebook for AlphaFold
28-
29-
You can deploy a Jupyter Notebook environment to run AlphaFold step-by-step. This is useful for interactive exploration and making custom modifications to the AlphaFold pipeline.
30-
31-
> **Important:** To enable the Jupyter Notebook deployment, you **must provide a cloud storage bucket**. If no bucket is specified, the notebook environment will not be created.
26+
### Configure Secret Manager
27+
The IPython notebook will need a secure connection with the Slurm REST API servers. We are using the Google Cloud Secret Manager to manage the necessary credentials in a secure way. Please follow the guideline [here](https://cloud.google.com/secret-manager/docs/create-secret-quickstart) to create a Secret Manager.
3228

33-
### Enable the SLURM REST API Server
29+
You do not need to manually add any data to the secret; the SLURM token will be automatically populated by the system.
3430

35-
Set the `slurm_rest_server_activate` value to `true` in the `af3-slurm-deployment.yaml` file to enable the SLURM REST API server on the controller node of the `af3-slurm.yaml` cluster. This allows the Jupyter Notebook environment to send requests—such as job submissions—to the SLURM scheduler via the REST API.
31+
## Modify the af3-slurm-deployment.yaml
32+
Set the `slurm_rest_server_activate` value to `true` in the `af3-slurm-deployment.yaml` file to enable the SLURM REST API server on the controller node of the `af3-slurm.yaml` cluster. This is required for the Jupyter Notebook environment to send requests —such as job submissions— to the SLURM scheduler via the REST API.
3633

3734
```yaml
3835
slurm_rest_server_activate: true
3936
```
4037
41-
### Configuring the SLURM REST API Token Secret Manager
42-
43-
Set `slurm_rest_token_secret_name` value in the `af3-slurm-deployment.yaml` with the name of an existing secret in Secret Manager. Please follow the guideline [here](https://cloud.google.com/secret-manager/docs/create-secret-quickstart) to create a Secret Manager.
44-
45-
> This setting allows you to specify the name of a Google Cloud Secret Manager secret that holds your SLURM authentication token. Using Secret Manager is a secure way to manage sensitive credentials.
38+
Set the `slurm_rest_token_secret_name` value in the `af3-slurm-deployment.yaml` with the name of the secret you created as part of the [Prerequisites](#prerequisites).
4639

4740
```yaml
4841
slurm_rest_token_secret_name: "<your-secret-name>"
4942
```
5043

51-
### Steps to Deploy
52-
53-
1. Ensure you have provided a valid cloud storage bucket in your `af3-slurm-deployment.yaml`:
54-
55-
```yaml
56-
af3ipynb_bucket: "<your-pre-existing-bucket-name>"
57-
```
58-
59-
2. Build the Jupyter notebook with `af3-slurm-ipynb.yaml`:
60-
61-
```bash
62-
# Make sure you are under `cluster-toolkit` root folder
63-
~$ cd cluster-toolkit
64-
cluster-toolkit$ ./gcluster deploy -d examples/science/af3-slurm/af3-slurm-deployment.yaml examples/science/af3-slurm/examples/simple_ipynb_launcher/af3-slurm-ipynb.yaml --auto-approve
65-
```
66-
67-
## Upload Notebook to Bucket
68-
69-
To upload the Jupyter notebook to the cloud storage bucket so it can be accessed via JupyterLab:
70-
71-
1. **SSH into controller node** in the cluster.
72-
73-
2. **Navigate to the setup directory**:
74-
75-
```bash
76-
cd /home/af3ipynb/ipynb_setup
77-
```
78-
79-
3. Run the Ansible playbook to upload the Jupyter notebook and its required library files to the designated bucket:
80-
81-
```bash
82-
ansible-playbook ipynb-upload-config.yml
83-
```
84-
85-
This playbook will upload `slurm-rest-api-notebook.ipynb` along with its associated scripts and library files to the target bucket (`af3ipynb_bucket`).
86-
Once the upload is complete, you can access the notebook from the JupyterLab interface via:
87-
88-
> Cloud Console → Vertex AI → Workbench → Instances
89-
90-
## Granting Access to the Token
44+
Set the `af3ipynb_bucket` value in the `af3-slurm-deployment.yaml` with the name of the secret you created as part of the [Prerequisites](#prerequisites).
9145

92-
> Before running this section, please complete the [**Upload Notebook to Bucket**](#upload-notebook-to-bucket) section first.
93-
94-
After the deploying steps are success, you must ensure that the appropriate service account (e.g., the default service account for the Compute Engine instance) has permission to access the secret. This step is crucial because, without access to the secret, the notebook will not be able to authenticate properly or send valid requests to the SLURM REST API.
95-
96-
If you have not granted access yet, then run the following command, replacing `<your-secret-name>` and `<your-project-id>` with your values:
97-
98-
```bash
99-
gcloud secrets add-iam-policy-binding <your-secret-name> \
100-
--member="serviceAccount:$(gcloud projects describe <your-project-id> --format='value(projectNumber)')-compute@developer.gserviceaccount.com" \
101-
--role="roles/secretmanager.secretAccessor" \
102-
--condition="expression=true,title=AlwaysTrue,description=Allow access to Secret Manager"
103-
```
104-
105-
This command grants the Compute Engine default service account the `secretAccessor` role with a condition that always evaluates to true, as shown in the image below. You can view this in the `Secret Manager` page in the Google Cloud Console.
106-
107-
<img src="adm/secret-manager.png" alt="secret-manager" width="1000">
108-
109-
This setting allows the notebook server to successfully retrieve the value of the specified secret by its name.
110-
111-
### Verify Access
112-
113-
To confirm that the service account has the necessary permissions, from the jupyter notebook workbench, you can open a terminal and run the following command:
114-
115-
```bash
116-
gcloud secrets versions access latest --secret=<your-secret-name>
117-
```
118-
119-
If the command succeeds, this confirms that your notebook can securely retrieve the authentication token from Secret Manager as shown in the image below.
120-
121-
<img src="adm/rest_api.png" alt="slrum rest api" width="1000">
122-
123-
## Custom configuration
124-
125-
You can customize settings via blueprint variables before deployment. If modifications are needed later, ensure:
126-
127-
- All required resources are available
128-
- Configuration changes within the notebook are validated before submitting new jobs.
129-
130-
## Teardown Jupyter Notebook
131-
132-
If you would like to tear down the notebook deployment, use the command below.
133-
134-
```bash
135-
./gcluster destroy af3-slurm-ipynb --auto-approve
46+
```yaml
47+
af3ipynb_bucket: "<your-pre-existing-bucket-name>"
13648
```
13749

138-
> [!WARNING]
139-
> If you do not destroy the Jupyter Notebook deployment, it may continue to incur costs.
140-
> Additionally, any Cloud Storage buckets you created (via the CLI or console) will not be automatically deleted. You are responsible for cleaning them up manually to avoid unnecessary charges.
141-
> For deleting the buckets consult [Delete buckets](https://cloud.google.com/storage/docs/deleting-buckets).
50+
## Continue to cluster deployment
51+
Go back to [Deploy Slurm Cluster](../../README.md#deploy-slurm-cluster) and deploy the cluster.

0 commit comments

Comments
 (0)