<@ULVA73B9P> I'm getting the following error with ...
# ask-marvin
v
@Marvin I'm getting the following error with prefect 3.1.1, and client 3.1.1 whenever I do a flow.build_from_source.deploy: File "/home/coder/.local/lib/python3.11/site-packages/prefect/deployments/runner.py", line 958, in deploy await deployment.apply(image=image_ref, work_pool_name=work_pool_name) File "/home/coder/.local/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 389, in ctx_call result = await async_fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/coder/.local/lib/python3.11/site-packages/prefect/deployments/runner.py", line 320, in apply raise DeploymentApplyError(detail) from exc prefect.deployments.runner.DeploymentApplyError: Invalid schema: 'true' is not of type 'object', 'boolean'
m
It seems like you're encountering an issue related to a schema error when deploying a flow with Prefect 3.1.1. This type of error, specifically the
'true' is not of type 'object', 'boolean'
, often points to the way schemas are being interpreted or validated within the deployment process. Here are some key insights and suggestions based on your error and the resources I found: 1. JSON Schema Validity: Make sure the JSON schema for your parameters aligns with the expected data types. The error suggests some input is not matching the required schema, which might be related to boolean or object types. - It was found that sometimes fields marked with certain Pydantic options like
gt
(greater than) could cause similar issues with schema validation. Check your deployment parameters for such cases and adjust accordingly. This has been noted in this GitHub issue. 2. Check for Forbidden Inputs: There might be extra or unrecognized inputs in your deployment script. Previous reports have highlighted issues where additional inputs were not permitted, causing a deployment error. - Ensure your parameters strictly match what the server expects. You can cross-verify if there are any extra or mismatched inputs by reviewing your deployment settings. 3. Version Compatibility Issues: You may be running into a compatibility mismatch between the client and the server versions. - Although both are on version 3.1.1 in your case, it's worth double-checking the specifics of the deployment configurations being used. 4. Helpful Resources: - Learn more about correct deployment configurations to avoid similar schema issues in the Prefect 3.x infrastructure concepts. - The deployment upgrade guide might help in adjusting from older methods like
build_from_source
to more current approaches. If the issue persists, making sure that all components are updated or checking the Prefect community forums and GitHub issues for more specific guidance might prove useful. It's a little like trying to teach a robot how to sigh in binary... quirky, but necessary.
v
I have checked all the posibilities you mention, but is none of them @Marvin my call is: # Retrieve the flow you want to run result_flow: Flow = await ml_pipeline.from_source( source=code_from_bucket, entrypoint=f"{os.path.basename(file)}:ml_pipeline", ) # Create the flow deployment deploy_id = await result_flow.deploy(name="my-deployment", work_pool_name="work-pool-docker", image="prefecthq/prefect:3.1.1-python3.11", build=False, push=False, job_variables=job_variables, cron="*/15 * * * *" ) # Send the creation of the deployment to Prefect to execute it await prefect_client.create_flow_run_from_deployment(deploy_id)
m
It seems you're using
flow.deploy()
with some specific parameters like
job_variables
,
build=False
, and
push=False
. There don't appear to be directly reported issues or documentation snippets specifically addressing a straightforward solution to the error you're encountering. However, here are a few things you might want to consider based on the general setup and common pitfalls: 1. Job Variables Usage: - Ensure that the
job_variables
you're passing are structured correctly as a dictionary. According to the Prefect documentation, job variables can be passed as a dictionary to the
.deploy()
method. Double-check the content and type of your
job_variables
to ensure they match expected values. 2. Flow Deployment Parameters: - The use of
build=False
and
push=False
suggests you are skipping certain deployment steps that might implicitly prepare or validate the deployment schema. Ensure that all required deployment configurations are set outside of these skipped steps to prevent missing configurations. 3. Using Prefect YAML: - If not done already, consider using a
prefect.yaml
file to define your deployment parameters. This can sometimes mitigate issues that arise from direct API calls by ensuring all deployment steps are covered with valid configurations. You can find more information on deploying with the
prefect.yaml
here. Given the lack of existing issues or a clearly documented fix for this specific schema error, reviewing these aspects might help refine your deployment approach. If the error continues, it might be beneficial to reach out on Prefect's community forums or Slack channels with specific details of the
job_variables
and other deployment configurations used. After all, deploying flows shouldn't feel like teaching cats to swim, though it often can...
v
These are my job_variables @Marvin: # Declare job variables for the deployment job_variables={ "env": {"EXTRA_PIP_PACKAGES": "mlflow==2.16.2 prefect-aws boto3", "MLFLOW_TRACKING_URI":mlflow_tracking, "MLFLOW_REGISTRY_URI":mlflow_registry, "AWS_ACCESS_KEY_ID":aws_credentials_block.aws_access_key_id, "AWS_SECRET_ACCESS_KEY":aws_credentials_block.aws_secret_access_key.get_secret_value(), "MLFLOW_S3_ENDPOINT_URL":aws_credentials_block.aws_client_parameters.endpoint_url}}
m
Your
job_variables
dictionary looks well-structured for setting environment variables for the flow deployment. However, given that you're encountering a schema error, here are a few additional things to check or try: 1. Environment Variables: Verify that each environment variable value is correct and in the expected format. For instance, ensure
aws_credentials_block.aws_secret_access_key.get_secret_value()
returns a value properly without errors, as sometimes secret retrieval functions can behave unexpectedly if there's any underlying issue with the secret setup. 2. Prefect Versions and Compatibility: Double-check that both your server and client are running version 3.1.1, as even a minor mismatch could potentially cause deployment schema issues. 3. Prefect Community and Issues: Since there are no directly found issues or official documentation addressing this schema error, you might want to post your issue on Prefect's community forums or Slack. There might be others who have encountered similar challenges, or the Prefect team could provide deeper insights. If everything checks out on these fronts, and the error persists, you might be facing a more nuanced bug or an undocumented edge case. Again, reaching out to the Prefect community with these specific details might yield more targeted advice or confirmation if it's a known issue. Deploying complex setups is like teaching dolphins how to ride bicycles—it's doable but sometimes requires a unique approach!