Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Papermill to run notebook #5

Open
SammyAgrawal opened this issue Aug 6, 2024 · 4 comments
Open

Use Papermill to run notebook #5

SammyAgrawal opened this issue Aug 6, 2024 · 4 comments

Comments

@SammyAgrawal
Copy link

Can you run a notebook as a job and save the output of each cell?

@norlandrhagen
Copy link

My co-worker used papermill a while ago on our CMIP6 work. This example notebook might be helpful: https://github.com/carbonplan/cmip6-downscaling/blob/7957fc1e086574ba8a9ff16cb5d810b580f742f5/notebooks/run_analyses.ipynb#L10

@jbusecke
Copy link
Contributor

jbusecke commented Aug 6, 2024

Anything you find here would be very valuable to document, even if it is just linking existing resources.

@SammyAgrawal
Copy link
Author

Running Papermill example notebook from the docs worked great, as did running from python file.

import papermill as pm
import json

pdict = dict(alpha=0.6, num_steps=10)
with open('param_test.json', 'w') as f:
    json.dump(pdict, f, indent=2)

with open('param_test.json', 'r') as f:
    pdict_loaded = json.load(f)


pm.execute_notebook(
    'notebook_test.ipynb',
    'output.ipynb', 
    parameters = pdict_loaded
)

Output is saved to external notebook.
My next tests:

  • upload papermill to a custom docker image on quay
  • test alongside kbatch

@SammyAgrawal
Copy link
Author

blocked: how to load output ipynb and place into user directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants