Embodiment Spawner Design

From OpenCog

Spawner is the program used to start up the Embodiment system. It is a daemon which should basically perform two tasks:

  • Spawn specific basic EmbodimentCogServers at start up. Currently, these are the router and the learning server.
  • Listen to a specific port and spawn/despawn pets (OACs) upon request.

Spawner is also an EmbodimentCogServer so that it receives and processes Embodiment messages. For now, it only handles 2 messages in its processNextMessage method: LOAD_PET and UNLOAD_PET. When it receives the former message, it starts an OAC process passing the proper parameters that are within this message. The latter message is used to gracefully shutdown an OAC.

Spawner is also responsible for managing the available communication ports (according to a range of port numbers in the configuration file) and assign them to each spawned OAC dynamically.

The Spawner should also monitor all Embodiment servers to keep track of who is alive and kicking (answering management requests properly). It may also re-spawn crashed elements automatically, but the exact algorithm still needs to be written. This kind of check is supposed to be performed periodically so that the daemon will probably be sleeping most of the time.