<@ULVA73B9P> I'm trying to deploy a flow in python...
# ask-marvin
m
@Marvin I'm trying to deploy a flow in python code with:
Copy code
from prefect_demo_test import run_prefect_demo_flow
from prefect.runner.storage import LocalStorage
from pathlib import Path

if __name__ == '__main__':
    # Deploy a flow
    run_prefect_demo_flow.from_source(
        source=str(Path(__file__).parent),
        entrypoint="prefect_demo_test.py:run_prefect_demo_flow"
    ).deploy(
        name='deployed-demo-image-halcon-processing-workflow',
        work_pool_name='halcon-pool'
        # tags=['halcon','demo'],
        # parameters=dict({
        #     "storage_rootpath_variable_name":"prefect_storage_filepath",
        #     "project_variable_name":"current_project_name"}),
        # description='Demo workflow processing images with halcon from a deployment',  
    )
But i get an error response what is wrong? Error: prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url 'http://127.0.0.1:4200/api/deployments/' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'concurrency_options'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body': {'name': 'deployed-demo-image-halcon-processing-workflow', 'flow_id': '6cd656ec-23ab-4310-82c4-0f3b90bbfd94', 'paused': False, 'schedules': [], 'concurrency_limit': None, 'concurrency_options': None, 'enforce_parameter_schema': True, 'parameter_openapi_schema': {'title': 'Parameters', 'type': 'object', 'properties': {'storage_rootpath_variable_name': {'position': 0, 'title': 'storage_rootpath_variable_name', 'type': 'string'}, 'project_variable_name': {'position': 1, 'title': 'project_variable_name', 'type': 'string'}}, 'required': ['storage_rootpath_variable_name', 'project_variable_name']}, 'parameters': {}, 'tags': [], 'pull_steps': [{'prefect.deployments.steps.set_working_directory': {'directory': 'C:\\repos\\ai-data-pipeline'}}], 'work_queue_name': None, 'work_pool_name': 'halcon-pool', 'storage_document_id': None, 'infrastructure_document_id': None, 'description': 'Runs the prefect ai data pipeline flow\n- Gets variables to laod a metadat file\n- Read metadata file and process images\n- Update metadata and write updates to storage', 'path': None, 'version': 'c9393244be33c404894a5c4581a89651', 'entrypoint': 'prefect_demo_test.py:run_prefect_demo_flow', 'job_variables': {}}}
m
Your message was too long by 308 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
I'm trying to deploy a flow in python code with:
Copy code
from prefect_demo_test import run_prefect_demo_flow
from prefect.runner.storage import LocalStorage
from pathlib import Path

if __name__ == '__main__':
    # Deploy a flow
    run_prefect_demo_flow.from_source(
        source=str(Path(__file__).parent),
        entrypoint="prefect_demo_test.py:run_prefect_demo_flow"
    ).deploy(
        name='deployed-demo-image-halcon-processing-workflow',
        work_pool_name='halcon-pool'
        # tags=['halcon','demo'],
        # parameters=dict({
        #     "storage_rootpath_variable_name":"prefect_storage_filepath",
        #     "project_variable_name":"current_project_name"}),
        # description='Demo workflow processing images with halcon from a deployment',  
    )
But i get an error response what is wrong? Error: prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url 'http://127.0.0.1:4200/api/deployments/' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'concurrency_options'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body': {'name': 'deployed-demo-image-halcon-processing-workflow', 'flow_id': '6
m
@Marvin How can i shorten it? I do not generate the request?
m
Could you please clarify your question a bit more? Are you asking about shortening the execution time of a Prefect task? Or are you referring to something else, like shortening a flow or process? Let me know so I can assist you better! Also, could you specify which version of Prefect you are using? If you're unsure, I can help you figure it out.
m
@Marvin I'm trying to deploy a flow in python code with:
Copy code
run_prefect_demo_flow.from_source(
        source=str(Path(__file__).parent),
        entrypoint="prefect_demo_test.py:run_prefect_demo_flow"
    ).deploy(
        name='deployed-demo-image-halcon-processing-workflow',
        work_pool_name='halcon-pool'    
    )
But i get an error response what is wrong? Error: prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url 'http://127.0.0.1:4200/api/deployments/' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'concurrency_options'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body': {'name': 'deployed-demo-image-halcon-processing-workflow', 'flow_id': '6cd656ec-23ab-4310-82c4-0f3b90bbfd94', 'paused': False, 'schedules': [], 'concurrency_limit': None, 'concurrency_options': None, 'enforce_parameter_schema': True, 'parameter_openapi_schema': {'title': 'Parameters', 'type': 'object', 'properties': {'storage_rootpath_variable_name': {'position': 0, 'title': 'storage_rootpath_variable_name', 'type': 'string'}, 'project_variable_name': {'position': 1, 'title': 'project_variable_name', 'type': 'string'}}, 'required': ['storage_rootpath_variable_name', 'project_variable_name']}, 'parameters': {}, 'tags': [], 'pull_steps': [{'prefect.deployments.steps.set_working_directory': {'directory': 'C:\\repos\\ai-data-pipeline'}}], 'work_queue_name': None, 'work_pool_name': 'halcon-pool', 'storage_document_id': None, 'infrastructure_document_id': None, 'description': 'Runs the prefect ai data pipeline flow\n- Gets variables to laod a metadat file\n- Read metadata file and process images\n- Update metadata and write updates to storage', 'path': None, 'version': 'c9393244be33c404894a5c4581a89651', 'entrypoint': 'prefect_demo_test.py:run_prefect_demo_flow', 'job_variables': {}}}
m
Your message was too long by 214 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
I'm trying to deploy a flow in python code with:
Copy code
run_prefect_demo_flow.from_source(
        source=str(Path(__file__).parent),
        entrypoint="prefect_demo_test.py:run_prefect_demo_flow"
    ).deploy(
        name='deployed-demo-image-halcon-processing-workflow',
        work_pool_name='halcon-pool'    
    )
But i get an error response what is wrong? Error: prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url 'http://127.0.0.1:4200/api/deployments/' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'concurrency_options'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body': {'name': 'deployed-demo-image-halcon-processing-workflow', 'flow_id': '6cd656ec-23ab-4310-82c4-0f3b90bbfd94', 'paused': False, 'schedules': [], 'concurrency_limit': None, 'concurrency_options': None, 'enforce_parameter_schema': True, 'parameter_openapi_schema': {'title': 'Parameters', 'type': 'object', 'properties': {'storage_rootpath_variable_name': {'position': 0, 'title': 'storage
m
@Marvin I'm trying to deploy a flow in python code with:
Copy code
run_prefect_demo_flow.from_source(
        source=str(Path(__file__).parent),
        entrypoint="prefect_demo_test.py:run_prefect_demo_flow"
    ).deploy(
        name='deployed-demo-image-halcon-processing-workflow',
        work_pool_name='halcon-pool'    
    )
But i get an error response what is wrong? Error: prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url 'http://127.0.0.1:4200/api/deployments/' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'concurrency_options'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body':
m
It looks like you're encountering an error related to deploying a flow using Prefect. The error message "Client error '422 Unprocessable Entity'" often indicates that there is an issue with the request being sent to the server. Specifically, the error message mentions "Extra inputs are not permitted" related to
concurrency_options
. To help you resolve this, I will need to check the documentation and potential issues related to deployment in the version of Prefect you are using. Could you please confirm which version of Prefect you are using, or let me know if you need assistance finding that out? If you're not sure, I can run some checks to identify the version you have.
m
@Marvin Using version 3
m
The error message you are encountering indicates that there are extra inputs (
concurrency_options
) not permitted by the server. This is a known issue that can occur when there are mismatches between client and server versions, or if unexpected parameters are provided. Here are a few steps you can take to resolve the issue: 1. Version Compatibility: Ensure that the client and server versions of Prefect are compatible. Prefect recommends that all clients should be the same version as the server or older. You can find more details about version compatibility here: Prefect Compatibility. 2. Examine Concurrency Options: The error suggests the presence of
concurrency_options
which might not be necessary or supported. Review your code to make sure you are not including any unsupported concurrency settings. 3. Check for Known Issues and Updates: Review the GitHub issues and see if there's a bug related to your problem. Here's a relevant issue that describes a similar error scenario: Issue #15650. 4. Use Prefect CLI for Additional Debugging: You can use the Prefect CLI to list, create, delete, or inspect concurrency limits, as per the documentation: Global Concurrency Limits. Make sure to adjust the deployment code according to these insights and try deploying again. If the problem persists, it might be helpful to see if updating Prefect to the latest version resolves the issue.