Anthony Finocchiaro

03/29/2023, 5:26 PM
Hi everyone, I am a new user to Prefect and I was able to get the setup to work locally with everything just on my computer. But now I am trying to deploy it to the cloud set up. I have my Prefect cloud workspace, but now I need to have the agent set up and the storage block for the code. I plan for the storage block to exist in Azure. I met with the DevOps cloud engineer at my company, and he was able to create a service principal for the container registry resource I plan to use. But now I need to figure out how to configure a storage block and deploy the code to it. Can anyone assist with this? I think after this I can try and run the agent even locally to run the scheduled tasks. I only need to test this for a simple example and then I think I can take it from there once I know that it works. Another big part of this is being able to deploy these with a docker image, which I am not 100% familiar on how to do.

Sahil Rangwala

03/30/2023, 4:53 PM
Hello Anthony! I would recommend checking out our storage block documentation on how to set up your specific Azure implementation. Additionally, the recipes repo is a great place to visualize examples of docker devops and additional infrastructure examples.

Anthony Finocchiaro

04/04/2023, 5:13 PM
Thanks Shahil! So I was able to get a storage block properly configured, and I was also able to successfully deploy a flow into my cloud/Azure setup with an Azure Container Instance and Azure Container Instance Credentials to go along with it. I was going to run my agent locally just to test it out, but right now I am running into this error that I am not sure how to proceed with. I can maybe make a separate thread for this. But for reference, the agent is giving me this error: KeyError: "No class found for dispatch key 'azure-container-instance-job' in registry for type 'Block'." I was wondering if it is related to this issue that @Ryan Peden made on GitHub:
As an update, I was able to get through that with installing the latest version. I see it was merged into main actually in this article (running on version 2.9.0 now).
Right now though I am seeing this error not in the agent but in the container itself that is saying ModuleNotFoundError: No module named 'prefect_azure'. Not sure if that means that my container block is not set up correctly.. I think I should have all of the needed blocks for the Azure basic setup - blob storage, Azure credentials, Azure instance job.
It's erroring when it tried to import prefect_azure in the flow run, just to clarify.
The error I'm seeing:
Ok, it looks like (at least for my current setup) I needed a separate file to put the flow code into that wasn't importing prefect_azure. Maybe there is a way to import that in the Azure Container Instance, but I was able to get around it by separating it out.