<@ULVA73B9P> Traceback (most recent call last): F...
# ask-marvin
r
@Marvin Traceback (most recent call last): File “/home/afokin52/arepas_prefect/pipeline-prefect/flows/parser_reddit.py”, line 159, in <module> parse_reddit.deploy( File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/utilities/asyncutils.py”, line 304, in coroutine_wrapper return call() File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py”, line 432, in call return self.result() File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py”, line 318, in result return self.future.result(timeout=timeout) File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py”, line 179, in result return self.__get_result() File “/usr/lib/python3.10/concurrent/futures/_base.py”, line 403, in __get_result raise self._exception File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py”, line 389, in _run_async result = await coro File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/flows.py”, line 1084, in deploy deployment_ids = await deploy( File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/deployments/runner.py”, line 1013, in deploy await deployment.apply(image=image_ref, work_pool_name=work_pool_name) File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/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://prefect.az
m
Your message was too long by 329 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
Traceback (most recent call last):
File “/home/afokin52/arepas_prefect/pipeline-prefect/flows/parser_reddit.py”, line 159, in <module> parse_reddit.deploy( File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/utilities/asyncutils.py”, line 304, in coroutine_wrapper return call() File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py”, line 432, in call return self.result() File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py”, line 318, in result return self.future.result(timeout=timeout) File “/home/afokin52/.cache/pypoetry/virtualenvs/flows-oLOQFfZS-py3.10/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py”, line 179, in result return self.__
r
@Marvin raise DeploymentApplyError( prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error ‘422 Unprocessable Entity’
m
Ah, the joyous feeling of encountering a
422 Unprocessable Entity
error. It seems you're dealing with an issue during deployment in Prefect. Possible Cause: One common cause identified from this GitHub issue is using pydantic
Field
members with the
gt
(greater than) option which results in an invalid JSON schema. Here's an example of problematic code:
Copy code
python
from prefect import flow
from pydantic import BaseModel, Field

class Config(BaseModel):
    sample_rate: int = Field(
        default=100,
        gt=0,  # Problematic field
        lte=100,
    )

@flow
def dummy_flow(config: Config):
    pass

dummy_flow.to_deployment("mre", enforce_parameter_schema=True).apply()
This raises the
DeploymentApplyError
because of the invalid JSON schema. Solution: You can adjust the
gt
parameter or replace problematic field definitions: - Change
gt=0
to
gte=-1
, - Avoid using
gt
directly in fields that are part of your deployment schema. Example adjustment:
Copy code
python
class Config(BaseModel):
    sample_rate: int = Field(
        default=100,
        gte=1,  # Adjustment replacing gt=0
        lte=100,
    )
If you adjust the field definitions as above and redeploy, it should resolve the issue. For more detailed steps and examples, check out the Prefect Deployment Guide. If the issue persists, feel free to provide more details, and we'll be happy to assist. As always, try not to get too cheerful about it. Links for reference: 1. GitHub Issue 13560 2. Prefect Deployment Documentation Good luck.