|
1 | 1 | --- |
2 | 2 | myst: |
3 | 3 | html_meta: |
4 | | - description: "FastAPI/ASGI crop disease forecasting service from UW–Madison DSI, ported to OpenLambda." |
5 | | - keywords: "AgForecast, FastAPI, ASGI, OpenLambda, crop disease, Wisconet, serverless" |
| 4 | + description: "A FastAPI/ASGI application used as a case study for porting real workloads to OpenLambda." |
| 5 | + keywords: "OpenLambda, serverless, FastAPI, ASGI, case study" |
6 | 6 | --- |
7 | 7 |
|
8 | 8 | # Agricultural Forecasting API |
9 | 9 |
|
10 | | -A FastAPI-based ASGI service for crop disease risk forecasting using multi-source weather |
11 | | -data, developed by the [University of Wisconsin–Madison Data Science Institute](https://dsi.wisc.edu/) |
12 | | -and ported to OpenLambda as a case study in deploying real-world applications. |
| 10 | +A FastAPI-based ASGI service from the [UW–Madison Data Science Institute](https://dsi.wisc.edu/), |
| 11 | +used here as a **case study for OpenLambda** — an existing, real-world application that was |
| 12 | +never designed for serverless, ported to the platform to find out what OpenLambda needs. |
13 | 13 |
|
14 | | ---- |
15 | | - |
16 | | -## Overview |
17 | | - |
18 | | -The Ag Forecasting API provides geospatial agricultural intelligence for Wisconsin, |
19 | | -combining weather data with peer-reviewed crop disease forecasting models. It exposes two |
20 | | -parallel data pipelines through a unified interface: |
21 | | - |
22 | | -- **Wisconet** — the public mesonet of weather stations across the state. |
23 | | -- **IBM Environmental Intelligence** — point-location queries by latitude and longitude. |
| 14 | +```{note} |
| 15 | +This page focuses on what the port taught us about OpenLambda. For the application itself, |
| 16 | +see its [source repository](https://github.com/UW-Madison-DSI/ag_forecasting_api). |
| 17 | +``` |
24 | 18 |
|
25 | | -The core logic lives in the `ag_models_wrappers` module, which dynamically pulls the daily |
26 | | -and hourly weather variables each model requires for a given forecasting date, runs the risk |
27 | | -calculations, and returns localized predictions. |
| 19 | +## Why this application |
28 | 20 |
|
29 | | -## Supported models |
| 21 | +It's a good stress test for OpenLambda because it is non-trivial and ordinary: a FastAPI |
| 22 | +(ASGI) backend with real package dependencies, weather-data caching, and parallel compute — |
| 23 | +the kind of app teams actually run, not a serverless demo. |
30 | 24 |
|
31 | | -All models are based on peer-reviewed plant pathology research from UW–Madison: |
| 25 | +## What it drove in OpenLambda |
32 | 26 |
|
33 | | -- **Sporecaster** — white mold in soybean (dry and irrigated row-spacing variants) |
34 | | -- **Tarspotter** — tar spot of corn |
35 | | -- **Gray leaf spot** (corn) |
36 | | -- **Frogeye leaf spot** (soybean) |
| 27 | +Porting it surfaced five concrete challenges that drove four new OpenLambda features: |
37 | 28 |
|
38 | | -## Architecture |
| 29 | +- **Per-function environment variables** — to redirect writes away from read-only directories. |
| 30 | +- **`pip-compile` as a lambda** — to pin dependencies inside the OpenLambda environment. |
| 31 | +- **Direct GitHub deployment** — `ol admin install` straight from a repo URL. |
| 32 | +- **Built-in ASGI support** — OpenLambda acts as the ASGI server for FastAPI/Starlette/etc. |
39 | 33 |
|
40 | | -The service is built on FastAPI (ASGI), with a Starlette `WSGIMiddleware` wrapper so it can |
41 | | -also be served behind WSGI servers for legacy or mixed environments. A companion sub-package, |
42 | | -`pywisconet`, provides a thin REST wrapper over the Wisconet v1 API for active-station |
43 | | -discovery, station field metadata, and bulk measurement retrieval. IBM credentials are |
44 | | -supplied via environment variables (`IBM_API_KEY`, `TENANT_ID`, `ORG_ID`). |
| 34 | +It also pointed to a future feature: `/dev/shm` support so process pools work under OpenLambda. |
45 | 35 |
|
46 | | -## Running on OpenLambda |
47 | | - |
48 | | -Porting AgForecast surfaced five concrete challenges — writable directories, package version |
49 | | -pinning, GitHub deployment, asynchronous execution, and parallel pools — that drove four new |
50 | | -OpenLambda features: per-function environment variables, `pip-compile` as a lambda, direct |
51 | | -GitHub deployment, and built-in ASGI support. The full write-up is in the |
| 36 | +The full porting write-up is in the |
52 | 37 | [blog case study](../blog/post/2026-05-18-ag-forecasting-case-study.md). |
53 | | - |
54 | | -## References |
55 | | - |
56 | | -- Source: [UW-Madison-DSI/ag_forecasting_api](https://github.com/UW-Madison-DSI/ag_forecasting_api) |
57 | | -- Live deployment: [connect.doit.wisc.edu/ag_forecasting_api](https://connect.doit.wisc.edu/ag_forecasting_api) |
58 | | -- License: MIT |
0 commit comments