j1-template 2022.1.3 → 2022.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_layouts/default.html +2 -1
- data/_layouts/notebook.html +68 -0
- data/assets/data/jupyter/notebooks/climate-change-forecast.html +797 -0
- data/assets/data/jupyter/notebooks/climate-change-forecast.ipynb +709 -0
- data/assets/data/jupyter/notebooks/interactive.html +268 -0
- data/assets/data/jupyter/notebooks/interactive.ipynb +212 -0
- data/assets/data/jupyter/notebooks/odes-in-python.html +557 -0
- data/assets/data/jupyter/notebooks/odes-in-python.ipynb +14825 -0
- data/assets/data/jupyter/notebooks/odes-selected.html +122 -0
- data/assets/data/jupyter/notebooks/odes-selected.ipynb +14427 -0
- data/assets/themes/j1/adapter/js/nbinteract.js +442 -0
- data/assets/themes/j1/adapter/js/scroller.js +0 -2
- data/assets/themes/j1/core/css/nbinteract-tutorial/styles.css +1711 -0
- data/assets/themes/j1/core/css/nbinteract-tutorial/styles.min.css +1 -0
- data/assets/themes/j1/core/css/themes/bootstrap/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/themes/theme_vapor/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
- data/assets/themes/j1/modules/nbInteract/css/nbinteract/nbinteract-core.css +179 -0
- data/assets/themes/j1/modules/nbInteract/css/nbinteract/nbinteract-core.min.css +15 -0
- data/assets/themes/j1/modules/nbInteract/js/mathjax/latest.js +19 -0
- data/assets/themes/j1/modules/nbInteract/js/mathjax/tex-chtml-full.js +34 -0
- data/assets/themes/j1/modules/nbInteract/js/mathjax/tex-chtml.js +1 -0
- data/assets/themes/j1/modules/nbInteract/js/mathjax/tex-mml-chtml.js +1 -0
- data/assets/themes/j1/modules/nbInteract/js/nbinteract/_new/nbinteract-core.js +108 -0
- data/assets/themes/j1/modules/nbInteract/js/nbinteract/_new/nbinteract-core.js.map +1 -0
- data/assets/themes/j1/modules/nbInteract/js/nbinteract/_new/nbinteract-core.min.js +108 -0
- data/assets/themes/j1/modules/nbInteract/js/nbinteract/_old/index.bundle.js.map +1 -0
- data/assets/themes/j1/modules/nbInteract/js/nbinteract/_old/nbinteract-core.js +92 -0
- data/assets/themes/j1/modules/nbInteract/js/nbinteract/nbinteract-core.js +94 -0
- data/assets/themes/j1/modules/nbInteract/js/nbinteract/nbinteract-core.js.map +1 -0
- data/assets/themes/j1/modules/spinner/css/spin.css +57 -0
- data/assets/themes/j1/modules/spinner/css/spin.min.css +19 -0
- data/assets/themes/j1/modules/spinner/js/spin.js +220 -0
- data/assets/themes/j1/modules/spinner/js/spin.min.js +19 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/notebooks.yml +41 -0
- data/lib/starter_web/_data/modules/notebooks.yml +130 -0
- data/lib/starter_web/_data/resources.yml +29 -1
- data/lib/starter_web/_includes/attributes.asciidoc +4 -0
- data/lib/starter_web/_includes/tables/jekyll_variables.asciidoc +1 -1
- data/lib/starter_web/_includes/tables/template_variables.asciidoc +3 -3
- data/lib/starter_web/_plugins/asciidoctor-extensions/nodebook-block.rb +44 -0
- data/lib/starter_web/_plugins/filters.rb +4 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/_plugins/prettify.rb +0 -1
- data/lib/starter_web/assets/images/badges/docsBinder.png +0 -0
- data/lib/starter_web/assets/images/badges/myBinder.png +0 -0
- data/lib/starter_web/assets/images/badges/scaleable/binder.svg +2 -0
- data/lib/starter_web/assets/images/badges/scaleable/docsBinder.svg +138 -0
- data/lib/starter_web/assets/images/badges/scaleable/myBinder.svg +147 -0
- data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.jpg +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.png +0 -0
- data/lib/starter_web/assets/images/pages/nbinteract/jupyterlab-architecture.jpg +0 -0
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/jupyter/binderhub-api.adoc +522 -0
- data/lib/starter_web/pages/public/jupyter/climate-change.adoc +90 -0
- data/lib/starter_web/pages/public/jupyter/interactive.adoc +96 -0
- data/lib/starter_web/pages/public/jupyter/jupyterlab-services.adoc +224 -0
- data/lib/starter_web/pages/public/jupyter/nbinteract.adoc +170 -0
- data/lib/starter_web/pages/public/jupyter/odes-selected.adoc +90 -0
- data/lib/starter_web/pages/public/jupyter/tutorial_interact.adoc +90 -0
- data/lib/starter_web/utilsrv/_defaults/package.json +2 -2
- data/lib/starter_web/utilsrv/package.json +2 -2
- metadata +49 -2
@@ -0,0 +1,522 @@
|
|
1
|
+
---
|
2
|
+
title: Binder
|
3
|
+
tagline: BinderHub API
|
4
|
+
date: 2022-03-28 00:00:00
|
5
|
+
description: >
|
6
|
+
Things you should know about this site,
|
7
|
+
the people and the software and/or
|
8
|
+
services provided.
|
9
|
+
|
10
|
+
categories: [ Software, Python ]
|
11
|
+
tags: [ Binder, API ]
|
12
|
+
|
13
|
+
scrollbar: true
|
14
|
+
|
15
|
+
permalink: /pages/public/binderhub-api/
|
16
|
+
regenerate: false
|
17
|
+
|
18
|
+
resources: [
|
19
|
+
animate, clipboard, lightbox, rouge
|
20
|
+
]
|
21
|
+
resource_options:
|
22
|
+
- attic:
|
23
|
+
padding_top: 400
|
24
|
+
padding_bottom: 50
|
25
|
+
opacity: 0.5
|
26
|
+
slides:
|
27
|
+
- url: /assets/images/modules/attics/runner-1920x1200.jpg
|
28
|
+
---
|
29
|
+
|
30
|
+
// Page Initializer
|
31
|
+
// =============================================================================
|
32
|
+
// Enable the Liquid Preprocessor
|
33
|
+
:page-liquid:
|
34
|
+
|
35
|
+
// Set (local) page attributes here
|
36
|
+
// -----------------------------------------------------------------------------
|
37
|
+
// :page--attr: <attr-value>
|
38
|
+
:badges-enabled: false
|
39
|
+
:binder-badge-enabled: true
|
40
|
+
|
41
|
+
// Load Liquid procedures
|
42
|
+
// -----------------------------------------------------------------------------
|
43
|
+
{% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
|
44
|
+
|
45
|
+
// Load page attributes
|
46
|
+
// -----------------------------------------------------------------------------
|
47
|
+
{% include {{load_attributes}} scope="global" %}
|
48
|
+
|
49
|
+
|
50
|
+
// Page content
|
51
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
52
|
+
ifeval::[{badges-enabled} == true]
|
53
|
+
{badge-j1--license} {badge-j1--version-latest} {badge-j1-gh--last-commit} {badge-j1--downloads}
|
54
|
+
endif::[]
|
55
|
+
|
56
|
+
// Include sub-documents (if any)
|
57
|
+
// -----------------------------------------------------------------------------
|
58
|
+
ifeval::[{binder-badge-enabled} == true]
|
59
|
+
image:/assets/images/badges/myBinder.png[[Binder, link="https://mybinder.org/", {browser-window--new}]
|
60
|
+
image:/assets/images/badges/docsBinder.png[[Binder, link="https://mybinder.readthedocs.io/en/latest/", {browser-window--new}]
|
61
|
+
endif::[]
|
62
|
+
|
63
|
+
== User Guide
|
64
|
+
|
65
|
+
Binder allows you to create custom *computing environments* that can be
|
66
|
+
shared and used by many remote users. You can use many open source languages,
|
67
|
+
<<Configure the user interface>>, and more. A Binder service is powered by
|
68
|
+
https://github.com/jupyterhub/binderhub[BinderHub, {browser-window--new}],
|
69
|
+
an open-source tool that runs on *Kubernetes*, a portable, extensible,
|
70
|
+
open-source platform for managing containerized services. One
|
71
|
+
such deployment lives at https://mybinder.org/[mybinder.org, {browser-window--new}],
|
72
|
+
and is *free* to use.
|
73
|
+
|
74
|
+
For more information about the mybinder.org deployment and the team
|
75
|
+
that runs it, see https://mybinder.readthedocs.io/en/latest/about/about.html[About mybinder.org, {browser-window--new}].
|
76
|
+
|
77
|
+
=== Configuration Files
|
78
|
+
|
79
|
+
The `repo2docker` CLI looks for configuration files in the repository being
|
80
|
+
built to determine how to build it. In general, repo2docker uses the same
|
81
|
+
configuration files as other software installation tools, rather than
|
82
|
+
creating new custom configuration files. A number of repo2docker configuration
|
83
|
+
files can be combined to compose more complex setups.
|
84
|
+
|
85
|
+
The https://github.com/binder-examples[binder examples, {{browser-window--new}}]
|
86
|
+
organization on GitHub contains a list of sample repositories for common
|
87
|
+
configurations that repo2docker can build with various configuration files
|
88
|
+
such as Python and R installation in a repository.
|
89
|
+
|
90
|
+
Binder examples:
|
91
|
+
|
92
|
+
* https://github.com/jupyterlab/jupyterlab-demo[JupyterLab Demonstration, {browser-window--new}]
|
93
|
+
* https://github.com/binder-examples/jupyterlab[JupyterLab + Binder, {browser-window--new}]
|
94
|
+
// * https://github.com/binder-examples/remote_storage[Remote Storage with Binder, {browser-window--new}]
|
95
|
+
* https://github.com/binder-examples/python-conda_pip[Using conda with pip in the same build, {browser-window--new}]
|
96
|
+
* https://github.com/binder-examples/pipfile[Python environment with Pipfile, {browser-window--new}]
|
97
|
+
|
98
|
+
A list of supported
|
99
|
+
configuration files (roughly in the order of build priority) can be found
|
100
|
+
below.
|
101
|
+
|
102
|
+
==== environment.yml
|
103
|
+
|
104
|
+
The `environment.yml` configuration is the standard configuration file used
|
105
|
+
by *Conda* that lets you install any kind of package, including Python, R,
|
106
|
+
and C/C++ packages. The `repo2docker` does *not* use your environment.yml
|
107
|
+
to create and activate a new conda environment. Rather, it updates a base
|
108
|
+
conda environment defined here with the packages listed in your
|
109
|
+
`environment.yml`. This means that the environment will always have the
|
110
|
+
same default name, not the name specified in your `environment.yml`.
|
111
|
+
|
112
|
+
[source, yaml]
|
113
|
+
----
|
114
|
+
dependencies:
|
115
|
+
- ipywidgets
|
116
|
+
- matplotlib
|
117
|
+
- numpy
|
118
|
+
- scipy
|
119
|
+
- pandas
|
120
|
+
- seaborn
|
121
|
+
- statsmodels
|
122
|
+
----
|
123
|
+
|
124
|
+
If you use `environment.yml`, then Binder will use a *Miniconda* distribution
|
125
|
+
to install your packages. However, you may still want to use *pip*. In this
|
126
|
+
case, you should *not* use a `requirements.txt` file, but instead use a pip
|
127
|
+
*section* in `environment.yml`. This repository is an example of how to
|
128
|
+
construct your configuration to accomplish this.
|
129
|
+
|
130
|
+
[source, yaml]
|
131
|
+
----
|
132
|
+
channels:
|
133
|
+
- conda-forge
|
134
|
+
- defaults
|
135
|
+
dependencies:
|
136
|
+
- python
|
137
|
+
- numpy
|
138
|
+
- pip
|
139
|
+
- pip:
|
140
|
+
- nbgitpuller
|
141
|
+
- sphinx-gallery
|
142
|
+
- pandas
|
143
|
+
- matplotlib
|
144
|
+
----
|
145
|
+
|
146
|
+
==== requirements.txt
|
147
|
+
|
148
|
+
This configuration specifies a list of *Python packages* that should be
|
149
|
+
installed in your environment. Our requirements.txt example on GitHub shows
|
150
|
+
a typical requirements file.
|
151
|
+
|
152
|
+
For Binder, the requirements.txt file should list all Python libraries that
|
153
|
+
your notebooks depend on, and they will be installed using:
|
154
|
+
|
155
|
+
pip install -r requirements.txt
|
156
|
+
|
157
|
+
The base Binder image contains *no extra* dependencies, so be as explicit
|
158
|
+
as possible in defining the packages that you need. This includes specifying
|
159
|
+
explicit versions wherever possible.
|
160
|
+
|
161
|
+
WARNING: If you do specify *strict versions*, it is important to do so
|
162
|
+
for all your dependencies, not just direct dependencies. Strictly specifying
|
163
|
+
only some dependencies is a recipe for environments breaking over time.
|
164
|
+
|
165
|
+
You can also specify which Python *version* to install in your built
|
166
|
+
environment with `environment.yml`. By default, repo2docker installs
|
167
|
+
*default_python* (Python 3.7) with your `environment.yml` unless you
|
168
|
+
include the version of Python in this file. The package manager *conda*
|
169
|
+
supports all versions of Python, though repo2docker support is best with
|
170
|
+
Python `3.7`, `3.6`, `3.5` and `2.7`.
|
171
|
+
|
172
|
+
WARNING: If you include a Python version in a `runtime.txt` file in
|
173
|
+
*addition* to your `environment.yml`, your `runtime.txt` will be
|
174
|
+
*ignored*.
|
175
|
+
|
176
|
+
|
177
|
+
==== runtime.txt
|
178
|
+
|
179
|
+
Sometimes you want to specify the *version* of the runtime (e.g. the version
|
180
|
+
of Python), but the environment specification format will not let you
|
181
|
+
specify this information (e.g. requirements.txt). For these cases, we have a
|
182
|
+
special file, runtime.txt.
|
183
|
+
|
184
|
+
NOTE: runtime.txt is only supported when used with environment specifications
|
185
|
+
that do not already support specifying the runtime. If using environment.yml
|
186
|
+
for conda, runtime.txt will be ignored.
|
187
|
+
|
188
|
+
|
189
|
+
=== Configure the user interface
|
190
|
+
|
191
|
+
You can build several user interfaces into the resulting Docker image. This
|
192
|
+
is controlled with various <<Configuration Files>>.
|
193
|
+
|
194
|
+
==== JupyterLab
|
195
|
+
|
196
|
+
JupyterLab is the *default* interface for repo2docker. The following
|
197
|
+
Binder URL will open the pyTudes repository and begin a JupyterLab session
|
198
|
+
in the ipynb folder:
|
199
|
+
|
200
|
+
https://mybinder.org/v2/gh/norvig/pytudes/HEAD?urlpath=lab/tree/ipynb
|
201
|
+
|
202
|
+
The /tree/ipynb above is how JupyterLab directs you to a specific file or
|
203
|
+
folder. To learn more about URLs in JupyterLab and Jupyter Notebook, visit
|
204
|
+
http://jupyterlab.readthedocs.io/en/latest/getting_started/starting.html[starting JupyterLab, {{browser-window--new}}].
|
205
|
+
|
206
|
+
==== Classic Notebook Interface
|
207
|
+
|
208
|
+
The classic notebook is also available without any configuration. To switch
|
209
|
+
to the classic notebook, You do not need any extra configuration in order
|
210
|
+
to allow the use of the classic notebook interface. You can launch the
|
211
|
+
classic notebook interface from within a user session by opening JupyterLab
|
212
|
+
and replacing `/lab/` with `/tree/` in the default juptyerlab URL like so:
|
213
|
+
|
214
|
+
http(s)://<server:port>/tree/
|
215
|
+
|
216
|
+
And you can switch back to JupyterLab by replacing `/tree/` with` /lab/`:
|
217
|
+
|
218
|
+
http(s)://<server:port>/lab/
|
219
|
+
|
220
|
+
|
221
|
+
==== nteract
|
222
|
+
|
223
|
+
nteract is a notebook interface built with *React*. It is similar to a
|
224
|
+
more feature-filled version of the traditional Jupyter Notebook interface.
|
225
|
+
*nteract* comes pre-installed in any session that has been built from a
|
226
|
+
Python repository.
|
227
|
+
|
228
|
+
You can launch nteract from within a user session by replacing `/tree` with
|
229
|
+
`/nteract` at the end of a notebook server’s URL like so:
|
230
|
+
|
231
|
+
http(s)://<server:port>/nteract
|
232
|
+
|
233
|
+
For example, the following Binder URL will open the pyTudes repository and
|
234
|
+
begin an nteract session in the ipynb folder:
|
235
|
+
|
236
|
+
https://mybinder.org/v2/gh/norvig/pytudes/HEAD?urlpath=nteract/tree/ipynb
|
237
|
+
|
238
|
+
The `/tree/ipynb` above is how nteract directs you to a specific file
|
239
|
+
or folder. To learn more about nteract, visit the
|
240
|
+
https://nteract.io/about[nteract website, {{browser-window--new}}].
|
241
|
+
|
242
|
+
|
243
|
+
=== Use different repositories for content and environment
|
244
|
+
|
245
|
+
// See: https://mybinder.readthedocs.io/en/latest/howto/external_binder_setup.html
|
246
|
+
|
247
|
+
Separating your Binder setup files from your repository content can be
|
248
|
+
useful for a variety of reasons. Maybe they need different access permissions
|
249
|
+
or you manage your working environment external to your code repository.
|
250
|
+
Whatever the reason, with a custom Binder URL you can store your environment
|
251
|
+
independent of your content.
|
252
|
+
|
253
|
+
The form on the mybinder.org home page only allows you to select a repository
|
254
|
+
branch to build from. To create a BinderHub deployment link for situations
|
255
|
+
where the environment and content are housed in separate repositories or on
|
256
|
+
different branches of the same repository, you can use the
|
257
|
+
https://jupyterhub.github.io/nbgitpuller/link?tab=binder[nbgitpuller link generator, {{browser-window--new}}]
|
258
|
+
to generate a formatted URL. Note that `nbgitpuller` must be included in your
|
259
|
+
hub environment for this to work.
|
260
|
+
|
261
|
+
For some background on this how-to guide, see this
|
262
|
+
https://discourse.jupyter.org/t/improve-documentation-for-new-users-not-working-on-the-master-branch/5509[community forum post, {{browser-window--new}}].
|
263
|
+
Here is an example repository using a JupyterHub environment configuration
|
264
|
+
stored in a https://github.com/ICESAT-2HackWeek/jupyter-image-2020[separate repository, {{browser-window--new}}].
|
265
|
+
The environment was set up for a community workshop and the tutorial content
|
266
|
+
was compiled and released after the workshop.
|
267
|
+
|
268
|
+
=== Speed up repository launch time
|
269
|
+
|
270
|
+
People often ask how they can speed up the launches for their Binder
|
271
|
+
repositories. Binder is a bit different from other cloud services because
|
272
|
+
it builds and launches arbitrary environments that are defined in Git
|
273
|
+
repositories, rather than only serving a single environment for launches.
|
274
|
+
The extra time it takes to launch is often a result of these extra steps.
|
275
|
+
|
276
|
+
For some background and tips about how you can speed up your repository
|
277
|
+
launch times, see this
|
278
|
+
https://discourse.jupyter.org/t/how-to-reduce-mybinder-org-repository-startup-time/4956[community forum post, {{browser-window--new}}].
|
279
|
+
|
280
|
+
=== Track repository data on `mybinder.org`
|
281
|
+
|
282
|
+
The mybinder.org team runs a service that provides repository-level data
|
283
|
+
about all of the binders that run each day. This is called the mybinder.org
|
284
|
+
event analytics archive. You can use this to track how often people are
|
285
|
+
clicking your Binder links and launching your Binder repository (or, for
|
286
|
+
aggregating activity across many repositories).
|
287
|
+
|
288
|
+
=== Access the event analytics archive
|
289
|
+
|
290
|
+
You can access the event analytics archive at `archive.analytics.mybinder.org`.
|
291
|
+
For information about the structure of this dataset, and a description of
|
292
|
+
how you can read-in the data in order to analyze it, see the
|
293
|
+
https://mybinder-sre.readthedocs.io/en/latest/analytics/events-archive.html[mybinder SRE guide, {{browser-window--new}}]
|
294
|
+
instructions.
|
295
|
+
|
296
|
+
|
297
|
+
==== Example repository to show off analyses
|
298
|
+
|
299
|
+
To give you a little inspiration, check out the
|
300
|
+
https://mybinder.org/v2/gh/betatim/binderlyzer/master[binderlyzer binder, {{browser-window--new}}].
|
301
|
+
This is a Binder that goes through a simple analysis of Binder repositories
|
302
|
+
using the events archive. It shows how to access it, and gives an idea for
|
303
|
+
questions you can ask with this data!
|
304
|
+
|
305
|
+
If you do something interesting or fun with the event analytics archive,
|
306
|
+
please let us know! We provide this resource in the hopes that it gives
|
307
|
+
people insight into the activity going on in Binder land, and would love
|
308
|
+
to hear about anything interesting you find.
|
309
|
+
|
310
|
+
|
311
|
+
== Binder API Reference
|
312
|
+
|
313
|
+
// https://binderhub.readthedocs.io/en/latest/developer/index.html
|
314
|
+
|
315
|
+
BinderHub connects several services together to provide on-the-fly
|
316
|
+
creation and registry of Docker images. It utilizes the following
|
317
|
+
tools:
|
318
|
+
|
319
|
+
* A cloud provider such Google Cloud, Microsoft Azure, Amazon EC2,
|
320
|
+
and others
|
321
|
+
* Kubernetes to manage resources on the cloud
|
322
|
+
* Helm to configure and control Kubernetes
|
323
|
+
* Docker to use containers that standardize computing environments
|
324
|
+
* A BinderHub UI that users can access to specify Git repos they want built
|
325
|
+
repo2docker to generate Docker images using the URL of a Git repository
|
326
|
+
* A Docker registry (such as gcr.io) that hosts container images
|
327
|
+
* JupyterHub to deploy temporary containers for users
|
328
|
+
|
329
|
+
After a user clicks a Binder link, the following chain of events happens:
|
330
|
+
|
331
|
+
. BinderHub resolves the link to the repository.
|
332
|
+
. BinderHub determines whether a Docker image already exists for the
|
333
|
+
repository at the latest ref (git commit hash, branch, or tag).
|
334
|
+
. If the image *doesn’t* exist, BinderHub creates a build pod that uses
|
335
|
+
repo2docker to do the following:
|
336
|
+
|
337
|
+
.. Fetch the repository associated with the link
|
338
|
+
.. Build a Docker container image containing the *environment*
|
339
|
+
specified in configuration files in the repository.
|
340
|
+
.. Push that image to a *Docker registry*, and send the registry
|
341
|
+
information to the BinderHub for future reference.
|
342
|
+
|
343
|
+
. BinderHub sends the Docker image registry to *JupyterHub*.
|
344
|
+
. JupyterHub creates a *Kubernetes pod* for the user that serves
|
345
|
+
the *built* Docker image for the repository.
|
346
|
+
. JupyterHub *monitors* the user’s pod for activity, and *destroys*
|
347
|
+
it after a short period of inactivity.
|
348
|
+
|
349
|
+
// See: https://www.vmware.com/topics/glossary/content/kubernetes-pods.html
|
350
|
+
//
|
351
|
+
NOTE: *Pods* (smallest compute unit that can be defined, deployed,
|
352
|
+
and managed in Kubernetes) are the rough equivalent of a machine instance
|
353
|
+
(physical or virtual) to a container. Each pod is allocated its own internal
|
354
|
+
IP address, therefore owning its entire port space, and containers within
|
355
|
+
pods can share their local storage and networking.
|
356
|
+
|
357
|
+
.Binderhub Architecture
|
358
|
+
lightbox::binderhub--architecture[ 800, {data-binderhub--architecture}, role="mt-3 mb-4" ]
|
359
|
+
|
360
|
+
|
361
|
+
== API Endpoint
|
362
|
+
|
363
|
+
There’s one API endpoint, which is:
|
364
|
+
|
365
|
+
/build/<provider_prefix>/<spec>
|
366
|
+
|
367
|
+
Even though it says build it actually performs launch.
|
368
|
+
|
369
|
+
* provider_prefix identifies the provider
|
370
|
+
* spec defines the source of the computing environment to be built
|
371
|
+
and served using the given provider.
|
372
|
+
|
373
|
+
NOTE: The provider_prefix can be any of the supported repository providers
|
374
|
+
in BinderHub, see the Repository Providers section for supported inputs.
|
375
|
+
|
376
|
+
To use this endpoint, construct an appropriate URL and send a request.
|
377
|
+
You’ll get back an Event Stream. It’s pretty much just a long-lived HTTP
|
378
|
+
connection with a well known JSON based data protocol. It’s one-way
|
379
|
+
communication only (server to client) and is straightforward to implement
|
380
|
+
across multiple languages.
|
381
|
+
|
382
|
+
When the request is received, the following happens:
|
383
|
+
|
384
|
+
. Check if this image exists in our cached image registry. If so,
|
385
|
+
launch it.
|
386
|
+
. If it doesn’t exist in the image registry, we check if a build
|
387
|
+
is currently running. If it is, we attach to it and start streaming
|
388
|
+
logs from it to the user.
|
389
|
+
. If there is no build in progress, we start a build and start streaming
|
390
|
+
logs from it to the user.
|
391
|
+
. If the build succeeds, we contact the JupyterHub API and start launching
|
392
|
+
the server.
|
393
|
+
|
394
|
+
=== Events
|
395
|
+
|
396
|
+
This section catalogs the different events you might receive.
|
397
|
+
|
398
|
+
.Events
|
399
|
+
[cols="2,4a,6a", options="header", width="100%", role="rtable mt-3"]
|
400
|
+
|===
|
401
|
+
|Event |Response |Description
|
402
|
+
|
403
|
+
|*Failed*
|
404
|
+
|`{"phase": "failed", "message": "Reason"}`
|
405
|
+
|Emitted whenever a build or launch fails. You must *close* your
|
406
|
+
*EventStream* when you receive this event.
|
407
|
+
|
408
|
+
|*Built*
|
409
|
+
|`{"phase": "built", "message": "Human readable message", "imageName": "Full name of the image that is in the cached docker registry"}`
|
410
|
+
|Emitted after the image has been built, before launching begins.
|
411
|
+
This is emitted in the start if the image has been found in the cache
|
412
|
+
registry, or after build completes successfully if we had to do a build.
|
413
|
+
|
414
|
+
Note that clients shouldn’t rely on the imageName field for anything
|
415
|
+
specific. It should be considered an internal implementation detail.
|
416
|
+
|
417
|
+
|*Waiting*
|
418
|
+
|`{"phase": "waiting", "message": "Human readable message"}`
|
419
|
+
|Emitted when we started a build pod and are waiting for it to start.
|
420
|
+
|
421
|
+
|*Building*
|
422
|
+
|`{"phase": "building", "message": "Log message"}`
|
423
|
+
|Emitted during the actual building process. Direct stream of logs
|
424
|
+
from the build pod from *repo2docker*, in the same form as logs from
|
425
|
+
a normal *docker build*.
|
426
|
+
|
427
|
+
|
428
|
+
|`Fetching`
|
429
|
+
|`{"phase": "fetching", "message": "log messages from fetching process"}`
|
430
|
+
|Emitted when fetching the repository to be built from its source (GitHub, GitLab, wherever).
|
431
|
+
|
432
|
+
|*Pushing*
|
433
|
+
|`{"phase": "pushing", "message": "Human readable message", "progress": {"layer1": {"current": <bytes-pushed>, "total": <full-bytes>}, "layer2": {"current": <bytes-pushed>, "total": <full-bytes>}, "layer3": "Pushed", "layer4": "Layer already exists"}}`
|
434
|
+
|Emitted when the image is being pushed to the cache registry. This
|
435
|
+
provides structured status info that could be in a progressbar. It’s
|
436
|
+
structured similar to the output of *docker push*.
|
437
|
+
|
438
|
+
|*Launching*
|
439
|
+
|`{"phase": "launching", "message": "user friendly message"}`
|
440
|
+
|When the repo has been built, and we’re in the process of waiting
|
441
|
+
for the hub to launch. This could end up succeeding and emitting a
|
442
|
+
*ready* event or failing and emitting a *failed* event.
|
443
|
+
|
444
|
+
|*Ready*
|
445
|
+
|`{"phase": "ready", "message": "Human readable message", "url": "full-url-of-notebook-server", "token": "notebook-server-token"}`
|
446
|
+
|When your notebook is ready! You get a endpoint URL and a token
|
447
|
+
used to access it. You can access the notebook\|API by using the
|
448
|
+
token in one of the ways the notebook accepts security tokens.
|
449
|
+
|
450
|
+
|===
|
451
|
+
|
452
|
+
=== Heartbeat
|
453
|
+
|
454
|
+
In EventSource, all lines beginning with `:` are considered comments.
|
455
|
+
We send a `:heartbeat` every 30s to make sure that we can pass through
|
456
|
+
proxies without our request being killed.
|
457
|
+
|
458
|
+
=== Repository Providers
|
459
|
+
|
460
|
+
Repository Providers (or RepoProviders) are locations where repositories
|
461
|
+
are stored (e.g., GitHub). BinderHub supports a number of providers out
|
462
|
+
of the box, and can be extended to support new providers. For a complete
|
463
|
+
listing of the provider classes, see table below.
|
464
|
+
|
465
|
+
.Provider
|
466
|
+
[cols="1,1a,6a,4a", options="header", width="100%", role="rtable mt-3"]
|
467
|
+
|===
|
468
|
+
|Provider |Prefix |Spec |Description
|
469
|
+
|
470
|
+
|GitHub
|
471
|
+
|*gh*
|
472
|
+
|`<user>/<repo>/<commit-sha-or-tag-or-branch>`
|
473
|
+
|GitHub is a website for hosting and sharing git repositories.
|
474
|
+
|
475
|
+
|GitLab
|
476
|
+
|*gl*
|
477
|
+
|`<url-escaped-namespace>/<unresolved_ref>`
|
478
|
+
(e.g. group%2Fproject%2Frepo/master)
|
479
|
+
|GitLab offers hosted as well as self-hosted git repositories.
|
480
|
+
|
481
|
+
|Gist
|
482
|
+
|*gist*
|
483
|
+
|`<github-username>/<gist-id><commit-sha-or-tag>`
|
484
|
+
|Gists are small collections of files stored on GitHub. They behave
|
485
|
+
like lightweight *repositories*.
|
486
|
+
|
487
|
+
|Zenodo
|
488
|
+
|*zenodo*
|
489
|
+
|`<zenodo-DOI>`
|
490
|
+
|Zenodo is a non-profit provider of scholarly artifacts (such as code
|
491
|
+
repositories) run in partnership with CERN.
|
492
|
+
|
493
|
+
|Figshare
|
494
|
+
|*figshare*
|
495
|
+
|`<figshare-DOI>`
|
496
|
+
|FigShare is a company that offers hosting for scholarly artifacts
|
497
|
+
(such as code repositories).
|
498
|
+
|
499
|
+
|HydroShare
|
500
|
+
|*hydroshare*
|
501
|
+
|`<hydroshare-DOI-or-ResourceID>`
|
502
|
+
|HydroShare is a hydrologic information system for users to share
|
503
|
+
and publish data and models.
|
504
|
+
|
505
|
+
|Dataverse
|
506
|
+
|*dataverse*
|
507
|
+
|`<dataverse-DOI>`
|
508
|
+
|Dataverse is open source research data repository software installed
|
509
|
+
all over the world.
|
510
|
+
|
511
|
+
|Git
|
512
|
+
|*git*
|
513
|
+
|`<url-escaped-url>/<commit-sha>`
|
514
|
+
|A generic repository provider for URLs that point directly to
|
515
|
+
a git repository.
|
516
|
+
|
517
|
+
|===
|
518
|
+
|
519
|
+
=== Configuration and Source Code Reference
|
520
|
+
|
521
|
+
Find details for all *code references* on
|
522
|
+
https://binderhub.readthedocs.io/en/latest/reference/ref-index.html[BinderHub, {browser-window--new}]
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
title: Climate change
|
3
|
+
tagline: interactive notebooks
|
4
|
+
date: 2022-03-28 00:00:00
|
5
|
+
description: >
|
6
|
+
Things you should know about this site,
|
7
|
+
the people and the software and/or
|
8
|
+
services provided.
|
9
|
+
|
10
|
+
categories: [ Software, Python ]
|
11
|
+
tags: [ Binder, Jupyter, Notebooks ]
|
12
|
+
|
13
|
+
scrollbar: true
|
14
|
+
|
15
|
+
permalink: /pages/public/climate/
|
16
|
+
regenerate: false
|
17
|
+
|
18
|
+
resources: [ nbinteract ]
|
19
|
+
resource_options:
|
20
|
+
- attic:
|
21
|
+
padding_top: 400
|
22
|
+
padding_bottom: 50
|
23
|
+
opacity: 0.5
|
24
|
+
slides:
|
25
|
+
- url: /assets/images/modules/attics/runner-1920x1200.jpg
|
26
|
+
---
|
27
|
+
|
28
|
+
// Page Initializer
|
29
|
+
// =============================================================================
|
30
|
+
// Enable the Liquid Preprocessor
|
31
|
+
:page-liquid:
|
32
|
+
|
33
|
+
// Set (local) page attributes here
|
34
|
+
// -----------------------------------------------------------------------------
|
35
|
+
// :page--attr: <attr-value>
|
36
|
+
:badges-enabled: false
|
37
|
+
:binder-badge-enabled: true
|
38
|
+
|
39
|
+
// Load Liquid procedures
|
40
|
+
// -----------------------------------------------------------------------------
|
41
|
+
{% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
|
42
|
+
|
43
|
+
// Load page attributes
|
44
|
+
// -----------------------------------------------------------------------------
|
45
|
+
{% include {{load_attributes}} scope="global" %}
|
46
|
+
|
47
|
+
|
48
|
+
// Page content
|
49
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
50
|
+
ifeval::[{badges-enabled} == true]
|
51
|
+
{badge-j1--license} {badge-j1--version-latest} {badge-j1-gh--last-commit} {badge-j1--downloads}
|
52
|
+
endif::[]
|
53
|
+
|
54
|
+
// Include sub-documents (if any)
|
55
|
+
// -----------------------------------------------------------------------------
|
56
|
+
ifeval::[{binder-badge-enabled} == true]
|
57
|
+
image:/assets/images/badges/myBinder.png[[Binder, link="https://mybinder.org/", {browser-window--new}]
|
58
|
+
image:/assets/images/badges/docsBinder.png[[Binder, link="https://mybinder.readthedocs.io/en/latest/", {browser-window--new}]
|
59
|
+
image:https://mybinder.org/badge_logo.svg[Binder, link="https://mybinder.org/v2/gist/jekyll-one/b2b2fe2997d3a78217cae73089c94193", {browser-window--new}]
|
60
|
+
endif::[]
|
61
|
+
|
62
|
+
== Climate change forecasting
|
63
|
+
|
64
|
+
// See: https://towardsdatascience.com/ordinal-differential-equation-ode-in-python-8dc1de21323b
|
65
|
+
|
66
|
+
lorem:sentences[5]
|
67
|
+
|
68
|
+
notebook::climate_change[]
|
69
|
+
|
70
|
+
++++
|
71
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_HTML"></script>
|
72
|
+
<!-- MathJax configuration -->
|
73
|
+
<script type="text/x-mathjax-config">
|
74
|
+
MathJax.Hub.Config({
|
75
|
+
tex2jax: {
|
76
|
+
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
77
|
+
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
78
|
+
processEscapes: true,
|
79
|
+
processEnvironments: true
|
80
|
+
},
|
81
|
+
// Center justify equations in code and markdown cells. Elsewhere
|
82
|
+
// we use CSS to left justify single line equations in code cells.
|
83
|
+
displayAlign: 'center',
|
84
|
+
"HTML-CSS": {
|
85
|
+
styles: {'.MathJax_Display': {"margin": 0}},
|
86
|
+
linebreaks: { automatic: true }
|
87
|
+
}
|
88
|
+
});
|
89
|
+
</script>
|
90
|
+
++++
|