Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Supervisors

Supervisors are actors that monitor other actors (children) and restart them if they crash. This is the core of the “Let it crash” philosophy.

Child Specifications

A ChildSpec defines how a child actor should be started and managed.

from fauxtp import ChildSpec

spec = ChildSpec(
    id="my_worker",
    actor_class=MyWorker,
    args=(1, 2, 3),
    restart="permanent" # or "temporary", "transient"
)

Restart Strategies

Implementation

from fauxtp import Supervisor, RestartStrategy

class MySupervisor(Supervisor):
    strategy = RestartStrategy.ONE_FOR_ONE

    def child_specs(self):
        return [
            ChildSpec(id="worker1", actor_class=Worker),
            ChildSpec(id="worker2", actor_class=Worker),
        ]

Supervision Trees

Supervisors can supervise other supervisors, allowing you to build complex, hierarchical fault-tolerant systems.