Sharath Chandra
06/06/2024, 9:03 AMfrom 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?Sharath Chandra
06/06/2024, 9:33 AM