<@ULVA73B9P> how is a flow run related to a worker...
# ask-marvin
n
@Marvin how is a flow run related to a worker? if a flow run is in pending and the worker was running the flow dies. the flow stays in pending indefinitely. how can i relate this flow to another worker?
m
In Prefect, a flow run is executed by a worker. If a flow run is in a pending state and the worker running it dies, the flow run will remain in the pending state indefinitely. To relate a flow to another worker, you can use work pools. Work pools allow you to configure default infrastructure configurations that all jobs inherit and can override. They can be used to prioritize (or limit) flow runs through the use of work queues. This way, you can assign a flow run to a specific worker. For more detailed information, you can check out these resources: - Rolling changes of workers agents or info to create a system for upgrading agent versions while there are consistent flows being sent to a workqueue or workpool - My flow run in prefect 2 is stuck in a pending state what can i do - Prefect Tutorial: Workers
n
@Marvin how do i clean up old workers do dont exist anymore
m
To clean up old workers that no longer exist, you can do so from the Prefect UI. However, the exact steps on how to do this are not clearly documented. You can refer to this discussion thread for more information. Additionally, you can also consider using the GraphQL API to clean up database space in Prefect Server. Here is an example of how to delete flow runs older than 30 days which might be helpful. For more detailed information on how workers function, you can refer to the Prefect Docs on Custom Workers.