<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joe Hamman on Medium]]></title>
        <description><![CDATA[Stories by Joe Hamman on Medium]]></description>
        <link>https://medium.com/@jhamman?source=rss-df9f03847f67------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gMIjF7BUReV-_PBE1snJzQ.png</url>
            <title>Stories by Joe Hamman on Medium</title>
            <link>https://medium.com/@jhamman?source=rss-df9f03847f67------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:13:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jhamman/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Toward Zarr-Python 3.0]]></title>
            <link>https://medium.com/pangeo/toward-zarr-python-3-0-3d5ebde956d5?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d5ebde956d5</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[zarr]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Fri, 10 May 2024 20:27:08 GMT</pubDate>
            <atom:updated>2024-05-10T20:27:08.975Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*NlhqaSsHigmmIXH6Vi29Xg.png" /></figure><p><em>Note: This post was originally published on the </em><a href="https://zarr.dev/blog/zarr-python-v3-update/"><em>Zarr developer blog</em></a><em>.</em></p><p>We released Zarr-Python <a href="https://zarr.readthedocs.io/en/stable/release.html#release-2-18-0">2.18.0</a> this week. Although this release was quite light in terms of user-facing changes, it represents the beginning of a new phase for the project. In this post, we’ll walk through our plan for Zarr-Python 3.0 and what users of the library can expect in the coming months.</p><h3>Zarr-Python 2.18</h3><p>Before we get into the 3.0 release, we’ll first cover a few details about the 2.18 release series. The first thing to know is that we will continue to support 2.18 with bug fixes up until the release of 3.0. Additionally, we expect to use the 2.18 series to communicate changes in the Zarr-Python API, which will come in 3.0. For example, this week’s release included a number of new deprecation warnings for parts of the Zarr-Python API that we expect to remove in 3.0 (e.g. exotic stores, experimental v3 API).</p><h3>What to expect with Zarr-Python 3.0</h3><p>In mid-2023, we formed a <a href="https://github.com/zarr-developers/zarr-python/discussions/1480">working group</a> to look at modernizing Zarr-Python and, crucially, adding support for the <a href="https://zarr-specs.readthedocs.io/en/latest/v3/core/v3.0.html">V3 specification</a>. One of the early outcomes of this effort was a <a href="https://github.com/zarr-developers/zarr-python/blob/056657ca5ed70aa3d77a9e2db42253fca39800b0/v3-roadmap-and-design.md">design document</a> detailing the plan for a major refactor to the library. The goals for the refactor effort are to:</p><ul><li>Provide a complete implementation of Zarr V3 through the Zarr-Python API,</li><li>Clear the way for exciting extensions / ZEPs (i.e. <a href="https://zarr-specs.readthedocs.io/en/latest/v3/codecs/sharding-indexed/v1.0.html">sharding</a>, <a href="https://zarr.dev/zeps/draft/ZEP0003.html">variable chunking</a>, etc.),</li><li>Provide a developer API that can be used to implement and register V3 extensions,</li><li>Improve the performance of Zarr-Python by streamlining the interface between the Store layer and higher level APIs (e.g. Groups and Arrays),</li><li>Clean up the internal and user-facing APIs,</li><li>Improve code quality and robustness (e.g. achieve 100% type hint coverage), and</li><li>Align the Zarr-Python array API with the <a href="https://data-apis.org/array-api/latest/">array API Standard</a>.</li></ul><p>In late 2023, we started working on the next version of the library, iterating on core concepts and restructuring the code base. While this effort continues today, here are a few highlights that we are particularly excited about:</p><ul><li>New asynchronous APIs across the library, including at the Store, Group, Array, and Codec levels. The ability for Zarr-Python to leverage asynchronous computation will dramatically improve performance in the library, particularly for workloads that depend on data coming from high-latency stores. We expect most users will interact with these classes through a synchronous interface but the asynchronous alternatives will be available for users that can take advantage of them.</li><li>Complete spec-complaint implementation supporting both V2 and V3. Zarr-Python will support reading and writing in either format. Additionally, the V2 and V3 code paths will benefit from the new asynchronous interfaces as well as other performance improvements.</li><li>New plugin interface for codecs. Previously, codec support was required to run through <a href="https://numcodecs.readthedocs.io/en/stable/">Numcodecs</a>. Going forward, additional codecs may be registered with Zarr-Python using the zarr.codecs <a href="https://packaging.python.org/en/latest/specifications/entry-points/">Entry Point</a>. While Numcodecs will continue to supply the Zarr-Python project with most codecs, the plugin interface will support the integration of codecs from other libraries.</li></ul><h3>Release plan</h3><p>We are still working hard on the 3.0 development branch. You can follow our progress on our <a href="https://github.com/orgs/zarr-developers/projects/5">GitHub Project Board</a>. In the coming weeks, we expect to move our development to the main branch of the library and make a series of pre-releases.</p><h3>Get involved</h3><p>It’s not too late to get involved with the 3.0 effort. The <a href="https://github.com/orgs/zarr-developers/projects/5">GitHub Project Board</a> provides an up-to-date summary of outstanding issues. If you maintain a library that depends on Zarr-Python, the 3.0.0-alpha release will be a great time to start testing against the upcoming release. Finally, we continue to hold bi-weekly developer meetings to discuss and coordinate work on Zarr-Python. This is an open meeting so please come if you are interested in getting involved. Check out the Zarr community calendar <a href="https://zarr.dev/community-calls/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d5ebde956d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/toward-zarr-python-3-0-3d5ebde956d5">Toward Zarr-Python 3.0</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Xpublish]]></title>
            <link>https://medium.com/pangeo/xpublish-ff788f900bbf?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff788f900bbf</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[dask]]></category>
            <category><![CDATA[xarray]]></category>
            <category><![CDATA[fastapi]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 14:54:50 GMT</pubDate>
            <atom:updated>2021-05-11T17:18:45.510Z</atom:updated>
            <content:encoded><![CDATA[<h3>Publishing Xarray Datasets via a Zarr compatible REST API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6VMFRA5TCVTA5y8D9vy8Q.png" /></figure><p><a href="https://xpublish.readthedocs.io/"><em>Xpublish</em></a><em> is a new Xarray extension that makes it easy to publish datasets via a Zarr-compatible REST API. You can test drive Xpublish now in this </em><a href="https://mybinder.org/v2/gh/jhamman/xpublish/master"><em>Binder</em></a><em> or install it from Conda or PyPi:</em></p><pre>$ conda install -c conda-forge xpublish<br># or<br>$ pip install xpublish</pre><p><a href="https://xpublish.readthedocs.io/">Xpublish</a> enables sharing of Xarray datasets via a web application. The data in the Xarray datasets (on the server side) can be backed by <a href="https://dask.org/">Dask</a> to facilitate on-demand computation of derived datasets. The basic usage is as follows:</p><p><strong>Server-side:</strong> datasets are published using the serve() method on an Xarray Dataset accessor (rest):</p><pre>&gt;&gt;&gt; ds.rest.serve(host=”0.0.0.0&quot;, port=9000)</pre><p><strong>Client-side:</strong> datasets are accessed using any <a href="https://zarr.readthedocs.io/">Zarr</a> HTTPStore, such as the HTTPFileSystem provided by the <a href="https://filesystem-spec.readthedocs.io/">Filesystem Spec (fsspec)</a> project. Here’s an example using Xarray, Zarr, and fspec on the client side:</p><pre><strong>In [1]: import</strong> <strong>xarray</strong> <strong>as</strong> <strong>xr</strong></pre><pre><strong>In [2]: import</strong> <strong>zarr</strong></pre><pre><strong>In [3]: from</strong> <strong>fsspec.implementations.http</strong> <strong>import</strong> HTTPFileSystem</pre><pre><strong>In [4]: </strong>fs = HTTPFileSystem()</pre><pre><strong>In [5]: </strong>http_map = fs.get_mapper(‘http://0.0.0.0:9000&#39;)</pre><pre># open as a zarr group<br><strong>In [6]: </strong>zg = zarr.open_consolidated(http_map, mode=’r’)</pre><pre># or open as another xarray dataset<br><strong>In [7]: </strong>ds = xr.open_zarr(http_map, consolidated=True)</pre><pre># (Or by any other HTTPStore, e.g. <a href="http://guido.io/zarr.js/#/getting-started/remote-data?id=remote-datasets">zarr.js</a>)<br>...</pre><h3><strong>How does this work?</strong></h3><figure><img alt="diagram" src="https://cdn-images-1.medium.com/max/1024/1*UFR5Bn4YAFPlA0OKsVDmew.png" /><figcaption>Xpublish’s wiring diagram. The Zarr client connects to an Xpublish server via an HTTPStore. Xpublish serves data generated via Xarray and Dask APIs via a simple REST API.</figcaption></figure><p>When we called ds.rest.serve() above, we started a <a href="https://www.uvicorn.org/">Uvicorn server</a> running a <a href="https://github.com/tiangolo/fastapi">FastAPI application</a>. That application provided two important endpoints: .zmetadata and /{var}/{key}. The .zmetadata key returns <a href="https://zarr.readthedocs.io/en/stable/api/storage.html#zarr.storage.ConsolidatedMetadataStore">Zarr’s consolidated metadata</a> as a JSON dictionary and /{var}/{key} returns a single <a href="https://zarr.readthedocs.io/en/stable/spec/v2.html#chunks">chunk</a> of compressed data.</p><p>Xpublish also provides a handful of convenience endpoints that don’t involve Zarr, but may be otherwise useful. For example, the root endpoint ( / ) will return Xarray’s new HTML repr:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XyJlIYb3ZRIppESt" /><figcaption>Screenshot from an Xpublish endpoint showing Xarray’s new HTML repr.</figcaption></figure><p>Other REST API endpoints include:</p><ul><li>/: returns xarray’s HTML repr.</li><li>/keys: returns a list of variable keys, equivalent to list(ds.variables).</li><li>/info: returns a JSON dictionary summary of a Dataset variables and attributes, similar to ds.info() or ncdump -h.</li><li>dict: returns a JSON dictionary of the Dataset schema, equivalent to ds.to_dict(data=False).</li><li>/versions: returns JSON dictionary of the versions of Python, Xarray, FastAPI and related libraries on the server side, similar to xr.show_versions().</li><li>/docs: Interactive Swagger API documentation.</li></ul><h3><strong>Applications</strong></h3><p>Now that we’ve gone over the mechanics of how Xpublish works, let’s discuss a few potential applications. Because the end user interfaces with Xpublish endpoints just like any Zarr dataset available via an HTTPStore, our examples are largely targeting data providers.</p><ol><li><em>Serving derived data</em>: We often produce multiple derived versions of the same base dataset, with varying levels of processing applied. For example, NASA’s IceBridge data are offered at EOS level 0, 1, 2, and 3. Each of these levels represent a greater level of processing from the raw instrument data. If we had a script that used Xarray and Dask to produce the level 3 data that used a lower level as input, we could serve this data product without having to pre-compute or store the data. With new sensors like <a href="https://earthdata.nasa.gov/learn/articles/tools-and-technology-articles/getting-ready-for-nisar">NISAR coming online soon</a>, this approach to generating intermediate level data products on-demand has the potential to generate real savings in terms of storage costs.</li><li><em>Xarray and Zarr as a data API</em>: There are many reasons you may prefer a web-api over a static dataset. You may want to broker access to a dataset, perhaps as a way to track data usage or even to generate revenue in some way. A related use case comes in serving derived data products where the underlying data sources change frequently. In these cases, it may be preferable to share data via an API rather than a static dataset.</li><li><em>Serving aggregated data collections</em>: Xarray is quite good at generating aggregate datasets sourced from many individual granules (i.e. files). Much like <a href="https://www.opendap.org/">OpenDAP</a> or <a href="https://www.unidata.ucar.edu/software/tds/current/">THREDDS</a>, Xpublish can serve collections of granules from a single endpoint.</li><li><em>Computational backend to big-data visualization</em>: There are now (at least) two JavaScript implementations of Zarr. Combining something like <a href="http://guido.io/zarr.js/#/">zarr.js</a> with Xpublish would make for an exciting front-end project.</li></ol><h3><strong>Discussion and what’s left to do</strong></h3><p>We think the ability to share derived Xarray datasets via a web-API is really exciting. We want to emphasize, however, that this is merely a prototype. Xarray + Dask + FastAPI + Zarr is a unique combination of libraries and we fully expect the internals of Xpublish to evolve significantly as we explore the application space and pursue performance and usability improvements.<strong> </strong>Though we’ve identified a few obvious applications, we’re still evaluating the extent of the application space for this project. We expect Xpublish to require additional infrastructure to enable deployment on a variety of cloud and local computing systems. On the performance side, we’re working on some known bottlenecks related to <a href="https://github.com/xarray-contrib/xpublish/issues/7">asynchronous computation of dask arrays</a> and <a href="https://github.com/xarray-contrib/xpublish/issues/9">server-side caching</a>. If you have a use case that could utilize Xpublish or would like to contribute to the project, get in touch via the <a href="https://github.com/xarray-contrib/xpublish">GitHub repo</a>.</p><h4><strong>Acknowledgments</strong></h4><p>Building Xpublish was a team effort. I want to specifically thank<a href="https://medium.com/u/6802abfab2bf"> </a><a href="https://medium.com/u/bc2b9ddd350c">Anderson Banihirwe</a> (NCAR), <a href="https://medium.com/u/74a79b40da98">Landung Setiawan</a> (UW), and <a href="https://medium.com/u/ae28b16eab24">Ryan Abernathey</a> (Columbia). The development of Xpublish was supported in part by<a href="https://earthdata.nasa.gov/esds/competitive-programs/access/eos-data-cloud"> NASA-ACCESS grant #80NSSC18M0156</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff788f900bbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/xpublish-ff788f900bbf">Xpublish</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Intake-stac]]></title>
            <link>https://medium.com/pangeo/introducing-intake-stac-2c988d8e1d30?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c988d8e1d30</guid>
            <category><![CDATA[xarray]]></category>
            <category><![CDATA[stac]]></category>
            <category><![CDATA[intakes]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Tue, 03 Mar 2020 02:19:54 GMT</pubDate>
            <atom:updated>2020-03-03T02:19:54.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="logos" src="https://cdn-images-1.medium.com/max/244/1*qW1iT6BRV3_bZNdnggkyow.png" /></figure><p>We’re excited to introduce a new Intake driver: <a href="https://intake-stac.readthedocs.io/">Intake-stac</a>. We think this tool will make it much easier to explore <a href="https://stacspec.org/">SpatioTemporal Asset Catalogs (STAC)</a> and enable interactive data analysis and visualization in a Python environment.</p><p>Intake-stac provides <a href="https://intake.readthedocs.io/en/latest/plugin-directory.html">Intake drivers</a> that support opening STAC <em>Catalogs</em>, <em>Collections</em>, <em>Items </em>and<em> ItemCollections</em>. By combining <a href="https://intake.readthedocs.io/">Intake</a> and <a href="https://github.com/sat-utils/sat-stac">sat-stac</a>, Intake-stac provides a simple toolkit for working with STAC catalogs and for loading STAC assets as <a href="http://xarray.pydata.org/">Xarray</a> objects. Intake-stac can be installed via <em>pip</em> or <em>conda-forge</em>:</p><pre>$ pip install intake-stac<br># or<br>$ conda install -c conda-forge intake-stac</pre><h3><strong>STAC</strong></h3><p>The STAC specification provides a common, machine-readable (JSON) format for describing a wide range of geospatial datasets. STAC’s goal is to make it easier to index and discover geospatial assets. An asset is any geospatial dataset that can be described by a spatial extent and time. The STAC project is in a state of rapid development; <a href="https://medium.com/radiant-earth-insights/stac-0-9-0-release-our-final-major-release-before-1-0-beta-17467953e45e">approaching its 1.0 release</a> and quickly finding adoption <a href="https://github.com/radiantearth/stac-spec/blob/master/implementations.md/">across the cloud-native geospatial imagery community</a>. More on STAC, its specification, and its ecosystem of tools on the STAC <a href="https://stacspec.org/">website</a> or in this introductory blogpost from <a href="https://medium.com/u/e27f6e2373d3">Chris Holmes</a>:</p><p><a href="https://medium.com/radiant-earth-insights/announcing-the-spatiotemporal-asset-catalog-stac-specification-1db58820b9cf">Announcing the SpatioTemporal Asset Catalog (STAC) specification</a></p><h3><strong>Using Intake-stac</strong></h3><p>While STAC provides a powerful and flexible standard for describing data, it doesn’t do much to load assets into memory for custom computations and analysis. That’s where Intake-stac comes in, providing a lightweight Intake driver that makes it easy to load data described in STAC catalogs. It does this by integrating functionality included in a number of familiar open source software tools such as <a href="https://intake.readthedocs.io/">Intake</a>, <a href="https://rasterio.readthedocs.io/en/latest/">rasterio</a>, <a href="http://xarray.pydata.org/">Xarray</a>, and <a href="https://github.com/sat-utils/sat-stac">sat-stac</a>. Although we highlight some of the functionality included in Intake-stac below, we recommend checking out the <a href="https://intake-stac.readthedocs.io/en/latest/">documentation site</a> or this <a href="https://mybinder.org/v2/gh/pangeo-data/intake-stac/master?filepath=examples?urlpath=lab">Binder</a> for an interactive Jupyter notebook for more details.</p><figure><a href="https://mybinder.org/v2/gh/pangeo-data/intake-stac/master?filepath=examples?urlpath=lab"><img alt="binder" src="https://cdn-images-1.medium.com/max/545/0*sQe6Qya3_LpK1PnS" /></a><figcaption>Click to launch Intake-stac’s binder demo.</figcaption></figure><p>In the example below, we use Intake-stac to open the “planet-disaster-data” STAC catalog:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e3f5c42b9014d293a4b4782462f64de/href">https://medium.com/media/7e3f5c42b9014d293a4b4782462f64de/href</a></iframe><p>Now we have an Intake Catalog where we can easily select a specific asset and load it as a Xarray Dataset.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c81d525147667630b8e4870d79bb5a8/href">https://medium.com/media/6c81d525147667630b8e4870d79bb5a8/href</a></iframe><figure><img alt="thumbnail" src="https://cdn-images-1.medium.com/max/389/1*gIBrLx9nBJo79NE1OjZaVw.png" /><figcaption>Thumbnail plotted above as `tiff_da.plot()`.</figcaption></figure><p>Intake-stac also works well with the <a href="https://github.com/sat-utils/sat-search">sat-search</a> library, providing a powerful tool for dynamically searching, discovering, and loading data all in one place. Here we use sat-search to quickly identify all the Tier 1 Landat scenes within a bounding box before selecting one scene and loading it as an Xarray object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47dc79f26d2fbc8b59eceb52484afa21/href">https://medium.com/media/47dc79f26d2fbc8b59eceb52484afa21/href</a></iframe><h3><strong>Next steps and conclusions</strong></h3><p>We’re excited by what we can now do with STAC and Intake together. In the next phase of the project, we’re looking for feedback on a few things:</p><ul><li>First, we want to hear how people are using Intake-stac, what works and what doesn’t. Please get in touch on <a href="https://github.com/pangeo-data/intake-stac/issues">our issue tracker</a>.</li><li>Second, we are interested in exploring additional integrations with related projects; for example, we recently added some <a href="https://github.com/pangeo-data/intake-stac/issues/36">lightweight (experimental) support for interacting with GeoPandas</a> and we’re <a href="https://github.com/pangeo-data/intake-stac/issues/34">considering how to enable Intake’s GUI browser for STAC data</a>.</li><li>Finally, we are starting to look into translating collections of assets into high-level data objects (i.e. Xarray Datasets). This already works when stacking multi-band images into a single DataArray but there is a lot of room to explore developing new representations of asset collections.</li></ul><p>Thanks for reading and for trying out Intake-stac. Be in touch!</p><h4><strong>Acknowledgements</strong></h4><p>Building Intake-stac was a team effort. I want to specifically thank <a href="https://medium.com/u/6802abfab2bf">Matthew Hanson</a> (Element84), <a href="https://medium.com/u/bc2b9ddd350c">Anderson Banihirwe</a> (NCAR), <a href="https://medium.com/u/b865b2668619">Julia Signell</a> (Anaconda, now SaturnCloud), <a href="https://medium.com/u/848d251f4034">Jonah Joughin</a> (UW), and <a href="https://medium.com/u/a2ec3bba4164">Scott Henderson</a> (UW). The development of Intake-stac was supported in part by <a href="https://earthdata.nasa.gov/esds/competitive-programs/access/eos-data-cloud">NASA-ACCESS grant #80NSSC18M0156</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c988d8e1d30" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/introducing-intake-stac-2c988d8e1d30">Introducing Intake-stac</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Zarr]]></title>
            <link>https://medium.com/pangeo/streaming-zarr-ccf0d518b1c0?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccf0d518b1c0</guid>
            <category><![CDATA[dask]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[xarray]]></category>
            <category><![CDATA[zarr]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Fri, 28 Feb 2020 14:01:02 GMT</pubDate>
            <atom:updated>2020-02-28T14:01:02.757Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Streaming with Zarr</strong></h3><p><em>Simulation models continue on their path to the exascale — motivating the search for a new paradigm for model data analysis. We explore the use of Zarr (a data format for chunked, compressed, N-dimensional arrays) and Redis (a streaming database) to support streaming data from simulation models to analysis environments.</em></p><figure><img alt="logos" src="https://cdn-images-1.medium.com/max/1024/0*3n---VacmCafchYG" /></figure><p>Weather and climate simulation models are producing data at an ever increasing rate. These models are traditionally run in large HPC computing facilities and make extensive use of fast parallel file systems to support archiving their model history. As models have continued to grow in size (higher resolution, more simulated variables, etc.), a natural pressure to balance model runtime, output data volumes, and applications has emerged. As a result, many simulated variables are never examined or may only be archived in some aggregated form (i.e. averaged over multiple model timesteps). We think these constraints, based almost entirely on the cost of storing large volumes of data on disk, are limiting our ability to fully utilize our models.</p><p>If we can’t output the full contents of our model simulations, what can we do to better leverage the information in our models? One option is to take our analysis to the model. Often this means writing complex analysis code inside the runtime environment of each model. This approach is fraught with obvious challenges, most notably the inefficiency of writing one-off analysis code in a low-level language (i.e. C or Fortran). Another option is to stream data to some ephemeral cache and let scientists do their analysis while the model runs. This is the topic of our exploration here.</p><p>We want to note that later this year, <a href="https://www.unidata.ucar.edu/blogs/developer/entry/nczarr-overview">Zarr support is expected in the NetCDF-C API</a> (NetCDF is the widely used archival format for weather and climate model data). This is an exciting advancement because it will allow us to begin testing a host of new model data applications and workflows, including streaming NetCDF-Zarr datasets directly from weather and climate models to new storage mediums like cloud object store and streaming services.</p><h3><strong>Zarr and Redis</strong></h3><p>Redis (REmote DIctionary Server) is a distributed, in-memory key-value database with multi-language support (including C, Python, and many more). Zarr can utilize Redis as a MutableMapping interface to store its chunked, compressed multi-dimensional arrays. Here we demonstrate how these two technologies can be used together. For our demonstration, we have deployed a simple simulation model (<a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Conway’s Game of Life</a>). Check out this <a href="https://mybinder.org/v2/gh/jhamman/streaming-zarr/master?urlpath=lab">Binder</a> to access an interactive demonstration.</p><figure><a href="https://mybinder.org/v2/gh/jhamman/streaming-zarr/master?urlpath=lab"><img alt="" src="https://cdn-images-1.medium.com/max/545/1*uAVjEqhf4FE0vJdS-S6Wrw.png" /></a></figure><h4><strong>Server-side (simulation model)</strong></h4><p>First, start a Redis server:</p><pre>$ redis-server redis.conf --loglevel verbose --port 7777</pre><p>We’ve configured the memory eviction policy of our Redis server in our redis.conf file:</p><pre>maxmemory 5mb<br>maxmemory-policy allkeys-lfu</pre><p>Our Redis server will hold up to 5mb of memory and will evict data that was least-frequently-used (lfu) . Real world applications would obviously want to increase the maxmemory setting substantially and may want to further configure the Redis server.</p><p>Next, we start our simulation model, telling it where it can find the Redis server:</p><pre>$ python3 conway.py —-port 7777</pre><p>The run loop inside conway.py is quite easy to read. We first connect to our Redis Server using Zarr’s RedisStore. Then we create a Zarr group inside of which we will place our stream of model generated arrays. Finally, we begin the time loop, updating adding new keys to the group after each update.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3dbbf6aaf86ef2aa6b73ba6691a82aa0/href">https://medium.com/media/3dbbf6aaf86ef2aa6b73ba6691a82aa0/href</a></iframe><p>This will begin streaming data — one timestep at a time — to our Redis server. Next, we’ll head to our analysis environment.</p><p><strong>Client-side (analysis environment)</strong></p><p>Connecting to our Redis server on the client side is the same as above:</p><pre>store = zarr.RedisStore(port=7777)</pre><p>And any key can be read from the store using Zarr’s open_array function:</p><pre>key = “1”  # first timestep<br>data = zarr.open_array(store=store, mode=’r’, path=key)</pre><p>From here, we are all set to begin our analysis. In our <a href="https://mybinder.org/v2/gh/jhamman/streaming-zarr/master?urlpath=lab">Binder</a>, we walk through a handful of applications that use this setup including visualizing the model as it runs. Below is a short animation that shows Conway’s Game of Life evolving in real time:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbvRniBDwraw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbvRniBDwraw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbvRniBDwraw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4388664031fbb5684163454b94ca2ee/href">https://medium.com/media/c4388664031fbb5684163454b94ca2ee/href</a></iframe><p>And some basic data analysis that aggregates across many model timesteps. In this case, we simply calculate the total population at each timestep (generation) in the model simulation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/0*KM0FvauSJ4y0yFF7" /></figure><p><strong>Conclusion</strong></p><p>This has been a quick demonstration of how we may use Zarr to support streaming data from simulations models. A few parting thoughts:</p><ul><li>Although we’ve used Redis as our streaming cache in this example, we acknowledge there are other streaming services out there that may provide advantages for certain applications. Fortunately, developing new MutableMapping interfaces for Zarr is easy enough that we can test other options as they come along.</li><li>Our example has highlighted the use-case where we want to stream data out of a simulation model to avoid writing data to disk. There are other applications where this setup may be useful; examples such as monitoring ongoing simulations that require some sort of manual intervention or sharing of derived data between applications are two use cases that come to mind.</li><li>Finally, this new approach to incremental data analysis will require some new tools for effectively processing continuous streams of data. We’re excited to try out the <a href="https://streamz.readthedocs.org/">streamz</a> package in this space and look forward to seeing what other tools are out there.</li></ul><p><strong>Acknowledgements</strong></p><p>This work was inspired by an <a href="https://github.com/nbren12/geostreams">early prototype</a> developed with Noah Brenowitz, James Douglass, and Aji John at the 2017 UW GeoHackweek. <a href="https://medium.com/u/981b5c32a68c">Philipp Rudiger</a> contributed to the Binder Bokeh animation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccf0d518b1c0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/streaming-zarr-ccf0d518b1c0">Streaming Zarr</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pangeo Guide for AGU 2019]]></title>
            <link>https://medium.com/pangeo/pangeo-guide-for-agu-2019-17c02f3e4446?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/17c02f3e4446</guid>
            <category><![CDATA[agu]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[conference]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Mon, 18 Nov 2019 05:11:41 GMT</pubDate>
            <atom:updated>2019-12-04T19:22:35.065Z</atom:updated>
            <content:encoded><![CDATA[<p>Headed to the <a href="https://www.agu.org/fall-meeting">2019 AGU Fall Meeting</a> in San Francisco in December? Here’s your Pangeo guide to tutorials, presentations, and meetups for this years meeting. See <a href="https://discourse.pangeo.io/t/agu-fall-meeting-2019/368">this discourse post</a> for up to date discussion on this year’s AGU happenings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GeoU4NtWPb4qji37bw78FQ.jpeg" /></figure><h3>Tutorials</h3><p><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Session/82368"><strong>Pangeo: Hands on with JupyterHub and Open-Source Python Tools for Scalable Analysis of Big Data in the Geosciences (SCIWS12)</strong></a></p><p><a href="https://medium.com/u/a2ec3bba4164">Scott Henderson</a>, <a href="https://medium.com/u/e1a5b0dd9298">Amanda Tan Lehr</a>, <a href="https://medium.com/u/df9f03847f67">Joe Hamman</a>, and Jessica Scheick will be running a 4-hour Pangeo Tutorial on Sunday December 8th at 13:40–18:00. Details are below. Note that there are only a few slots available so sign up now if you are interested in attending.</p><p><strong>Abstract</strong>: Bring your laptop to this hands-on workshop sponsored by the Pangeo project! Pangeo is first and foremost a community promoting open, reproducible, and scalable science (read more at <a href="https://pangeo.io)./">https://pangeo.io).</a> Participants will learn about Python and several open-source software packages for analytic workflows with big data in Earth Science. Particular emphasis will be given to Jupyter, Xarray, and Dask software libraries for analysis of multidimensional modeling and remote sensing data sets. In this half-day workshop, participants will familiarize themselves with writing code in Jupyter Notebooks that can be run on scalable computing clusters running on the Cloud, bypassing a common bottleneck of downloading ever-increasing volumes of remote sensing or modeling data. We will have both introductory tutorials and advanced examples used in peer-reviewed research in the fields of oceanography, hydrology, and solid earth geophysics. For those interested in building JupyterHub infrastructure for research groups we briefly discuss how your research group can deploy Pangeo on local servers, HPC systems, or commercial Clouds.</p><p><strong>Agenda:</strong></p><ul><li>1 hr: Introduction to Pangeo project, JupyterHubs, software ecosystem, and data access</li><li>1.5 hr: Hands-on interactive tutorial of python tools: xarray, dask, geopandas</li><li>1.5 hr: Example scientific workflows with satellite imagery, climate, and hydrologic modeling</li></ul><h3>Other Tutorials</h3><p>There are also a few other tutorials that you may be interested in:</p><ul><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Session/77499">SCIWS5 Best Practices for Developing and Sustaining Your Open-Source Research Software</a></li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Session/76617">SCIWS3 Applications of Big Data and High-Performance Computing in Earth Sciences</a></li></ul><h3>Presentations</h3><p>Of course there will be lots of talks and posters at AGU that use Pangeo or related tools. The list is certainly too long to post here but we’ve grabbed a few obvious ones that we think many Pangeans will be interested in. See <a href="https://discourse.pangeo.io/t/agu-fall-meeting-2019/368">this discourse post</a> for an up to date, crowd sourced version of this list.</p><ul><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/540263">ED52A-01 Interactive geophysics: GeoSci.xyz</a>, Lindsey Heagy</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/491885">IN11A-01 Analysis Ready Data in Analytics Optimized Data Stores for Analysis of Big Earth Data in the Cloud</a>, Chris Lynnes</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/578803">IN11D-0689 OOICloud: Building a Pangeo System for the OOI CamHD Video Data using the Azure Cloud</a>, Tim Crone</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/609787">IN11D-0693 The Pangeo Platform: a community-driven open-source big data environment</a>, Joe Hamman</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/504629">IN12A-03 The Big Climate Data Pipeline (BCDP): A tool to facilitate server-side processing of NASA-NEX data on Amazon Cloud</a>, Huikyo Lee</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/490863">IN12A-08 NCAR CESM Large Ensemble Numerical Simulation Data on AWS</a>, Jeff de la Beaujardiere</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/545584">IN13B-0720 The Earth Data Analytic Services Framework</a>, Thomas Maxwell</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/608848">IN13C-0729 PARGEO: Cloud-Ready Pervasively Parallel Analytics and Climate Science</a>, Brian Wilson</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/625567">IN23B-07 The Open-source software ecosystem for leveraging public datasets in Spatio-Temporal Asset Catalogs (STAC)</a>, Matt Hanson</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/553155">IN31B-0792 Using Big Data Technologies with Earth Science Data in HDF5</a>, Larry Knox</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/611974">IN31B-0800 NetCDF in the Cloud: modernizing storage options for the netCDF Data Model with Zarr</a>, Ward Fisher</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/508448">NS21A-01 ANXCOR: Ambient Noise Cross-Correlation with Python</a>, Kevin Mendoza</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Session/86717">NS21A A Tour of Open-Source Software Packages for the Geosciences I</a> (session) Lindsey Heagy</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Paper/598659">SH41C-3317 The Sun at Scale: Interactive Analysis of High Resolution EUV Imaging Data on HPC Platforms with Dask</a>, Will Barnes</li></ul><h3>Meetups</h3><p>AGU is all about meeting up with colleagues from across the world, right? Well here’s a short list of events and meetups that you may want to attend:</p><ul><li>Pangeo Dinner (Tuesday, 6:45p, <a href="http://thirstybear.com/">ThirstyBear Organic Brewery</a>)</li><li><a href="https://agu.confex.com/agu/fm19/meetingapp.cgi/Session/82487">TH25I Update and Future Directions of the Open-Source Software Initiative</a> (Tuesday)</li><li><a href="https://www.esipfed.org/igniteagu2019">ESIP Ignite</a> (Wednesday, <a href="https://learn.planet.com/happy-hour-ignite-2019.html">register here</a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17c02f3e4446" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/pangeo-guide-for-agu-2019-17c02f3e4446">Pangeo Guide for AGU 2019</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pangeo and Kubernetes, Part 3: Thoughts on Security]]></title>
            <link>https://medium.com/pangeo/pangeo-and-kubernetes-part-3-thoughts-on-security-1340dba792f4?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/1340dba792f4</guid>
            <category><![CDATA[jupyterhub]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Fri, 08 Nov 2019 21:11:59 GMT</pubDate>
            <atom:updated>2019-11-08T21:11:59.194Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Written by </em><a href="https://medium.com/u/df9f03847f67"><em>Joe Hamman</em></a><em>, </em><a href="https://medium.com/u/a2ec3bba4164">Scott Henderson</a><em>, and </em><a href="https://medium.com/u/b576e6381dab">Rob Fatland</a><em>, and </em><a href="https://medium.com/u/e1a5b0dd9298">Amanda Tan Lehr</a><em>.</em></p><p><strong><em>Tldr; Pangeo’s public cloud-hosted JupyterHubs are not enterprise grade platforms. </em>We recommend not storing access keys, passwords, or private data on these hubs.</strong></p><p>In previous posts we’ve discussed <a href="https://medium.com/pangeo/pangeo-cloud-cluster-design-9d58a1bf1ad3">our design of Pangeo deployments on Kubernetes</a> and some rough estimates of <a href="https://medium.com/pangeo/pangeo-cloud-costs-part1-f89842da411d">how much it costs</a> to operate one in production. In this post, we provide some thoughts and discussion on the subject of security. We should note that none of us are experts in this area. If you are coming here to learn about the core concepts of security on Kubernetes, we recommend you start with an authoritative source, such as <a href="https://kubernetes-security.info/">this book</a>.</p><h3>Philosophy</h3><p>At the time of writing, Pangeo on Kubernetes is a research project. It is being developed, in large part, by individuals who work at institutions where the primary focus is on scientific research. That said, as a multi-user web-based platform, we do our best to ensure access is limited to only registered users in order to mitigate risks. While we have not ignored the subject of security as we have developed Pangeo on Kubernetes, we have, at various times, chosen to focus on functional development in lieu of security features. We argue that this freedom has served us well. Pangeo has advanced rapidly precisely <em>because </em>we were not preoccupied with security constraints. Finally, now that the project reaching a higher level of maturity, we are inviting contributions from individuals and organizations that have expertise in securing such systems.</p><h3>Terms of Service</h3><p>Because of the research nature of the Pangeo Project at present, we don’t provide any Terms of Service or a Service Level Agreement (these are legal terms that tend to govern the relationship between users and service providers). Yes, there are people using the Pangeo system for day-to-day research tasks but the systems are still in a beta state. We see three main reasons why we don’t provide level of service guarantees:</p><ol><li>Much of our funding available to the Pangeo developer community is intended to <strong>explore</strong> the use of these systems. This funding comes in increments of 1–3 years and under this structure, there is little incentive to hardening our systems at the expense of development velocity.</li><li>We are not staffed to implement or maintain enterprise grade service or security. For this we would need experienced DevOps engineers. This is simply out of scope for our current grant-funded projects. But we welcome outside contributions and regularly reach out to university IT staff and other software professionals for assistance.</li><li>We don’t have a legal entity (non-profit, company, etc.) to broker service agreements. As it stands, the Pangeo Project is a distributed collaboration between many individuals and institutions. None of the individuals or institutions are well-positioned to broker these types of service agreements.</li></ol><h3>Security specifics</h3><p>The Pangeo Project is fortunate to build upon many tools and services that provide high levels of security. What tools do we use to secure deployments of Pangeo?</p><ol><li>We use JupyterHub to manage user authentication and web proxying. Most of our JupyterHubs use the industry standard Open Authorization (OAuth) protocol via the services provided by GitHub, Google, or Globus.</li><li>We use standard Kubernetes tooling to limit access to cluster resources beyond the cluster API endpoint. The Kubernetes clusters are commonly provisioned using tools provided by individual cloud vendors. For example, on AWS, we use <a href="https://eksctl.io/">eksctl</a> and on GCP we use Google’s <a href="https://cloud.google.com/sdk/">SDK</a>.</li><li>We use Kubernetes roll based access control (RBAC) to limit users ability to control the Kubernetes cluster from within.</li><li>We use IAM tools from cloud providers (AWS, GCP) to control access to Cloud account resources from the Kubernetes cluster.</li><li>We use encryption technologies (e.g. <a href="https://www.agwa.name/projects/git-crypt/">GitCrypt</a>) to manage versioned access keys to a variety of systems.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*whA1_QxFuw1cLsurdOBdGg.png" /><figcaption>JupyterHub architecture diagram.</figcaption></figure><h3>Discussion</h3><p>Despite our best efforts, we have had a few minor incidents over the past two years. These incidents have provided valuable lessons learned and have led to further hardening of our systems. Without providing details on the specific incidents, we are able to highlight the sort of things we’ve seen go wrong and how we’ve adapted:</p><ul><li>Running spurious networking applications. In the early days, we ran our JupyterHubs with open authentication. Anyone could log in if you had a GitHub account. After about a year, we found someone running things they shouldn’t have been and we moved to a more secure authentication system.</li><li>Running crypto-currency mining applications. Cloud providers are quick to catch this behavior and we now ban a long list of IP addresses that have been known to misuse these systems.</li><li>Unauthenticated access to Kubernetes Clusters. Kubernetes itself is a relatively new, and fast moving project. The security around public API endpoints is rapidly changing and we’re doing our best to keep pace with recommended security settings (i.e. <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/hardening-your-cluster">this</a> tutorial from Google, <a href="https://github.com/freach/kubernetes-security-best-practice">or this best-practices guide</a>). We hope that Cloud-providers and others working in this sphere continue revising relevant documentation on the <a href="https://zero-to-jupyterhub.readthedocs.io/en/latest/index.html">Zero2JupyterHub on Kubernetes project</a>.</li></ul><h3>In summary</h3><p>The goal here was to provide some thoughts on the Pangeo Project’s approach to security on its public infrastructure. Organizations that are interested in deploying Pangeo in a more secure environment should not read this post as a deterrent from using the platform. Rather, they should be aware that the default deployment specification does not yet feature enterprise grade security.</p><p>Finally, we also seek to entrain new contributions from experts in the area of security to further harden the Pangeo platforms. We are starting a <a href="https://discourse.pangeo.io/t/cloud-deployments-working-group/342">new Pangeo Working Group</a> focused on cloud deployments. If this subject interests you, we encourage you to join our first meeting on December 9th (4:30p GMT, 8:30a PT).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1340dba792f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/pangeo-and-kubernetes-part-3-thoughts-on-security-1340dba792f4">Pangeo and Kubernetes, Part 3: Thoughts on Security</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Pangeo Pattern]]></title>
            <link>https://medium.com/pangeo/the-pangeo-pattern-9a81ca4bad42?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a81ca4bad42</guid>
            <category><![CDATA[science]]></category>
            <category><![CDATA[community]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Thu, 07 Nov 2019 22:25:50 GMT</pubDate>
            <atom:updated>2019-11-07T22:35:38.279Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Ideas included in this post are based on numerous conversations that have occurred across the Pangeo community. </em><a href="https://medium.com/u/ae28b16eab24"><em>Ryan Abernathey</em></a><em>, </em><a href="https://medium.com/u/62dbf78d14a"><em>Guillaume Eynard Bontemps</em></a><em>, </em><a href="https://medium.com/u/df9f03847f67"><em>Joe Hamman</em></a><em>, </em><a href="https://medium.com/u/acae3561cfc5"><em>Chris Holdgraf</em></a><em>, </em><a href="https://medium.com/u/629610405d6a"><em>Fernando Perez</em></a><em>, </em><a href="https://medium.com/u/c9f1234d08b1"><em>Niall Robinson</em></a><em>, </em><a href="https://medium.com/u/1b5dc243ac6e"><em>Matthew Rocklin</em></a><em>, </em><a href="https://medium.com/u/9dc2766c529e"><em>Richard Signell</em></a><em>, and </em><a href="https://medium.com/u/e1a5b0dd9298"><em>Amanda Tan Lehr</em></a><em> (alphabetized) made specific contributions to the development of these thoughts.</em></p><p>We kicked off the Pangeo Project three years ago this week. Our <a href="https://rabernat.github.io/aospy-workshop/">initial meeting</a> was held in New York at Columbia University — there we, a small group of scientists and software developers, gathered to discuss how software projects like <a href="http://xarray.pydata.org/">Xarray</a> and <a href="https://dask.org/">Dask</a> could provide the foundational elements for a new approach to data intensive geoscientific analysis (<a href="https://medium.com/pangeo/first-pangeo-meeting-c4c2e5241fe4">more info in this blog post</a>). In the time since, the Pangeo Project has developed into a multifaceted community project with some novel patterns of development and interaction. Those patterns, which include the development of both a community and open source software, are the topic of this blog post. We hope this blog post provides useful reflection for existing members of the Pangeo community and an effective template for other scientific domains looking to replicate elements of the Pangeo Project.</p><p>Today, we define Pangeo as a community promoting open, reproducible, and scalable geoscience. As a community, we’ve worked to establish new approaches to building data-science platforms, including interactive environments (like <a href="https://jupyterhub.readthedocs.io/en/stable/">JupyterHub</a>), new cloud-optimized data formats (like <a href="https://zarr.readthedocs.io/">Zarr</a>), and new tools for data analysis at scale (like Xarray and Dask). We have also worked to build a diverse community of researchers and developers that focus on general computational challenges in the domain sciences. This focus on common challenges has brought us into contact with other open source communities (like<a href="https://jupyter.org/"> Project Jupyter</a>) and research domains (like solar physics and biology).</p><p>The Pangeo effort is fundamentally concerned with optimizing the workflow of scientists, which is affected by various obstacles. Pangeo resisted the temptation to solve this problem by creating a monolithic end-to-end data platform, which have proved brittle in the past. Instead, Pangeo contributes to component projects, as well as providing various recipes (via Infrastructure as Code, <a href="https://en.wikipedia.org/wiki/Infrastructure_as_code">IaC</a>) which describe how these components are composed to create different flavors of platforms for different use cases. As well as creating effective solutions, this has the added benefit of allowing the broad Pangeo community to work on separate problems.</p><p>We have <a href="https://arxiv.org/pdf/1908.03356.pdf">previously written</a> about the technical design principles that underpin the development of the Pangeo project. Here, we focus on the central patterns that tie the Pangeo community together. There may be more, but we’ve chosen to focus on the following three, expanding on them in the sections below:</p><ol><li>Focus on solving fundamental problems in scientific research,</li><li>Contribute to an ecosystem of modular open source software projects that support open science, and</li><li>Build interdisciplinary teams that cut across academia, government and industry.</li></ol><h4><strong>Solve fundamental problems</strong></h4><p>Identifying common challenges that face broad swaths of a scientific community can be a difficult task. With Pangeo, we’ve focused on promoting open, reproducible, and scalable science. While those issues are not unique to any one scientific field, they were clearly challenges facing the geosciences. We explicitly state three <a href="http://pangeo.io/#our-goals">project goals</a>:</p><ol><li><em>Foster collaboration across the geosciences</em>: This meant creating an organization that solicited participation from a wide range of geoscience disciplines and from software developers beyond the confines of academia. This also meant promoting and contributing to open science initiatives and open source projects that serve the geoscience community.</li><li><em>Support the development of domain-specific packages</em>: Taking inspiration from the astronomy community’s <a href="https://www.astropy.org/">Astropy</a> project, we were interested in developing something similar for the geosciences. Rather than developing a single project like Astropy, we opted to support the development of many smaller projects that share common data structures (e.g. Xarray objects). This allowed us to continue developing the underlying tools while encouraging lower commitment development of domain-specific packages.</li><li><em>Improve the scalability of the scientific software tools for interactive analysis</em>: The geosciences, like many other data intensive research domains, are facing an onslaught of new data products at ever increasing data volumes. This challenge was set to topple many of our scientific ambitions. Our approach has been to improve integration between data analysis libraries like Jupyter, Xarray and Pandas with tools like Dask for parallel processing to support interactive computational analysis on big data.</li></ol><h4><strong>Open source software and open science</strong></h4><p>The open source scientific software tradition is built on the ideas that we stand on the shoulders of giants and that transparent, collaborative development yields a more capable software stack. Indeed, this is where the Pangeo project found its beginnings. A group of scientists and software developers had been openly collaborating on the development of the Xarray and Dask libraries, both open source scientific Python projects. For the scientists in this group, these projects were vital elements in their research machinery, and contributing to them was also seen as a way to build capacity in their own research area. For the software developers, these scientific applications provided validation and feedback to improve design.</p><p>Today, this is still at the core of what Pangeo is about. We work on a wide variety of open source software projects. Many of these projects are agnostic to the scientific domains we work in (e.g. Jupyter, Dask), while others are developed to address specific scientific problems. We’ve recently put together an<a href="https://github.com/pangeo-data/awesome-open-climate-science"> <em>Awesome List</em> of Open Atmospheric, Ocean, and Climate Science tools</a>. It’s encouraging to look back and see how the ecosystem has grown over the past few years.</p><p>Out of these efforts come five patterns of use and development:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*lSRriLfc2mHwH3LjgqoPsQ.png" /></figure><ol><li><em>Reuse</em>: Resist the temptation to build something new. Often times it’s possible to simply use an existing tool with just a few modifications or customizations.</li><li><em>Integrate</em>: The open source scientific software ecosystem is most effective when the individual components are integrated together. Using and building tools that are modular means that each piece is useful alone, and together they are greater than the sum of their parts.</li><li><em>Document</em>: Integration is often simply a documentation effort. Providing the community with clear documentation on how to use individual pieces of the stack and how to combine them for a particular use-case grows the impact that we have for our community.</li><li><em>Demonstrate</em>: Provide examples of how new developments, integrations, or platforms serve real world science applications. For Pangeo, this has meant setting up public infrastructure (e.g. <a href="https://binder.pangeo.io/">binder.pangeo.io</a>) that facilitates interactive exploration of geoscientific data and software tools.</li><li><em>Contribute upstream</em>: By pushing new features, enhancements, bug fixes and documentation upstream, we allow progress in the Pangeo Project to be progress for the scientific community. We also increase the likelihood that scientists from other fields will use and contribute to these tools, enhancing both the functionality and sustainability of the ecosystem as a whole.</li></ol><h4><strong>Interdisciplinary teams and communities</strong></h4><p>Many of the problems facing domain scientists today are not easily solved in isolation. Pangeo has managed to build a community that includes members from academia, government research institutions (e.g. USGS, NASA, UK Met Office), non-profits, and from private companies (e.g. Google, Anaconda, NVIDIA). The make-up of this coalition is important because, in the process of growing the community, we’ve been able to tap into a wide variety of use cases, applications, and expertise. Even amongst the geoscientists involved with Pangeo there is a wide range of disciplines; everything from climate science, hydrology, oceanography, and geophysics. The same is true among the developers and engineers involved with the project, who bring a wide range of skills from DevOps to data visualization to distributed computing.</p><p>Pangeo has also been fortunate to acquire grant funding from various sources (e.g. Alfred P. Sloan, NSF, and NASA). This funding has been a crucial catalyst in the development of the project, allowing sustained effort across the project at a scale otherwise not possible. We also view grant funding as a tool for growing the community in new directions, in terms of development objectives and collaborators.</p><p>Pangeo has also worked to engage with other developer communities like Project Jupyter and other scientific domains like biology and astronomy. We’ve made significant efforts to work with these communities on their terms, looking for places where collaboration will serve both communities well. Examples where we’ve seen this work are through collaboration on shared upstream projects (e.g. <a href="https://binderhub.readthedocs.io/en/latest/">Binder</a>) or through the demonstration of the Pangeo approach in new domain (check out <a href="https://github.com/pangeo-data/pangeo-astro-examples">this</a> demonstration using Pangeo on astronomy data).</p><h4><strong>Conclusions</strong></h4><p>It is important to acknowledge at this point that the Pangeo Project is still defining itself and that these patterns will likely continue to evolve. We’ve written this blog post for two reasons. First, it was an opportunity to reflect on the patterns we’ve developed over the past few years. Second, we think this might be a good conversation starter for other communities (e.g. biology, neuroscience, astronomy) that are potential candidates for a Pangeo-like efforts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a81ca4bad42" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/the-pangeo-pattern-9a81ca4bad42">The Pangeo Pattern</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analyzing large climate model ensembles in the cloud]]></title>
            <link>https://medium.com/pangeo/cesm-lens-on-aws-4e2a996397a1?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e2a996397a1</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[climate-change]]></category>
            <category><![CDATA[pangeo]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Wed, 09 Oct 2019 18:20:19 GMT</pubDate>
            <atom:updated>2019-10-09T18:20:19.459Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Written by </em><a href="https://medium.com/u/df9f03847f67"><em>Joe Hamman</em></a><em>, posted on behalf of the NCAR Science at Scale Team.</em></p><p>The Science at Scale Team at the <a href="https://ncar.ucar.edu/">National Center for Atmospheric Research </a>(NCAR) is excited to announce the release of the Community Earth System Model (CESM) Large Ensemble Numerical Simulation (LENS) dataset published in the Amazon Public Dataset Program (<a href="https://doi.org/10.26024/wt24-5j82">link to dataset</a>). In this blog post, we give a brief overview of 1) the LENS dataset, 2) how you can access the data, and 3) a Binder-ready Jupyter Notebook that reproduces a few key analyses of the LENS dataset — originally presented in the Kay et al. 2015 paper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*x1wkpGTZTRqt5LHvT0e_gA.png" /><figcaption>Reproduced figure 2 from Kay et al. 2015. Original Caption: “Global surface temperature anomaly (1961–90 base period) for the 1850 control, individual ensemble members, and observations (HadCRUT4; <a href="https://journals.ametsoc.org/doi/full/10.1175/BAMS-D-13-00255.1#">Morice et al. 2012</a>).” The 1850 control run is not shown in the reproduction.</figcaption></figure><h3>The data</h3><p>The <a href="http://www.cesm.ucar.edu/projects/community-projects/LENS/data-sets.html">CESM LENS dataset</a> includes a 40-member ensemble of climate simulations for the period 1920–2100 using historical data (1920–2005) or assuming the RCP8.5 greenhouse gas concentration scenario (2006–2100), as well as longer control runs based on pre-industrial conditions. The data comprise both surface (2D) and volumetric (3D) variables in the atmosphere, ocean, land, and ice domains. The total data volume of the original dataset is ~500TB, which has been stored as ~150,000 individual NetCDF files on disk and magnetic tape. The dataset has been made available through the <a href="https://www.earthsystemgrid.org/dataset/ucar.cgd.ccsm4.CESM_CAM5_BGC_LE.html">NCAR Climate Data Gateway</a> for download or via web services. NCAR has copied a subset (currently ~70 TB) of CESM LENS data to Amazon S3 as part of the AWS Public Dataset Program.</p><p>To optimize for large-scale analytics we have represented the data as ~275 separate <a href="https://zarr.readthedocs.io/en/stable/">Zarr</a> datasets. We choose to store the data in the Zarr format because it offers a convenient way to store multi-dimensional data in cloud object store and because it easily represents the metadata (attributes, coordinates, dimensions) found in the kind NetCDF files produced by climate models. Additionally, the NetCDF development team at <a href="https://www.unidata.ucar.edu/">Unidata</a> has <a href="https://www.unidata.ucar.edu/blogs/developer/en/entry/netcdf-zarr-data-model-specification">recently announced</a> they plan to support Zarr as a storage backend in the NetCDF library soon, so this effort allows us to prototype analysis tools and workflows using this storage paradigm.</p><h3>Options for accessing the data</h3><p>As we mentioned above, the dataset is stored as ~275 Zarr stores. The easiest way to access this data is using <a href="https://intake.readthedocs.io/">Python Intake package</a>. We have provided Intake catalogs for all model components and time frequencies (<a href="https://github.com/NCAR/cesm-lens-aws/tree/master/intake-catalogs">link to catalogs</a>). For example, the code block below shows to load an <a href="http://xarray.pydata.org/">Xarray</a> Dataset that includes daily surface air temperature.</p><pre>import intake</pre><pre>cat = intake.Catalog(&#39;https://raw.githubusercontent.com/NCAR/cesm-lens-aws/master/intake-catalogs/atmosphere/daily.yaml&#39;)</pre><pre>ds_20C = cat[&#39;reference_height_temperature_20C&#39;].to_dask()<br>display(ds_20C[&#39;TREFHT&#39;])</pre><pre>&lt;xarray.DataArray &#39;TREFHT&#39; (member_id: 40, time: 31390, lat: 192, lon: 288)&gt;<br>dask.array&lt;shape=(40, 31390, 192, 288), dtype=float32, chunksize=(2, 365, 192, 288)&gt;<br>Coordinates:<br>  * lat        (lat) float64 -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0<br>  * lon        (lon) float64 0.0 1.25 2.5 3.75 5.0 ... 355.0 356.2 357.5 358.8<br>  * member_id  (member_id) int64 1 2 3 4 5 6 7 8 ... 34 35 101 102 103 104 105<br>  * time       (time) object 1920-01-01 00:00:00 ... 2005-12-31 00:00:00<br>Attributes:<br>    cell_methods:  time: mean<br>    long_name:     Reference height temperature<br>    units:         K</pre><p>The data can also be accessed directly (not using Intake) using libraries like <a href="https://github.com/dask/s3fs">S3FS</a>. For example, the code snippet below returns the same data shown above:</p><pre>import s3fs<br>import xarray as xr</pre><pre>s3 = s3fs.S3FileSystem(anon=True)<br>store = s3fs.S3Map(root=&#39;ncar-cesm-lens/atm/daily/cesmLE-20C-TREFHT.zarr&#39;, s3=s3)</pre><pre>ds_20C = xr.open_zarr(store)[&#39;TREFHT&#39;]</pre><h3>Reproducing Kay et al. 2015</h3><p>The CESM Large Ensemble Project’s main goal was to enable the assessment of climate change in the presence of internal climate variability. The project provided the research community with a new view into the role of natural variability in climate projections. The <a href="https://doi.org/10.1175/BAMS-D-13-00255.1">2015 BAMS paper by Kay et al</a>. gave an overview of the initial findings of the effort and has since become one of the cornerstone publications in the actively growing field studying large initial-condition climate model ensembles. As an example of how this effort has helped spawn an active area of research, a <a href="https://usclivar.org/meetings/large-ensembles-workshop">recent</a> US CLIVAR workshop held at NCAR set out to foster the usage of similar ensembles to advance understanding of natural climate variability, climate change, and their impacts.</p><p>With the goal of providing some relatively simple demonstrations of how to use the LENS data on AWS, we set out to reproduce some of the analysis in the original BAMS paper while using this newly published dataset on AWS. We rewrote the analysis tools to produce two of the figures in the Kay et al. paper using Python libraries like Intake, Xarray, and Dask. We have provided this as a <a href="https://github.com/NCAR/cesm-lens-aws">Binder-ready repository</a> of Jupyter Notebooks. Click <a href="https://aws-uswest2-binder.pangeo.io/v2/gh/NCAR/cesm-lens-aws/master?urlpath=lab">here</a> to run the notebook now on one of Pangeo’s BinderHub deployments.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FAfri3dNQSoQ%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAfri3dNQSoQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FAfri3dNQSoQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4527cb0e3026dd904fc6aab658fc901/href">https://medium.com/media/b4527cb0e3026dd904fc6aab658fc901/href</a></iframe><p>We’ve only reproduced two figures from the Kay et al. paper but more could be done. If you’re interested in extending our analysis, pull requests are welcome on the <a href="https://github.com/NCAR/cesm-lens-aws">CESM-LENS-AWS GitHub repository</a>.</p><h3>Conclusions</h3><p>Climate modeling efforts, like the CESM Large Ensemble and <a href="https://www.wcrp-climate.org/wgcm-cmip/wgcm-cmip6">CMIP6</a>, are producing ever-increasing data archives. Rather than keep these archives on restricted access HPC or tape archival systems, there is a growing call to move these datasets to more accessible locations like cloud storage where anyone can access the data in place, without the need to first download the data archive. By moving the CESM LENS data archive to the cloud, we hope to enable both new scientific applications with the LENS data and the development of new tools and new approaches for working with large ensembles of climate data in the cloud.</p><h4>Acknowledgements</h4><p>This effort was coordinated though the NCAR Science at Scale Team and led by Jeff de La Beaujardiere. Specific thanks <a href="https://medium.com/u/bc2b9ddd350c">Anderson Banihirwe</a>, Chi-Fan Shih, Brian Bonnlander, <a href="https://medium.com/u/df9f03847f67">Joe Hamman</a>, Gary Strand, Eric Nienhouse, Seth McGinnis, Kevin Paul, and others from NCAR, as well as <a href="https://medium.com/u/372092fbb5ed">Joe Flasher</a>, Ana Pinheiro Privette, <a href="https://medium.com/u/a17faa5dada8">Jed Sundwall</a>, and others from Amazon. NCAR is a Federally Funded Research and Development Center, sponsored by NSF.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e2a996397a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/cesm-lens-on-aws-4e2a996397a1">Analyzing large climate model ensembles in the cloud</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pangeo and Kubernetes, Part 2: Cluster Design]]></title>
            <link>https://medium.com/pangeo/pangeo-cloud-cluster-design-9d58a1bf1ad3?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d58a1bf1ad3</guid>
            <category><![CDATA[pangeo]]></category>
            <category><![CDATA[jupyterhub]]></category>
            <category><![CDATA[dask]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Thu, 30 May 2019 21:11:02 GMT</pubDate>
            <atom:updated>2019-05-31T01:44:48.021Z</atom:updated>
            <content:encoded><![CDATA[<p>In my <a href="https://medium.com/pangeo/pangeo-cloud-costs-part1-f89842da411d">last post</a>, we looked into Pangeo’s cloud costs and discussed what it would like to budget for a typical Pangeo research cluster. In this post, I’ll present a technical and opinionated design for a typical Pangeo Kubernetes cluster. I’ll focus on the design features that impact scaling, cost, and scheduling and discuss some recent improvements to JupyterHub, BinderHub and Dask-Kubernetes that were implemented to improve behavior in these areas.</p><p>To review, we’re interested in deploying a Kubernetes cluster with this basic node-pool configuration:</p><ol><li>Core-pool: This is where we run things like the JupyterHub and other persistent system services (web proxies, etc.). We keep this as small as possible, just big enough to run core services.</li><li>Jupyter-pool(s): This is an auto-scaling node pool where we put single-user Jupyter sessions. By autoscaling, we mean that size of the node pool (number of virtual machines) increases/decreases dynamically based on cluster load.</li><li>Dask-pool(s): This is a second auto-scaling node pool designed to run dask-kubernetes workers. The node pool is setup to use preemptible (aka spot) instances to save on cost.</li></ol><h4>Motivation</h4><p>Before we get started, let me list a few of the reasons the enhanced cluster design discussed here is needed:</p><ul><li><em>Optimize for rapid scaling </em>— users want clusters to scale up quickly and admins want clusters to scale down quickly when load decreases. Early versions of Pangeo on Kubernetes suffered from long scale down times (see <a href="https://github.com/pangeo-data/helm-chart/issues/58">this</a> GitHub issue for one such example). We determined there were two issues contributing to this problem. First, Kubernetes system pods were drifting onto nodes intended for Jupyter and Dask pods, preventing seamless scale down. Second, pods were often packed into nodes inefficiently, leading to low utilization.</li><li><em>Explicit node pools</em> — We have previously used a Kubernetes feature <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector">node selectors</a> to control where pods were scheduled. This worked well for most pods intended to be scheduled in the core and jupyter pools but didn’t provide anyway to keep system or dask pods where they belong. Additionally, it required users of dask-kubernetes on Pangeo deployments to implement a specific dask worker selector in their configuration. In all, this just ended up being really brittle and failing too often.</li><li><em>Cost control </em>— related to the two points above is the issue of cost controls. The main point here is that we want to make sure we’re always using preemptible instances for dask-workers and we need ways to insure this happens.</li></ul><p>So, given these failures, we set off on a quest to improve the infrastructure around scheduling Kubernetes pods for.</p><h4>Keeping pods where they belong</h4><p>Because we have (at least) three node pools with varying characteristics, we want to introduce some tools for herding pods into the right places. Ultimately, we want to make sure the JupyterHub pods stay in the core-pool, the user pods stay in the Jupyter-pool, and the Dask pods stay in the dask-pool. Kubernetes has two concepts that allow us control when, where, and why pods are scheduled to specific nodes. The first concept is pod affinity and the second is taints and tolerations.</p><p><strong>Node Affinity</strong> — the concept of node affinity gives us the power to attract pods to specific nodes. Pods can have affinity for being scheduled on certain nodes. There are three different kinds of affinity, and then they can all be either preferred or required which is also sometimes described as soft or hard affinities. The three kinds of affinity a pod can have are node affinity, pod affinity, and pod anti affinity.</p><ul><li>If a pod has a <em>node affinity</em>, it will want to be scheduled on a node with a certain label.</li><li>If a pod has a <em>pod affinity</em>, it will want to be scheduled on a node that already has a certain pod identified by a provided label scheduled on it.</li><li>If a has a <em>pod anti-affinity</em>, it will want to be scheduled on a node that does not already has a certain pod identified by a provided label scheduled on it.</li></ul><p>As we discussed above, node affinities can be based on a variety of markers, including node labels. In our case, we want all single-user Jupyter sessions to attract to the jupyter-pool and we can accomplish this by adding the hub.jupyter.org/node-purpose: user label to the jupyter-pool nodes. We then rely on built in node affinity settings in Zero-to-JupyterHub to do the rest.</p><pre># Jupyter-notebook-pod<br>spec:<br> affinity:<br> nodeAffinity:<br> requiredDuringSchedulingIgnoredDuringExecution:<br> nodeSelectorTerms:<br> — matchExpressions:<br> — key: hub.jupyter.org/node-purpose<br> operator: In<br> values:<br> — user</pre><pre># Jupyter-pool-nodes<br>metadata:<br> labels:<br> hub.jupyter.org/node-purpose: user</pre><p>In the deployment example below, we’ll repeat this approach for the other node pools. More details on the affinity concepts can be found in the <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity">Kubernetes documentation</a>.</p><p><strong>Taints and Tolerations</strong> — the concepts of taints and tolerations give us the power to repel pods that aren’t intended for specific nodes. These controls are particularly useful in a few common scenarios that we run into:</p><ul><li>We want to keep Kubernetes system pods in the core pool. These pods are often long running tasks and can get in the way of autoscaling. By making sure all of our node pools (except the core-pool) have taints on them, we can effectively constrain system pods to the core-pool.</li><li>We want to limit certain pools to specific types of pods. For example, in our clusters, we want to only run dask-workers in node pools with the more cost-effective preemptible instances. By adding a taint to the dask-pool, we can repel all pods that are not dask-workers.</li></ul><p>We will add taints to both the Jupyter and Dask -pools. In the case of dask-workers, we can add a single taint (k8s.dask.org_dedicated=worker:NO_SCHEDULE) that dask-worker pods will tolerate <a href="http://kubernetes.dask.org/en/latest/#deployment-details">by default</a>. Again, the Kubernetes documentation provides a good bit of <a href="https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/">documentation</a> on this subject.</p><pre># dask-kubernetes-pods<br>spec:<br> tolerations:<br> — effect: NoSchedule<br> key: k8s.dask.org_dedicated<br> operator: Equal<br> value: worker<br><br># dask-pool-nodes<br>spec:<br> taints:<br> — effect: NoSchedule<br> key: k8s.dask.org_dedicated<br> value: worker</pre><h4>Scheduler</h4><p>The Zero-to-JupyterHub project recently (v0.8) added a series of <a href="https://zero-to-jupyterhub.readthedocs.io/en/latest/optimization.html?highlight=scheduling#optimizations">optimizations</a> that give administrators options for managing the scheduling of pods controlled by JupyterHub. Two of these features are particularly impactful for Pangeo workloads. First, the userScheduler option helps pack pods full when new sessions are spawned, helping the cluster scale down more efficiently. Second, the nodeAffinity option allows us to <strong><em>require</em></strong> both user and core pods be scheduled on nodes that match the node purpose label.</p><pre># JupyterHub-values-yaml<br>jupyterhub:<br> scheduling:<br> userScheduler:<br> enabled: true<br> userPods:<br> nodeAffinity:<br> matchNodePurpose: require<br> corePods:<br> nodeAffinity:<br> matchNodePurpose: require</pre><h4>Deploying our node-pools</h4><p>The <a href="http://pangeo.io/setup_guides/cloud.html">Pangeo documentation</a> provides a step-by-step guide for setting up a Kubernetes cluster. Here, I’m simply going to extend that tutorial by adding the labels and taints described above. The rest of the setup of Kubernetes and Helm remains the same. I’ll provide an example of how to do this using <a href="https://cloud.google.com/sdk/">GCP’s SDK</a> but the basic pattern should be easily replicable on any Kubernetes deployment. Eventually, we’ll push most of this to Pangeo’s setup guide as well.</p><pre># core-pool<br>core_machine_type=”n1-standard-2&quot;<br>core_labels=”hub.jupyter.org/node-purpose=core”<br>gcloud container node-pools create core-pool \<br> — cluster=${cluster_name} \<br> — machine-type=${core_machine_type} \<br> — zone=${zone} \<br> — num-nodes=2 \<br> — node-labels ${core_labels}</pre><pre># jupyter-pool<br>jupyter_machine_type=”n1-highmem-16&quot;<br>jupyter_taints=”hub.jupyter.org_dedicated=user:NoSchedule”<br>jupyter_labels=”hub.jupyter.org/node-purpose=user”<br>gcloud container node-pools create jupyter-pool \<br> — cluster=${cluster_name} \<br> — machine-type=${jupyter_machine_type} \<br> — disk-type=pd-ssd \<br> — zone=${zone} \<br> — num-nodes=0 \<br> — enable-autoscaling — min-nodes=0 — max-nodes=10 \<br> — node-taints ${jupyter_taints} \<br> — node-labels ${jupyter_labels}</pre><pre># dask-pool<br>dask_machine_type=”n1-highmem-4&quot;<br>dask_taints=”k8s.dask.org_dedicated=worker:NoSchedule”<br>dask_labels=”k8s.dask.org/node-purpose=worker”<br>gcloud container node-pools create dask-pool \<br> — cluster=${cluster_name} \<br> — preemptible \<br> — machine-type=${dask_machine_type} \<br> — disk-type=pd-ssd \<br> — zone=${zone} \<br> — num-nodes=0 \<br> — enable-autoscaling — min-nodes=0 — max-nodes=10 \<br> — node-taints ${dask_taints} \<br> — node-labels ${dask_labels}</pre><h4>What had to change to make this all work</h4><p>Apart from the JupyterHub user scheduler that came out in v0.8 of Zero-to-JupyterHub, not much needed to change. We did make a few small, backward compatible changes to Dask-Kubernetes (see <a href="https://github.com/dask/dask-kubernetes/pulls?utf8=%E2%9C%93&amp;q=is%3Apr+is%3Aclosed+author%3Ajhamman+affinity">here</a>) in its version 0.8 but other than that, everything was already possible. There were also some similar fixes BinderHub (see <a href="https://github.com/jupyterhub/binderhub/pulls?utf8=%E2%9C%93&amp;q=is%3Apr+author%3Ajhamman+is%3Aclosed+toleration">here</a>) to help control the scheduling of build pods on <a href="https://binder.pangeo.io/">binder.pangeo.io</a>.</p><h4>Wrapping up</h4><p>Now we get to sit back and watch our clusters behave. We can already see higher use of preemptible node pools on our clusters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*lcYtsN9HnNqgbT6WS71bag.png" /><figcaption>Timeseries of costs on our main Kubernetes cluster. We transitioned to the new cluster design around May 6th, at which point the usage preemptible instances (red and green) increased.</figcaption></figure><p>Going forward, there are some interesting experiments we’d like to mix into these concepts. Two that come immediately to mind are:</p><ul><li>including using <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning">GKE’s node-auto-provisioning</a> for automatic management of multiple node pools.</li><li>using the userScheduler to managed node assignment for dask-workers.</li></ul><p><em>Thanks to Erik Sundell, Yuvi Panda, Tim Head, Jacob Tomlinson for their help in the various development efforts that contributed to this work.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d58a1bf1ad3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/pangeo-cloud-cluster-design-9d58a1bf1ad3">Pangeo and Kubernetes, Part 2: Cluster Design</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pangeo and Kubernetes,  Part 1: Understanding costs]]></title>
            <link>https://medium.com/pangeo/pangeo-cloud-costs-part1-f89842da411d?source=rss-df9f03847f67------2</link>
            <guid isPermaLink="false">https://medium.com/p/f89842da411d</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[pangeo]]></category>
            <category><![CDATA[jupyter]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[science]]></category>
            <dc:creator><![CDATA[Joe Hamman]]></dc:creator>
            <pubDate>Tue, 14 May 2019 13:01:00 GMT</pubDate>
            <atom:updated>2019-05-14T13:01:00.927Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pangeo and Kubernetes, Part 1: Understanding costs</h3><p>When we talk to people about Pangeo on the Cloud, we’re often presented with questions about costs? How much does it cost? Who pays for it? What’s the long-term plan for Pangeo on the Cloud?</p><p>Before diving into the details, I think it is important that we revisit why we’re so excited about Pangeo on the Cloud. I’ll argue the most compelling aspects of the cloud fall into four categories.</p><ul><li><em>Scale:</em> As we move fully into the Big Data era, the cloud offers a compelling combination of large scale storage and compute. It is also accessible to everyone so we can scale access, in addition to computational workloads.</li><li><em>Community hub:</em> We’ve found that something as simple as a JupyterHub on the Cloud is a powerful tool for bringing together a community of researchers and developers.</li><li><em>Reproducibility:</em> It’s well known that scientific workflows are often hard/difficult to reproduce, especially in the absence of shared infrastructure. The cloud offers the opportunity to share infrastructure, an important first step in the reproducibility quest.</li><li><em>Extensibility:</em> The ability to share your work and let others pick up where you left off is central to the scientific enterprise. By sharing datasets and infrastructure on the cloud, we make it much easier to extent computational scientific research.</li></ul><p><strong>What is Pangeo on the Cloud?</strong></p><p>In almost all cases, Pangeo on the Cloud is a <a href="https://jupyterhub.readthedocs.io/en/stable/">JupyterHub</a> deployment running on <a href="https://kubernetes.io/">Kubernetes</a>. Kubernetes is an open-source container orchestration system for automating application deployment, scaling, and management of cloud applications. Managed Kubernetes services are offered by all of the major cloud providers (e.g. <a href="https://cloud.google.com/kubernetes-engine/">GKE</a>, <a href="https://aws.amazon.com/eks/">EKS</a>, <a href="https://docs.microsoft.com/en-us/azure/aks/">AKS</a>). We use the <a href="https://zero-to-jupyterhub.readthedocs.io/en/latest/">Zero-to-JupyterHub with Kubernetes project’s</a> configuration (aka Helm Chart) to deploy a custom JupyterHub with permissions that allow users to scale their computations across a dynamic cluster. As I’ll write about more in my next blog post, a typical Pangeo Kubernetes Cluster has three classes of node pools (groups of virtual machines in Kubernetes Cluster).</p><ol><li><em>Core-pool</em>: This is where we run things like the JupyterHub and other persistent system services (web proxies, etc.). We keep this as small as possible, just big enough to run core services.</li><li><em>Jupyter-pool</em>: This is an auto-scaling node pool where we put single-user Jupyter sessions. By autoscaling, we mean that size of the node pool (number of virtual machines) increases/decreases dynamically based on cluster load.</li><li><em>Dask-pool</em>: This is a second auto-scaling node pool designed to run <a href="https://kubernetes.dask.org/en/latest/">dask-kubernetes</a> workers. The node pool is setup to use <a href="https://cloudplatform.googleblog.com/2015/05/Introducing-Preemptible-VMs-a-new-class-of-compute-available-at-70-off-standard-pricing.html">preemptible</a> (aka spot) instances to save on cost.</li></ol><p>The Kubernetes Cluster is just the underlying infrastructure for Pangeo on the cloud. The rest of the system relies on a host of open source projects. <a href="https://medium.com/u/1b5dc243ac6e">Matthew Rocklin</a> wrote a great <a href="https://medium.com/pangeo/jupyterhub-dask-and-xarray-on-the-cloud-f745d4fe5c16">blog post</a> last year describing how all the pieces come together. Because we’re mostly interested here in how the costs break down, will stop there and reference the prior blog post for further details on the software ecosystem surround Pangeo on the Cloud.</p><p><strong>Pangeo on Google Cloud</strong></p><p>As part of the <a href="https://medium.com/pangeo/announcing-pangeo-earthcube-award-fefbe54acbec">NSF EarthCube award </a>that helped kick start the Pangeo Project, we were awarded about $100,000 of compute credits over three years with <a href="https://cloud.google.com/">Google Cloud Platform</a>. At the time, this seemed like a truly exorbitant amount but as I’ll outline below, we’ve been successful at finding ways to spend the credits. We are currently in our final year and we’re starting to plan for how to support the Pangeo Projects Cloud efforts going forward. Here’s a figure breaking down the costs in the first two years of the Pangeo Project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*QpMRu7Pet1IqJigicxdlHw.png" /><figcaption>Daily cost for all services used in the Pangeo Google Cloud Platform Account.</figcaption></figure><p>What have we been spending on our credits on? We can break our spending down into four line items:</p><ul><li><a href="http://pangeo.pydata.org/"><em>pangeo.pydata.org</em></a>: We started with a single JupyterHub running on one large Kubernetes Cluster, this was called <a href="http://pangeo.pydata.org/">pangeo.pydata.org</a>. It was live for about a year (December 2017 through January 2019) and when we shut it down, pangeo.pydata.org had about 1200 unique user accounts, most of which were 1-time visitors that heard about Pangeo at a conference or workshop.</li><li><a href="http://binder.pangeo.io/"><em>binder.pangeo.io</em></a>: In August 2018, we launched binder.pangeo.io (see this blog post). It was designed to be a more natural place for 1-time visitors to try out the Pangeo system.</li><li><em>Pangeo-Cloud-Federation</em>: In September 2018, we started deploying a new class of Pangeo clusters organized by research area. We’ve dubbed this system the Pangeo Cloud Federation (see <a href="https://github.com/pangeo-data/pangeo-cloud-federation">this</a> GitHub repository). As part of this effort, we’ve deployed 8 more JupyterHubs (6 on GCP, 2 on AWS). More on these individual hubs in another blog post.</li><li><em>Cloud storage</em>: We’re storing about 56 TB of data in Google Cloud Storage.</li></ul><p>Storage costs are relatively easy to explain ($35/day for 56 TB) so I’ll mostly focus on what it costs to run a single Pangeo JupyterHub. If you are interested in estimating the costs for storage and/or compute, I recommend spending a few minutes with a cloud cost estimator (e.g <a href="https://cloud.google.com/products/calculator/">GCP</a>, <a href="https://calculator.s3.amazonaws.com/index.html">AWS</a>, <a href="https://azure.microsoft.com/en-us/pricing/calculator/?&amp;OCID=AID719825_SEM_En1u9MUx&amp;lnkd=Google_Azure_Brand&amp;gclid=CjwKCAjwwtTmBRBqEiwA-b6c_8gDOvk2aNz8hqhpOxVHcsfXj9m1UmGMCgs1nzfZPzQ1nUmVCXK5LxoCfgsQAvD_BwE">Azure</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*LLTbCvVm6J5G-LetmrlSLQ.png" /><figcaption>Daily cost broken down by GKE SKU for the ocean-pangeo-io kubernetes cluster.</figcaption></figure><p>Above, I’m showing an example of the daily costs incurred for a single cluster (ocean.pangeo.io). This figure nicely illustrates the “bursty” nature of this scientific workloads and some relatively small persistent costs. From here, we’ll outline a hypothetical monthly budget for a single Pangeo clusters:</p><ul><li><em>Core-pool</em>: For our persistent services, we’ll fit them all onto a single n1-standard-2 (2 vCPUs, 7.5 GB memory) VM. This costs about $60/month.</li><li><em>Jupyter-pool</em>: For our single-user Jupyter pods, we’ll choose the n1-standard-2 (2 vCPUs, 7.5 GB memory) VM and assume 20-hrs of work per week. This comes out to $21/user/month.</li><li><em>Dask-pool</em>: This pool is more difficult to budget for in the hypothetical. For illustration purposes, let’s assume a single user will scale up their dask cluster for 1-hr per day, requesting 100 CPUs and 375 GB RAM. This would pencil out to about $100/user/month at standard pricing but since we’re running this pool on preemptible instances, we expect the cost to be cut by 70% — so $30/user/month.</li></ul><p>So if I have a research group of 8, I can expect to spend about $500/month on compute costs. When it comes to budgeting for compute-heavy workloads, its important to remember that whether you run your processing on 10 CPUs for 10 hours or 100 CPUs for 1 hour, the cost will be the same.</p><p><strong>Lessons learned</strong></p><p>Depending on how you slice it, we’re in our second or third iteration of the Pangeo Cloud concept. We’ve learned a lot during this time and here are a few of the highlights:</p><ul><li><em>Use shared user storage</em>: by default, each single-user Jupyter pod is assigned a “persistent disk”. As the name indicates, this disk is reserved for a single user and persists even after a user session ends. This is nice because when the user comes back, they can pick up where they left off. The downside of the persistent disk is that you pay for the full disk reservation, whether you use it or not. For this reason, we’ve switched to an alternative, shared NFS storage. This is a little more expensive per GB than persistent disks, but you only pay for what you use. More details on options in this space <a href="https://zero-to-jupyterhub.readthedocs.io/en/latest/user-storage.html?highlight=persistent%20disk#customizing-user-storage">here</a>.</li><li><em>Design to scale rapidly: </em>In the early days, we would often run into problems getting our cluster to scale up and down efficiently. Sometimes this would result in the cluster remaining in a scaled-up state for hours, costing us money even though we weren’t using it. Recent work in the JupyterHub and Dask-kubernetes projects, along with improvements in Kubernetes itself have all lessened this pain. I’ll unpack more of this concept in the next blog post.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*SDdMggOt3DClFwFzOh_21A.png" /><figcaption>Daily cost broken down by GKE SKU for the dev-pangeo-io kubernetes cluster. Note the increased use of preemptible instances starting on May 6th.</figcaption></figure><ul><li><em>Use telemetry: </em>Cloud providers sell lots of services. It can be difficult at times to track down where specific costs are coming from. We’ve been exporting our detailed billing logs to Google Big-Query and this has proved quite useful in analyzing where costs are coming from. Google also has a service called <a href="https://cloud.google.com/blog/products/containers-kubernetes/gke-usage-metering-whose-line-item-is-it-anyway">GKE usage metering</a>, that allows us to much more accurately determine where costs are coming from at the Kubernetes object level. We’re working on publishing all of these billing logs so everyone can take a look.</li></ul><p><strong>Conclusions and next stages</strong></p><p>When we started this part of the Pangeo Project, we had relatively little experience working on the Cloud. In fact, our original budget spreadsheet had more funds allocated for storage than for compute, a pattern we quickly departed from. Hopefully I’ve helped demystify some of the issues around Pangeo Cloud costs by sharing our approach to budgeting for Kubernetes clusters.</p><p>We have about one year of compute credits with GCP remaining on our initial grant. We’re at a stage now where we have a much better handle on how the various pieces fit together and we’re starting to look at various options for taking Pangeo’s cloud infrastructure to the next level. In the short term, this probably means submitting a follow-on grant proposal to Google (full disclosure: Amazon and Microsoft have also awarded Pangeo project members compute credits). Longer term, it’s probably up to research funding agencies like NASA and NSF to broker the dissemination of funding for cloud computing. This has the obvious advantage of opening up opportunities for bulk purchasing agreements at a scale larger than any single research team could manage. Finally, the bulk day-to-day maintenance of these systems is currently handled by scientists like myself. For this to scale further, we think there is likely a place for a central cloud DevOps team to help develop and manage these systems for researchers. Where such a team lives is yet to be determined.</p><p><em>Part 2 of this series will look into some recent improvements in how we build our Kubernetes clusters and some opinionated recommendations to improve both scaling and cost efficiency.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f89842da411d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pangeo/pangeo-cloud-costs-part1-f89842da411d">Pangeo and Kubernetes,  Part 1: Understanding costs</a> was originally published in <a href="https://medium.com/pangeo">pangeo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>