Hi,
I am trying to setup self hosted prefect server on AKS and use k8s workpools on AKS to run the flows.
So far I have installed the following components on AKS
- prefect-server
- prefect worker
I haven't created a public url for the prefect server yet and using the port forwarding method to view the web ui.
I can browse thru the web ui at
http://localhost:4200/ and see the k8s workpool as well.
The next step is to have the deployment and flow registered on the server. I am trying to register the deployment using code
from prefect import flow, get_run_logger,serve
from cuebox.pipeline.tasks.task1 import cowsay_hello, log_current_path
@flow
def hello(name: str = "Marvin"):
get_run_logger().info(f"Hello {name}!")
cowsay_hello(name)
log_current_path()
# This is here so that we can invoke the script directly for testing
if __name__ == "__main__":
deploy = hello.to_deployment(name="hello-prefect-2", work_pool_name="dummy-pool")
serve(deploy)
I have updated the prefect config with the following:
prefect config set PREFECT_API_URL=<http://localhost:4200/api>
This isn't working and I see an error
File "/Users/sharath/Library/Caches/pypoetry/virtualenvs/hello-prefect-2-eDijfXV1-py3.11/lib/python3.11/site-packages/prefect/flows.py", line 1768, in serve
await runner.add_deployment(deployment)
File "/Users/sharath/Library/Caches/pypoetry/virtualenvs/hello-prefect-2-eDijfXV1-py3.11/lib/python3.11/site-packages/prefect/runner/runner.py", line 201, in add_deployment
deployment_id = await deployment.apply()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sharath/Library/Caches/pypoetry/virtualenvs/hello-prefect-2-eDijfXV1-py3.11/lib/python3.11/site-packages/prefect/deployments/runner.py", line 324, in apply
raise DeploymentApplyError(
prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url '<http://localhost:4200/api/deployments/>'
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'infra_overrides'], 'msg': 'Extra inputs are not permitted', 'input': {}}], 'request_body': {'infra_overrides': {}, 'name': 'hello-prefect-2', 'flow_id': 'c722711e-39ff-47b6-9ce2-b91c0d200132', 'paused': False, 'schedules': [], 'enforce_parameter_schema': False, 'parameter_openapi_schema': {'title': 'Parameters', 'type': 'object', 'properties': {'name': {'default': 'Marvin', 'position': 0, 'title': 'name', 'type': 'string'}}}, 'parameters': {}, 'tags': [], 'pull_steps': [], 'manifest_path': None, 'work_queue_name': None, 'work_pool_name': 'dummy-pool', 'storage_document_id': None, 'infrastructure_document_id': None, 'schedule': None, 'description': None, 'path': '.', 'version': 'e7e9c463adcb09d8153871ec26ed091e', 'entrypoint': 'cuebox/pipeline/flows/hello.py:hello'}}
For more information check: <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422>
I error states
422 Unprocessable Entity
How can I register the deployment & flow on the prefect server from my local?