Brian Newman

08/18/2023, 1:13 AM
Howdy everyone! 👋 I'm new to using Prefect and I've chosen an Azure App Service with a Linux plan to host the worker. While I've managed to sync it with Prefect Cloud successfully, I'm facing an issue when attempting to run a task. The message I keep seeing is: "Flow run could not be submitted to infrastructure." To start the process, I've been using these CLI commands:
prefect worker start --pool 'app-service' --name 'app-prefect-azure' --with-healthcheck
Attached is the screenshot from the logs. If anyone has encountered this issue or has suggestions on how to troubleshoot it, I'd really appreciate the help! Thanks in advance! 😊

Ryan Peden

08/19/2023, 6:17 PM
That's weird. It looks like the Python runtime is somehow using an event loop policy that doesn't implement
. I don't see anything in CPython or the Prefect codebase that should cause this. The only time I remember seeing this error was on Windows using Python 3.7, which defaulted to an event loop policy that didn't support async subprocesses: That shouldn't be an issue here running Python 3.10 on Linux, so I wonder if App Service uses a customized Python runtime that's causing this problem. Another option to consider here is Azure Container Instances. You can run a worker there using Prefect's Docker image, and it'll probably cost less than using Azure App Service in 'always on' mode (which you'd need to use, otherwise Azure will shut down your worker after 20 minutes).

Brian Newman

08/21/2023, 7:27 PM
Thank you!! That is what I was thinking too! I want to try a custom image to see if that makes a difference. I will look into using ACI and Linux VMs too.