Skip to content

Instantly share code, notes, and snippets.

@BnJam
BnJam / cloudferro-eodata.py
Last active September 3, 2024 21:30
Accessing CREODIAS EOData blobs with `s3fs` instead of `boto3` in Python
import s3fs
# Up to your system admin to set these as env or make accessible
access_key = "<S3_ACCESS_KEY>"
secret_key = "<S3_SECRET_KEY>"
eodata_host = 'http://data.cloudferro.com'
s3 = s3fs.S3FileSystem(
key=access_key,
@BnJam
BnJam / global-utm-1km-grid.geojson
Created May 1, 2024 15:40
Global UTM 1km Grid GeoJSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BnJam
BnJam / README.md
Last active March 5, 2026 18:08
Graceful shutdown of a FastAPI application using uvicorn

Gracefully Shutting Down Uvicorn running FastAPI Application

The key libraries to achieve graceful shutting down to a Uvicorn server running a FastAPI application are the built in os and signal modules. Given an endpoint with which a client can request the server to shutdown.

os.kill(os.getpid(), signal.SIGTERM)

os.getpid() retrieves the running process' system ID and then signal.SIGINT is passed to the process to signal an interrupt.