A runtime system for NMDC data management and orchestration
Project description
A runtime system for NMDC data management and orchestration.
Service Status
http://nmdcstatus.polyneme.xyz/
How It Fits In
-
issues
tracks issues related to NMDC, which may necessitate work across multiple repos. -
nmdc-schema houses the LinkML schema specification, as well as generated artifacts (e.g. JSON Schema).
-
nmdc-server houses code specific to the data portal -- its database, back-end API, and front-end application.
-
workflow_documentation references workflow code spread across several repositories, that take source data and produce computed data.
-
This repo (nmdc-runtime)
- houses code that takes source data and computed data, and transforms it to broadly accommodate downstream applications such as the data portal
- manages execution of the above (i.e., lightweight data transformations) and also of computationally- and data-intensive workflows performed at other sites, ensuring that claimed jobs have access to needed configuration and data resources.
Data exports
The NMDC metadata as of 2021-10 is available here:
https://drs.microbiomedata.org/ga4gh/drs/v1/objects/sys086d541
The link returns a GA4GH DRS API bundle object record, with the NMDC metadata collections (study_set, biosample_set, etc.) as contents, each a DRS API blob object.
For example the blob for the study_set collection export, named "study_set.jsonl.gz", is listed with DRS API ID "sys0xsry70". Thus, it is retrievable via
https://drs.microbiomedata.org/ga4gh/drs/v1/objects/sys0xsry70
The returned blob object record lists https://nmdc-runtime.files.polyneme.xyz/nmdcdb-mongoexport/2021-10-14/study_set.jsonl.gz as the url for an access method.
The 2021-10 exports are currently all accessible at https://nmdc-runtime.files.polyneme.xyz/nmdcdb-mongoexport/2021-10-14/${COLLECTION_NAME}.jsonl.gz, but the DRS API indirection allows these links to change in the future, for mirroring via other URLs, etc. So, the DRS API links should be the links you share.
Overview
The runtime features:
-
Dagster orchestration:
- dagit - a web UI to monitor and manage the running system.
- dagster-daemon - a service that triggers pipeline runs based on time or external state.
- PostgresSQL database - for storing run history, event logs, and scheduler state.
- workspace code
- Code to run is loaded into a Dagster
workspace. This code is loaded from one or more dagsterrepositories. Each Dagsterrepositorymay be run with a different Python virtual environment if need be, and may be loaded from a local Python file orpip installed from an external source. In our case, each Dagsterrepositoryis simply loaded from a Python file local to the nmdc-runtime GitHub repository, and all code is run in the same Python environment. - A Dagster repository consists of
solidsandpipelines, and optionallyschedulesandsensors.solidsrepresent individual units of computationpipelinesare built up from solidsschedulestrigger recurring pipeline runs based on timesensorstrigger pipeline runs based on external state
- Each
pipelinecan declare dependencies on any runtimeresourcesor additional configuration. There are TerminusDB and MongoDBresourcesdefined, as well aspresetconfiguration definitions for both "dev" and "prod"modes. Thepresets tell Dagster to look to a set of known environment variables to load resources configurations, depending on themode.
- Code to run is loaded into a Dagster
-
A TerminusDB database supporting revision control of schema-validated data.
-
A MongoDB database supporting write-once, high-throughput internal data storage by the nmdc-runtime FastAPI instance.
-
A FastAPI service to interface with the orchestrator and database, as a hub for data management and workflow automation.
Local Development
Ensure Docker (and Docker Compose) are installed; and the Docker engine is running.
docker --version
docker compose version
docker info
Ensure the permissions of ./mongoKeyFile are such that only the file's owner can read or write the file.
chmod 600 ./mongoKeyFile
Ensure you have a .env file for the Docker services to source from. You may copy .env.example to
.env (which is gitignore'd) to get started.
cp .env.example .env
Create environment variables in your shell session, based upon the contents of the .env file.
export $(grep -v '^#' .env | xargs)
If you are connecting to resources that require an SSH tunnel—for example, a MongoDB server that is only accessible on the NERSC network—set up the SSH tunnel.
The following command could be useful to you, either directly or as a template (see Makefile).
make nersc-mongo-tunnels
Finally, spin up the Docker Compose stack.
make up-dev
Docker Compose is used to start local MongoDB and PostgresSQL (used by Dagster) instances, as well as a Dagster web server (dagit) and daemon (dagster-daemon).
The Dagit web server is viewable at http://localhost:3000/.
The FastAPI service is viewable at http://localhost:8000/ -- e.g., rendered documentation at http://localhost:8000/redoc/.
Local Testing
Tests can be found in tests and are run with the following commands:
On an M1 Mac? May need to export DOCKER_DEFAULT_PLATFORM=linux/amd64.
make up-test
make test
As you create Dagster solids and pipelines, add tests in tests/ to check that your code behaves as
desired and does not break over time.
Release to PyPI
rm -rf dist
python -m build
twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nmdc_runtime-1.0.4.tar.gz.
File metadata
- Download URL: nmdc_runtime-1.0.4.tar.gz
- Upload date:
- Size: 63.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b94ed28977c2aa1969191107a4e5e7051ff17eeeafd6c5c079c6609702c8ffdd
|
|
| MD5 |
5e021e250a8c071f937949aa85448ff4
|
|
| BLAKE2b-256 |
9e90ec35cff97b890d3460295c3429d5c8422d82a38d959dcb69dce2ce8837c0
|
File details
Details for the file nmdc_runtime-1.0.4-py3-none-any.whl.
File metadata
- Download URL: nmdc_runtime-1.0.4-py3-none-any.whl
- Upload date:
- Size: 118.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed3f31311fcf2bd26c22746428b5c6ced7fa54338b55e33485dd86dd965341ce
|
|
| MD5 |
07c287ba99c39ddcf18b3cdd1bcabcac
|
|
| BLAKE2b-256 |
91137b4668fac66e4189055f043538ff82b1941bf1c26ec3a0c6b43881f94282
|