Step 1. Install this package on your environment
pip install papermill
Step 2. Prepare a kernel that runs your notebook
conda create --name=runenv python=3.8
source /opt/conda/etc/profile.d/conda.sh
conda activate runenv
conda install ipykernel
python -m ipykernel install --user --name=runenv
Step 3. Run notebook
papermill -k runenv \
gs://andy-notebook/in/template.ipynb \
gs://andy-notebook/out/template.ipynb \
-p project_id stage-env \
-p dataset_path gs://andy-data
In this example, we use runenv to run notebook gs://andy-notebook/in/template.ipynb and pass parameters "project_id" and "dataset_path" to the notebook.The execution result will be put on GCS (gs://andy-notebook/out/template.ipynb).
That's it.
留言
張貼留言