Select Ctrl+S or right-click, and then save the file with the .ipynb extension.
Open the file in Azure Data Studio.
Set up a parameterized notebook
You can begin with the example notebook open in Azure Data Studio or complete the following steps to create a notebook. Then, try using different parameters. All the steps run inside an Azure Data Studio notebook.
Verify that Kernel is set to Python 3:
Make a new code cell. Select Parameters to tag the cell as a parameters cell.
After all cells are run, the output will look similar to this example:
Save the notebook as Input.ipynb:
Execute a Papermill notebook
You can execute Papermill in two ways:
Command-line interface (CLI)
Python API
Parameterized CLI execution
To execute a notebook by using the CLI, in the terminal, enter the papermill command with the input notebook, the location for the output notebook, and options.
papermill Input.ipynb Output.ipynb -p x 10 -p y 20
This command executes the input notebook with new values for parameters x and y.
A new cell labeled # Injected-Parameters contains the new parameter values that were passed in via the CLI. The new # Injected-Parameters values are used for the new output that's shown in the last cell:
Add a new code cell. Then, use the Papermill Python API to execute and generate the output parameterized notebook:
Python
import papermill as pm
pm.execute_notebook(
'/Users/vasubhog/GitProjects/AzureDataStudio-Notebooks/Demo_Parameterization/Input.ipynb',
'/Users/vasubhog/GitProjects/AzureDataStudio-Notebooks/Demo_Parameterization/Output.ipynb',
parameters = dict(x = 10, y = 20)
)
A new cell labeled # Injected-Parameters contains the new parameter values that were passed in. The new # Injected-Parameters values are used for the new output that's shown in the last cell:
Manage data ingestion and preparation, model training and deployment, and machine learning solution monitoring with Python, Azure Machine Learning and MLflow.