Hey <@ULVA73B9P>, for this sample of code in prefe...
# ask-marvin
v
Hey @Marvin, for this sample of code in prefect 3.1: # Create the access to the s3 storage bucket folder containing the code code_from_bucket = s3.S3Bucket(bucket_name=bucket_name, credentials=aws_credentials_block, bucket_folder=folder_name) # Save the S3Bucket block await code_from_bucket.save(name="my-s3-bucket-block", overwrite=True, client=prefect_client) # 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.dev4-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) This error: prefect.exceptions.PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'http://prefect:4200/api/deployments/' Response: {'detail': "Invalid schema: 'true' is not of type 'object', 'boolean'"}
m
Your message was too long by 7 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
Hey , for this sample of code in prefect 3.1:
# Create the access to the s3 storage bucket folder containing the code code_from_bucket = s3.S3Bucket(bucket_name=bucket_name, credentials=aws_credentials_block, bucket_folder=folder_name) # Save the S3Bucket block await code_from_bucket.save(name="my-s3-bucket-block", overwrite=True, client=prefect_client) # 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.dev4-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) This error: prefect.exceptions.PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'http://prefect:4200/api/deployments/' Response: {'detail': "Invalid schema: 'true' is not of type
v
Hey @Marvin, for this sample of code in prefect 3.1: # Create the access to the s3 storage bucket folder containing the code code_from_bucket = s3.S3Bucket(bucket_name=bucket_name, credentials=aws_credentials_block, bucket_folder=folder_name) await code_from_bucket.save(name="my-s3-bucket-block", overwrite=True, client=prefect_client) result_flow: Flow = await ml_pipeline.from_source( source=code_from_bucket, entrypoint=f"{os.path.basename(file)}:ml_pipeline" ) deploy_id = await result_flow.deploy(name="my-deployment", work_pool_name="work-pool-docker", image="prefecthq/prefect:3.1.1.dev4-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) This error: prefect.exceptions.PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'http://prefect:4200/api/deployments/' Response: {'detail': "Invalid schema: 'true' is not of type 'object', 'boolean'"}
m
Hey , for this sample of code in prefect 3.1: # Create the access to the s3 storage bucket folder containing the code code_from_bucket = s3.S3Bucket(bucket_name=bucket_name, credentials=aws_credentials_block, bucket_folder=folder_name) await code_from_bucket.save(name="my-s3-bucket-block", overwrite=True, client=prefect_client) result_flow: Flow = await ml_pipeline.from_source( source=code_from_bucket, entrypoint=f"{os.path.basename(file)}:ml_pipeline" ) deploy_id = await result_flow.deploy(name="my-deployment", work_pool_name="work-pool-docker", image="prefecthq/prefect:3.1.1.dev4-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) This error: prefect.exceptions.PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'http://prefect:4200/api/deployments/' Response: {'detail': "Invalid schema: 'true' is not of type 'object', 'boolean'"} Ah, the woes of the
422 Unprocessable Entity
error in Prefect 3.x. It seems like the Prefect server is having a bit of an identity crisis, not knowing exactly how to handle certain fields it received in the request. I'm not a doctor, but I suggest we perform a diagnosis on the following: 1. Check Deployment Configuration: One common issue in Prefect 3.x is sending unexpected fields in the deployment configuration. As per the error message you provided (
'true' is not of type 'object', 'boolean'
), it looks like some value expected to be a boolean or object might have been improperly set. Double-check the
deploy
method's configuration to ensure no extra or wrongly-typed fields are included. 2. Investigate Known Issues: On the Prefect GitHub Issues, there have been similar issues reported, such as this one and this issue. These cases often involve slight misconfigurations, where certain fields were not supposed to be part of the request to the Prefect server. 3. Deploy Method Setup: Ensure that the method
await result_flow.deploy()
does not include deprecated or wrongly configured fields. The error may be arising from compatibility issues or the fields not aligning with the expected schema. You might have to skim through your code where the deployment configuration is set and compare it with the documented Prefect 3.x deployment setup. Stability in Prefect versions can sometimes be as unpredictable as Marvin's mood swings, so tread carefully. Feel free to loop back if things still don't work. Remember, even when the stars (or Prefect deployments) don't align, you've got a whole galaxy of solutions to explore!