-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Consolidates discovery of Prefect server Service
s to the base class
#16913
Conversation
self.logger = get_logger(f"server.services.{self.name.lower()}") | ||
|
||
|
||
class LoopService(Service, abc.ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note I moved the base LoopService
implementation here
2eece0a
to
0d92cca
Compare
) | ||
|
||
|
||
def _known_service_modules() -> list[ModuleType]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is that spot where we still have to explicitly expose all the service modules (I moved this from the CLI module). This essentially serves as a "registry" of the services
0d92cca
to
72599c9
Compare
CodSpeed Performance ReportMerging #16913 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤝
Following on the work in #16898 to unify Prefect's `Service` implementations, this moves the discovery routine from the CLI to the base `Service` implementation. This also includes a couple of additional niceties: - Each service is now responsible for knowing which `Setting` enables it. This eventually means that when adding a new service, we won't need to modify the `api/server.py` lifespan or the CLI. The conditional toggling of services on and off will be handled by asking the service if it should be enabled. - The way service names are handles is more uniform across all the subclasses. I also cleaned up the descriptions of all services to make them more punchy and imperative. - The table of services uses the setting name as part of how it shows whether the service is enabled, which means folks shouldn't have to hunt through the code or docs to find the setting. We do still have an explicit listing of all the known service modules, because I wasn't too keen to go down the rabbithole of automatic discovery from entrypoints or anything like that. Definitely open to ideas on a better place for that. This version doesn't unify how the `api/server.py` lifespan starts services, but that will be coming in a future update.
4503934
to
2c22c5a
Compare
In the final step of the plan to unify how services are handled ( after #16898 and #16913), we tie everything together by having both the API lifespan in `prefect server start` and the CLI `prefect server services start` use the same service running logic. At this point, when adding a new service, we should just need to add a new subclass, implement its settings class, and then make sure its module is represented in `server/services/base.py`.
Following on the work in #16898 to unify Prefect's
Service
implementations, this moves the discovery routine from the CLI to the
base
Service
implementation. This also includes a couple ofadditional niceties:
Each service is now responsible for knowing which
Setting
enablesit. This eventually means that when adding a new service, we won't
need to modify the
api/server.py
lifespan or the CLI. Theconditional toggling of services on and off will be handled by asking
the service if it should be enabled.
The way service names are handled is more uniform across all the
subclasses. I also cleaned up the descriptions of all services to
make them more punchy and imperative.
The table of services uses the setting name as part of how it shows
whether the service is enabled, which means folks shouldn't have to
hunt through the code or docs to find the setting.
We do still have an explicit listing of all the known service modules,
because I wasn't too keen to go down the rabbithole of automatic
discovery from entrypoints or anything like that. Definitely open to
ideas on a better place for that.
This version doesn't unify how the
api/server.py
lifespan startsservices, but that will be coming in a future update.
Checklist
<link to issue>
"mint.json
.