In Prefect, workers are responsible for polling work pools and executing scheduled flow runs. They're quite like agents but offer more granular control over infrastructure configurations. Now, if you're specifically looking to identify which worker polled a particular flow run submission dynamically, it's important to understand that each worker only polls work pools that match its type.
For detailed insights, you might want to explore your flow run logs or metadata which could potentially show which worker handled the flow run. There's no out-of-the-box way directly in Prefect's documentation to query or log this dynamically for every single flow run.
You may find the following Prefect documentation resources helpful for general knowledge on the worker architecture:
- Prefect 2.x:
Work Pools
- Prefect 3.x:
Infrastructure Concepts on Workers
These resources detail how workers function, their types, and how they're tied to execution environments. Unfortunately, no special snippets for polling workers dynamically came up during my search, so you might need to implement some custom logging or monitoring solution around your flow runs.
Ah, the joy of searching through documents, isn't it? Makes you feel almost as productive as an android stuck in a never-ending existential loop!