diff --git a/README.md b/README.md index 42283a8..3604b9c 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ The experiment description in `example.experiment` roughly translates to: Perfor ###### `example.py` -```python3 +```python def run(instance, save_callback, state): # do some stuff on "instance" ``` @@ -53,7 +53,7 @@ The `run` function is where the magic happens. For every file in our batch the Now that we have specified everything, we can start executing our experiment. -```python3 +```python >>> import alma.experiment >>> dispatcher = alma.experiment.load("example.experiment") @@ -62,13 +62,13 @@ Now that we have specified everything, we can start executing our experiment. The line `dispatcher.start()` starts the concurrent non blocking execution of our experiment. This means the dispatcher stays responsive and we can pause/stop the execution at any given time. -```python3 +```python >>> dispatcher.stop() ``` During the execution the `dispatcher` continuously keeps track of which files he still needs to call `run(...)` on and how many iterations he has left. He does so by saving the current state of the execution in a file. Loading an experiment (`alma.experiment.load(...)`) the framework first looks for such a save file and if one exists, the execution will pick up at the point we've called `dispatcher.stop()`. To pick up the experiment we can perform: -```python3 +```python >>> dispatcher = alma.experiment.load("example.experiment") >>> dispatcher.start() ``` diff --git a/docs/run_module.md b/docs/run_module.md index 438ebdb..5aa4488 100644 --- a/docs/run_module.md +++ b/docs/run_module.md @@ -2,7 +2,7 @@ The run module is arguably the most important part of the *alma* interface. It is here where the actual experiment/task has to be implemented. For *pyalma* the run module is merely a python file implementing a specified interface so that *pyalma* can load and execute it. Let's have a look at a short but yet extensive example. -```python3 +```python import random def run(instance, save, state):