根据 Prefect 的混合执行模型,代理“监视任何计划的流程运行并在您的基础设施上相应地执行它们”,而执行者“负责实际运行的任务 [...] 用户可以submit运行并执行任务”。wait for their results."
虽然从高层设计的角度来看这有一定道理,但实际上这些部分是如何组成的呢?例如,如果我指定 Flow Run 应使用 Docker Agent 和 Dask Executor,那么 Agent 和 Executor 之间具体发生了哪些交互?如果我使用 Docker Agent 和本地执行器会怎样?或者本地代理和 Dask 执行器?
\n简而言之,每个组件\xe2\x80\x94(即服务器、代理和执行器上)的流程的每个步骤到底发生了什么?
\nMic*_*ael 15
代理代表流可以并且应该在其上执行的本地基础设施,如该流的 所指定RunConfig。如果流程只能在 Docker(或 Kubernetes、ECS 或其他任何东西)上运行,则流程运行仅由该代理提供服务。代理可以服务多个流,只要这些流都受到该特定基础设施的支持。如果流程运行不依赖于任何特定的基础设施,那么 aUniversalRun是合适的,并且可以由任何代理处理。最重要的是,代理通过向服务器提交运行 Flow 的请求以及正在进行的 Flow 的更新,保证Prefect Server 永远不会看到与 Flow 相关的代码和数据。
Executors, on the other hand, are responsible for the actual computation: that is, actually running the individual Tasks that make up a Flow. The Agent manages execution at a high level by calling submit on Tasks in the appropriate order, and by handling the results that the Executor returns. Because of this, an Executor has no knowledge of the Flow as a whole, rather only the Tasks that it received from the Agent. All Tasks in a single Flow are required to use the same Executor, but an Agent may communicate with different Executors between separate flows. Similarly, Executors can serve multiple Flow Runs, but at the Task level only.
In specific terms:
简而言之,代理位于服务器和执行器之间,充当流程运行生命周期的保管人,并划分其他每个组件的关注点。