Search code examples
pythoncircusd

Circus: run a process once?


I'm using circus to manage a number of loosely coupled processes; a main process that needs to run once, and then a number of secondary processes that start a few moments later. The secondary processes need to be restarted until the work is complete, but the primary process must only be executed once. It would seem that once the process finishes, despite various settings, it's re-run. I've tried setting max_retry to:

  • -1, which has no effect and continuously re-runs the process
  • 0, which doesn't run the process at all
  • 1, which also has no effect and continuously re-runs the process

Is there any way I can safely and successfully end the main process after it's first run?


Solution

  • Found it: it's not in the config section of the docs, but you can set respawn to False in the config and if/when the process dies it won't be restarted. Found in the method signature of the circus.watcher.Watcher documentation under Circus Library.