pymerlin is a discrete event simulation framework, built for use in the Aerie ecosystem.
To learn more about Aerie, read the Aerie Docs.
- Daemon tasks
- More interesting cells and resources
- Conditions on static cells
- Conditions on autonomous cells
- Child tasks
- Spiceypy
- JPL time
- pip-installable models
- build Aerie-compatible jars and provide docker-compose file with python
- checkpoint restart
- Use available port to allow multiple pymerlin programs to run independently
- Cell expiry
- Polynomial evolution of cells
- Value schemas (inferred from python types, maybe?)
- Garbage collection of cells and effects (perhaps by wrapping integers in Supplier, and using
weakref.finalize
?) - Simulation configuration
- Run with java that isn't simply the "java" executable on the path
- python >=3.6.3 (only tested on 3.11 so far...)
- java >=21
Install pymerlin by running pip install pymerlin
- Make a venv
python -m venv venv
- Activate the venv
source ./venv/bin/activate
- Install requirements
python -m pip install -r requirements.txt
- Start jupyter lab
jupyter-lab
- When jupyter opens, navigate to
demo/simulation_example.py
- Update the path in the first cell to point to your cloned
pymerlin
directory (we should eliminate the need for this hack) - Run all cells
pymerlin is to merlin as pyspark is to spark. This means that pymerlin uses py4j as a bridge between a python process and a java process. This allows pymerlin to use the Aerie simulation engine directly, without having to re-implement it in python.
This means that running simulate
starts a subprocess using java -jar /path/to/pymerlin.jar
.
The main tenet of pymerlin is approachability, and its aim is to enable rapid prototyping of models and activities. While where possible, performance will be considered, it is expected that someone who wants to seriously engineer the performance of their simulation will port their code to Java - which has the double benefit of removing socket communication overhead, as well as giving the engineer a single Java process to instrument and analyze, rather than a hybrid system, which may be more difficult to characterize.
If any changes are made to the java code, rebuild the jar and place it in the correct location as follows:
cd java
./gradlew assemble
mv pymerlin/build/libs/pymerlin.jar ../pymerlin/_internal/jars
The jar lives inside of the pymerlin
python source directory because that ensures that it will be packaged
(and accessible) in a distribution.