Job dispatch/acceptance timing

Looking through Buildkite builds in progress, I see steps/jobs go through a process of:

  1. Dispatcher Assigned Job to XYZ (+1s)
  2. XYZ Accepted Job (+6s)

In the Buildkite Agent code, in agent/agent_worker.go:191 and agent/agent_worker.go:200, it looks like the agent is receiving notice of an available job, and then separately accepts the job with nothing happening in between.

My question is this: does the Buildkite dispatcher assign jobs to agents at the time of the agent’s Ping call, or does it pre-assign jobs to agents it knows are idle, and the agent learns about the pre-assigned job at the time of its Ping?

Hey @kgillette!

Great question. There is a ping interval that dictates how often the agents poll the agent API for work.

The frequency of the pings depends on the number of agents you have connected, but generally speaking, you could expect a ~5 second delay (which you have observed)

Hi @jeremy, thanks!

Does the job get pre-assigned to an agent by the dispatcher before the agent pings, or does the dispatcher assign jobs at ping time?

@kgillette Jobs don’t get pre-assigned, the agent picks up the job when it polls the agent API for work.

1 Like