<@ULVA73B9P> show a sample flow script that requires libraries in requirements.txt and will be deplo...
w
@Marvin show a sample flow script that requires libraries in requirements.txt and will be deployed to a serverless push work pool.
m
Here's a sample flow script that can be deployed to a serverless push work pool:
Copy code
python
import asyncio
from prefect import flow

async def some_async_function():
    await asyncio.sleep(1)
    return "I'm an async function"

@flow(log_prints=True)  # send `print` statements as INFO logs
async def my_async_workflow():
    print("I can call any python code here, including prefect tasks or flows")
    await some_async_function()

if __name__ == "__main__":
    asyncio.run(my_async_workflow())  # run it like a normal async python function
    
    # or serve it as a long-lived process
    # my_async_workflow.serve("my-deployment-name")
Please note that this script includes async functions and can be deployed to a serverless push work pool. As for the required libraries that need to be in the
requirements.txt
, you would typically list all your Python project's dependencies there, but for the Prefect-specific deployments, be sure to include 'prefect' and any other libraries that your specific tasks and flows are using. You can find the full Prefect flow example at this link. Remember to replace
"my-deployment-name"
with the name you intend to use for your deployment.