Hi everyone, When I try build deployment I get thi...
# prefect-community
Hi everyone, When I try build deployment I get this error:
RuntimeError: A 'sync_compatible' method was called from a context that was previously async but is now sync. The sync call must be changed to run in a worker thread to support sending the coroutine for 'build_from_flow' to the main thread.
I followed this guide: https://docs.prefect.io/tutorials/deployments/#build-a-deployment-definition Any idea what went wrong? Using prefect 2.3.1 And deployment in scripts looks like this:
Copy code
deployment = Deployment.build_from_flow(

Hi Yusuf! Could you perhaps try using the prefect deployment CLI? way easier, that way you don't have to worry about sync/async - this guide provides many resources to get started https://discourse.prefect.io/t/prefect-deployments-faq/1467
If you want to use the Python Deployment file way @yusuf yel, you’re very close. Just pass your interval schedule object to the
paramater. The work queue name gets passed to
You can see a guide I wrote here: https://medium.com/the-prefect-blog/deploy-prefect-pipelines-with-python-perfect-68c944a3a89f
👀 1
@Jeff Hale Jeff thanks for answering. I can start agent now. But there is another issue which is same issue when I try deployment cli. When I start prefect agent all tasks and flow runs without any error but mlflow artifacts doesn't saves relative path artifacts. I don't think issue was mlflow because I have task which cleans previous mlflow artifacts. That tasks doesn't excute either. Here is my flow and path task.: Edit: I can run my script as regular python file and mlflow artifacts saves like expected.
@Anna Geller Thanks for pointing deployment cli. apparently I got all wrong. I was trying deployment in python file and deployment cli. I understand now I got two option for deployment. Thanks.
👍 1
Ahh that's indeed a bit confusing, maybe we can make it clearer in the docs, great that you figured it out!
🙌 2