Dynamic DES
Dynamic DES runs SimPy discrete-event simulations in step with the system clock, or as fast as the machine allows. A running simulation takes parameter changes (arrival rates, service times, capacities) from Kafka, Redis, PostgreSQL or a timed scenario, without stopping. Its task events and telemetry go to the sinks you attach: Kafka, Redis, PostgreSQL, Parquet or JSONL files on local disk or S3-compatible storage such as AWS S3 or SeaweedFS, or an Apache Iceberg table through a REST catalog.
A simulation can be written three ways: with the low-level DynamicRealtimeEnvironment, with the declarative SimulationContext builder, or as a plain YAML blueprint run with the ddes command. One run can generate backdated history at full speed and then continue in real time, so the same model can fill a data lake and then feed a live system.
Key Features
- โก Real-Time Control: Synchronize SimPy with the system clock using
DynamicRealtimeEnvironment. - ๐งญ Three Ways to Write a Simulation: The low-level
DynamicRealtimeEnvironment, the declarativeSimulationContextbuilder, or a YAML blueprint. All three build the same parameters and run on the same environment. - ๐งพ YAML Blueprints: Declare parameters, connectors, tasks, telemetry and timed experiments in a plain YAML file and run it with
ddes run. Logic that YAML cannot express stays in Python and is referenced through!python. - โฉ Backfill Then Go Live: One run generates backdated history unpaced, then switches to real time at
go_live_at, with one seed and one seam. - ๐ Several Sinks per Run: Attach a stream sink and a lake sink to one run, each with its own
whenpredicate,batch_sizeandflush_intervalonadd_egress. - ๐ Dynamic Registry: Dynamic, path-based updates (e.g.,
Line_A.arrival.standard.rate) that trigger instant logic changes. - ๐ High Throughput: Optimized to handle high throughput using
orjsonand local batching. - ๐ก๏ธ Enterprise Ready: Native
**kwargspassthrough for SASL, mTLS, OAuth, and AWS IAM Kafka clusters. - ๐ฆ Pluggable Serialization: Stream lightweight JSON by default, or map specific ML topics to lazy-loaded Avro/Schema Registry serializers (Confluent & AWS Glue).
- ๐๏ธ Data Lake Ingestion: Native PyArrow VFS integration for fast chunked writing (Parquet/JSONL) directly to object storage, with built-in schema inference and drift enforcement.
- ๐ง Lakehouse Ingestion: Append straight into an Apache Iceberg table through an Iceberg REST catalog, with one commit per flush so the snapshot count stays under your control.
- ๐ฆ Pydantic Duck-Typing: Seamlessly publish strictly-typed Pydantic V2 models straight from your simulation logic.
- ๐ System Observability: Built-in lag monitoring to track simulation drift from real-world time.
- ๐ Domain Agnostic: Perfect for factory floors, crypto trading bots, or RPG game state management.
Documentation Layout
- Getting Started: Install, download the examples, and start the containers they need.
- Tutorials, one factory written three ways:
- Part 1: Low-level API: Build the factory on
DynamicRealtimeEnvironment, with SimPy processes started byenv.process. - Part 2: Declarative API: Build the factory with
SimulationContext, add randomness and scheduled capacity changes, then connect it to Kafka. - Part 3: YAML: Write the same factory as a blueprint and run it with
ddes run.
- Part 1: Low-level API: Build the factory on
- Core Architecture:
- Overview: The three ways to write a simulation, and the parameters and environment they share.
- Writing a simulation: Low-level API, Declarative API, YAML Blueprints.
- Runtime: Realtime Environment, Registry and Live Parameters, Time, Resources and Containers, Connectors, Records and Telemetry, Batching and Delivery.
- Guides:
- Advanced: Advanced YAML: Custom Logic with
!python, Multi-Resource Handoffs, Preemptive Machine Breakdowns, Absolute Edge Cases (Dynamic Topology). - Examples, one page per example, with a tab for each way it is written. Backfill Then Go Live has declarative and YAML tabs, and the advanced orders example is YAML only: Local, Kafka, Parquet, Iceberg, Postgres, Redis, Backfill Then Go Live, Orders with Line Items (Advanced YAML).
- API Reference: Technical reference for all public classes.