-
Notifications
You must be signed in to change notification settings - Fork 548
Customizable Deployment server settings #4064
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
base: develop
Are you sure you want to change the base?
Conversation
dd63272
to
55719bb
Compare
45049ac
to
65c4de8
Compare
src/zenml/utils/source_utils.py
Outdated
self._source = resolve(self._object) | ||
return self._source | ||
|
||
def to_source_string(self) -> str: |
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.
Any reason you're serializing this to a string? The Source
object actually contains more information and is used in all other places where we serialize sources
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.
I don't think I understand this question. I need to serialize this to a JSON-able data type (dict, string, list, etc.). This is only used in serialization, so I can't return a Source
object here instead. It needs to be something that json.dump(...)
can work with.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
ZenML CLI Performance Comparison (Threshold: 1.0s, Timeout: 60s, Slow: 5s)❌ Failed Commands on Current Branch (feature/customizable-deployment-servers)
🚨 New Failures IntroducedThe following commands fail on your branch but worked on the target branch:
Performance Comparison
Summary
Environment Info
|
Documentation Link Check Results❌ Absolute links check failed |
Framework-Agnostic Deployment App Factory
Overview
This PR implements a framework-agnostic deployment ASGI app factory system that allows customizing all aspects of the ASGI web application that powers up the pipeline deployments:
If necessary, the core components of the deployment server - the app factory (aka app runner) and the deployment service classes can be extended and custom implementations can be used instead of the built-in ones via configuration options.
Key Components Implemented
zenml.utils.source_utils.SourceOrObject
A hybrid type that can hold either a source string OR a loaded object:
load()
methodzenml.config.deployment_config.DeploymentSettings
Similar to
DockerSettings
, can be used to customize the configuration and behavior of the ASGI application that is run by the pipeline deployment server:SourceOrObject
to encode the location of classes and functions used as valueszenml.deployers.server.app.BaseDeploymentAppRunner
This is the abstract factory used to build and run the pipeline deployment ASGI application according to the specifications in the
DeploymentSettings
. This ASGI application is just a wrapper around the core service that implements the pipeline deployment operations (see next point). The responsibilities of this component are:DeploymentSettings
.The only built-in implementation provided for this class is the one for FastAPI:
zenml.deployers.server.fastapi.app.FastAPIDeploymentAppRunner
.Users can implement this abstract class to support any other ASGI capable framework.
zenml.deployers.server.service.BasePipelineDeploymentService
This is the base class for the service that runs the core pipeline deployment logic. The responsibilities of this component are:
The only built-in implementation provided for this class is the one that uses the local orchestrator to run pipelines:
zenml.deployers.server.service.PipelineDeploymentService
.Users can implement this abstract class to provide their own custom implementations of running one or more pipelines.
Examples
1. Basic Configuration Examples
Configure URL Paths
Configure CORS
Configure Security Headers
2. Custom Endpoints
Framework-Agnostic: Simple Endpoint Function
Framework-Agnostic: Endpoint Builder Function
FastAPI-Specific: Native FastAPI Router
3. Custom Middleware
Framework-Agnostic: Simple Middleware Function
FastAPI-Specific: Native FastAPI Middleware
4. App Extensions
Simple Extension Function
Pre-requisites
Please ensure you have done the following:
develop
and the open PR is targetingdevelop
. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes