4

I have a question about what serial: true does with respect to jobs. It seems a little redundant since serial_groups already seems to control the serial execution of multiple jobs. But at the same time inside of the plan there are constructs like do that run steps of a plan in a series.

The documentation says this:

serial: boolean Optional. Default false. If set to true, builds will queue up and execute one-by-one, rather than executing in parallel.

In in the "Concepts" section, concourse seems to define a "build" as

An instance of execution of a job's plan is called a build

In that case, if you don't specify build steps inside of a do, will they run concurrently?

shinything
  • 65
  • 1
  • 4

1 Answers1

6

serial: true means that a specific job will only run one build at a time, however putting multiple jobs in a single serial_group means that all of the jobs in that group will run serial in relation to one another.

For example, if I define job job1 as serial: true, and quickly execute four builds of job1, then the first build will run, and builds 2, 3, and 4 will wait in pending state. When build 1 finishes, build 2 will kick off, and builds 3, and 4 will waiting in pending state, and so on.

If a define job1, job2, and job3 in a serial_group, and I kick all of them off at the same time, then one of those jobs, lets say job2, will run, and the rest will wait in pending state. Then another job, lets say job1 will run, and job3 wil wait in pending state until job2 finishes, and then job3 will run.

Josh Zarrabi
  • 1,054
  • 7
  • 15
  • So will the ordering of jobs inside of the same serial group depend on the order in which they were declared? Like if I wrote `job1` , `job2,` `job3` in that order and defined them within the same `serial_group`, will they always execute in that order? – shinything Sep 25 '17 at 04:12
  • I think so, I probably shouldn't have put them in a random order in the answer... – Josh Zarrabi Sep 25 '17 at 05:36
  • so just for clarification, if `serial:true` is not specified, the steps inside of a job will run concurrently? – shinything Sep 27 '17 at 23:39
  • 1
    No. `serial:true` does not have anything to do with the steps inside of a job. Steps can be run concurrently with `aggregate` blocks. https://concourse.ci/single-page.html#aggregate-step. `serial:true` means that each separate build of a specific job will only run one build at a time. So with `serial:true` you can `trigger` a job many times and it will not run more than one instance of that job at a time. – Josh Zarrabi Sep 29 '17 at 19:29
  • I've done some light testing on this matter and I haven't noticed a correlation between the names of jobs and the order which they are executed in a serial group. – doublespaces Mar 05 '22 at 18:25