Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brings back EventPersister in discovery of background services #17240

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/prefect/server/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
def _known_service_modules() -> list[ModuleType]:
"""Get list of Prefect server modules containing Service subclasses"""
from prefect.server.events import stream
from prefect.server.events.services import actions, triggers
from prefect.server.events.services import (
actions,
event_logger,
event_persister,
triggers,
)
from prefect.server.services import (
cancellation_cleanup,
flow_run_notifications,
Expand All @@ -42,6 +47,7 @@ def _known_service_modules() -> list[ModuleType]:
)

return [
# Orchestration services
cancellation_cleanup,
flow_run_notifications,
foreman,
Expand All @@ -50,6 +56,9 @@ def _known_service_modules() -> list[ModuleType]:
scheduler,
task_run_recorder,
telemetry,
# Events services
event_logger,
event_persister,
triggers,
actions,
stream,
Expand Down
54 changes: 54 additions & 0 deletions tests/server/services/test_service_subsets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from prefect.server.events.services.actions import Actions
from prefect.server.events.services.event_logger import EventLogger
from prefect.server.events.services.event_persister import EventPersister
from prefect.server.events.services.triggers import ProactiveTriggers, ReactiveTriggers
from prefect.server.events.stream import Distributor
from prefect.server.services.base import RunInAllServers, Service
from prefect.server.services.cancellation_cleanup import CancellationCleanup
from prefect.server.services.flow_run_notifications import FlowRunNotifications
from prefect.server.services.foreman import Foreman
from prefect.server.services.late_runs import MarkLateRuns
from prefect.server.services.pause_expirations import FailExpiredPauses
from prefect.server.services.scheduler import RecentDeploymentsScheduler, Scheduler
from prefect.server.services.task_run_recorder import TaskRunRecorder
from prefect.server.services.telemetry import Telemetry


def test_the_all_service_subset():
"""The following services should be enabled on background servers or full-featured
API servers"""
assert set(Service.all_services()) == {
Telemetry,
# Orchestration services
CancellationCleanup,
FailExpiredPauses,
FlowRunNotifications,
Foreman,
MarkLateRuns,
RecentDeploymentsScheduler,
Scheduler,
TaskRunRecorder,
# Events services
Actions,
Distributor,
EventLogger,
EventPersister,
ProactiveTriggers,
ReactiveTriggers,
}


def test_run_in_all_servers():
"""The following services should be enabled on background servers and web-only
API servers"""
assert set(RunInAllServers.all_services()) == {
# Orchestration services
TaskRunRecorder,
# Events services
Actions,
Distributor,
EventLogger,
EventPersister,
ProactiveTriggers,
ReactiveTriggers,
}