Skip to content

Commit

Permalink
Coiled notebook (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjoseph92 authored May 5, 2021
1 parent 5fc07c0 commit b5d9101
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
`on Github <https://github.com/gjoseph92/stackstac/blob/main/docs/{{
"../" + docname if docname.startswith("examples") else docname
}}>`_.
Or, `click here <https://cloud.coiled.io/gjoseph92/jobs/stackstac>`_
to run these notebooks on Coiled with access to Dask clusters.
"""

# TODO enable binder once Coiled supports websocket clusters over 443.
Expand Down
6 changes: 3 additions & 3 deletions examples/gif.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
],
"source": [
"cluster = coiled.Cluster(\n",
" name=\"gjoseph92/stackstac\",\n",
" software=\"stackstac\",\n",
" name=\"stackstac-eu\",\n",
" software=\"gjoseph92/stackstac\",\n",
" backend_options={\"region\": \"eu-central-1\"},\n",
" # ^ Coiled doesn't yet support Azure's West Europe region, so instead we'll run on a nearby AWS data center in Frankfurt\n",
" n_workers=20,\n",
Expand Down Expand Up @@ -3816,4 +3816,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
4 changes: 2 additions & 2 deletions examples/show.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
"source": [
"cluster = coiled.Cluster(\n",
" name=\"stackstac\",\n",
" software=\"stackstac-show\",\n",
" n_workers=25,\n",
" software=\"gjoseph92/stackstac\",\n",
" n_workers=22,\n",
" scheduler_cpu=2,\n",
" backend_options={\"region\": \"us-west-1\"},\n",
")\n",
Expand Down
33 changes: 33 additions & 0 deletions scripts/coiled-notebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import subprocess

from pathlib import Path
import coiled

if __name__ == "__main__":
proc = subprocess.run(
"poetry export --without-hashes -E binder -E viz",
shell=True,
check=True,
capture_output=True,
text=True,
)
deps = proc.stdout.splitlines()

# TODO single-source the version! this is annoying
version = subprocess.run(
"poetry version -s", shell=True, check=True, capture_output=True, text=True
).stdout.strip()
deps += [f"stackstac[binder,viz]=={version}"]

examples = Path(__file__).parent.parent / "examples"
docs = Path(__file__).parent.parent / "docs"
notebooks = list(examples.glob("*.ipynb")) + list(docs.glob("*.ipynb"))
print(notebooks)
coiled.create_notebook(
name="stackstac",
pip=deps,
cpu=2,
memory="8 GiB",
files=notebooks,
description="Example notebooks from the stackstac documentation (https://stackstac.readthedocs.io/en/stable/)",
)

0 comments on commit b5d9101

Please sign in to comment.