Running the demos

Running the demos#

To run the demos, you’ll first need a source code installation of improv. Demos are located in separate subfolders of the demos folder. For instance, the minimal subfolder contains the files

../demos/minimal:
actors
minimal.yaml
minimal_spawn.yaml

../demos/minimal/actors:
sample_generator.py
sample_processor.py
sample_spawn_processor.py

The minimal.yaml and minimal_spawn.yaml files each define an improv pipeline, differing only in the method they use to launch subprocesses [1]. In the simpler case, minimal.yaml reads

actors:
  Generator:
    package: actors.sample_generator
    class: Generator

  Processor:
    package: actors.sample_processor
    class: Processor

connections:
  Generator.q_out: [Processor.q_in]

The file requests two actors, Generator and Processor. The file tells improv that Generator is defined in the Generator class of actors.sample_generator, and similarly Processor is defined in the Processor class inside the actors.sample_processor module. See Pipeline specification and Writing actors for details.

In addition, there is a single connection between the two actors: Generator.q_out (the output of Generator) should be connected to the input of Processor (Processor.q_in).

Note

In the example above (and all the demos), the relevant actors are found within the actors subfolder of the directory containing the YAML file defining the pipeline. More generally, actors can be located anywhere, and additional diretories can be specified via the --actor-path command line argument to improv run. See here for more details.

The minimal demo can easily be run from the command line as detailed in Running improv:

improv run demos/minimal/minimal.yaml


Details for running each actor can be found in the README file within each demo folder.

Warning

Many demos have additional dependencies that are not part of the typical improv installation. In these cases, additional packages may be installed by running

pip install -r requirements.txt

within the demo folder. Again, see the individual README files within each demo folder for details.