Model Runner
Overview
The Model Runner schedules, manages, and executes models on blockchain data.
- Runtime: Python3.7
- Persistence: Postgres, Redis, RabbitMQ, Kafka
- Third-party Frameworks: Celery (task management), FastAPI (webserver)
- Internal libraries: engine (internal utilities), python-models (model code)
Architecture
Core Components

- scheduler - periodically schedules and expires model runs
- api - handles submission of model runs
- worker - handles processing of model runs
Worker Layout

Model Run State

Ownership
- Data Platform
- Slack Channel: #team-data-platform
Downstream Dependencies
- Velocity - Analytics query platform
Service Dependencies
- Vertex - source of block data
- Confluent Kafka - sinks data to Snowflake
- Model Jobs API - registry of active models
Upstream Dependencies
- Chainwalkers - produces block data
- Relayer - relays block data to the Indexer
- Indexer - persists block data to Postgres
Core Components
- Scheduler - Terminates and schedules model runs
- Workers - Executes models and forwards results downstream
- Enqueuer - Fans out messages to specific worker queues
- API - Webserver which handles model run CRUD operations
Where is the Code?
Code is deployed via Github Actions on commits to main.
- Data Platform monorepo: https://github.com/FlipsideCrypto/data-platform
- Python models repo: https://github.com/FlipsideCrypto/python-models
- API documentation: https://door-api-python.flipside.systems/redoc
What DNS addresses are supported?
Networking
Under construction 🚧.
Persistence
Databases
| Database | Name | Description | Host |
|---|---|---|---|
| postgres | door | model run state and results | prod-door.cluster-cik7nbaqdhks.us-east-1.rds.amazonaws.com |
| redis | db0 | model run progress and ABI cache | door-v2.jlfd3y.0001.use1.cache.amazonaws.com |
| rabbitMQ | data-platform-prod | pending run messages | b-f1aa7ceb-4ffa-450c-a17e-acf0e1963296.mq.us-east-1.amazonaws.com:6379 |
| kafka | prod | modeled result messages | pkc-4nym6.us-east-1.aws.confluent.cloud:9092 |
| snowflake | flipside_prod_db | stores modeled results | vna27887.us-east-1.snowflakecomputing.com |
RabbitMQ Queues
Queues follow the convention: <blockchain>_<realtime|backfill>_<reads|nonreads>. The current queues are:
- ethereum_realtime_reads - handles ethereum realtime read models
- ethereum_realtime_nonreads - handles ethereum realtime nonread models
- ethereum_backfill_reads - handles ethereum backfill read models
- ethereum_backfill_nonreads - handles ethereum backfill nonread models
- matic_realtime_reads - handles matic realtime read models
- matic_realtime_nonreads - handles matic realtime nonread models
- matic_backfill_reads - handles matic backfill read models
- matic_backfill_nonreads - handles matic backfill nonread models
- backfill_1 - handles adhoc runs
- backfill_2 - handles adhoc runs
- backfill_3 - handles adhoc runs
- backfill_4 - handles adhoc runs
Kafka Topics
Sink topics follow the convention: <env>-<blockchain>-sink.
- prod-ethereum-sink - stores ethereum messages to be written to Snowflake
- prod-matic-sink - stores polygon messages to be written to Snowflake
Snowflake Tables
- flipside_prod_db.bronze.prod_ethereum_sink_407559501 - ethereum modeled data
- flipside_prod_db.prod_matic_sink_510901820 - polygon modeled data
Logging
| Component | Log Source | Link |
|---|---|---|
| scheduler | Airflow | link |
| api | Datadog | link |
| ethereum-realtime | Datadog | link |
| ethereum-backfill | Datadog | link |
| matic-realtime | Datadog | link |
| matic-backfill | Datadog | link |
| backfill-1 | Datadog | link |
| backfill-2 | Datadog | link |
| backfill-3 | Datadog | link |
| backfill-4 | Datadog | link |
Monitoring
| Resource | Metrics | Link |
|---|---|---|
| Model Runner Monitoring Dashboard | blocks modeled, message durations, time in queue | link |
| RabbitMQ Management | queue size, ack rates, delivery rates, consumer counts | link |
| Confluent Cloud | topic production and consumption rates | link |
| AWS RDS | read and write IOPs | link |
| Airflow | scheduler DAG execution | link |
| APM Tracing | model execution tracing and error rates | link |
Error Reporting
Errors are reported to Sentry.
Where does it Run?
| Component | Resource | Region |
|---|---|---|
| Scheduler | AWS EKS - data-platform-prod/python-api | us-east-1 |
| Workers | AWS EKS - data-platform-prod/python-api | us-east-1 |
| Enqueuer | AWS EKS - data-platform-prod/python-api | us-east-1 |
| API | AWS EKS - data-platform-prod/python-api | us-east-1 |
Troubleshooting
