prefect.server.services.foreman

Foreman is a loop service designed to monitor workers.

Classes

Foreman

Monitors the status of workers and their associated work pools Methods:

run_once

run_once(self, db: PrefectDBInterface) -> None
Iterate over workers current marked as online. Mark workers as offline if they have an old last_heartbeat_time. Marks work pools as not ready if they do not have any online workers and are currently marked as ready. Mark deployments as not ready if they have a last_polled time that is older than the configured deployment last polled timeout.

run_once

run_once(self) -> None
Represents one loop of the service. Subclasses must override this method. To actually run the service once, call LoopService().start(loops=1) instead of LoopService().run_once(), because this method will not invoke setup and teardown methods properly.

service_settings

service_settings(cls) -> ServicesBaseSetting

start

start(self, loops: None = None) -> NoReturn
Run the service indefinitely.

stop

stop(self, block: bool = True) -> None
Gracefully stops a running LoopService and optionally blocks until the service stops. Args:
  • block: if True, blocks until the service is finished running. Otherwise it requests a stop and returns but the service may still be running a final loop.