Do jobs in self-hosted runners run in parallel?

The document says "Jobs run in parallel by default. ". When I tried workflow in github-hosted runners, jobs do run in parallel. However, when I try to run the workflow in self-hosted runners, the jobs do not seem to run in parallel. I’ve tried in both macos and centos with the latest version runner v2.165.2.

Is it that jobs only run in parallel in github-hosted runners?

My work flow is as follows:

on: [push]

jobs:
  Synthesize:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v2

      - run: |
          ./code_generation.sh

      - run: |
          ./basic_verification.sh

      - run: |
          ./synthesis.sh


  Estimation:
    runs-on: self-hosted
    needs: Synthesize
    steps:
      - name: check
        run: |
          pwd
          ls

      - name: start time
        run: |
          date

      - name: sleep
        run: |
          sleep 8

      - name: end time
        run: |
          date

  Deeper_Verification:
    runs-on: self-hosted
    needs: Synthesize
    steps:
      - name: check
        run: |
          pwd
          ls

      - name: start time
        run: |
          date

      - name: sleep
        run: |
          sleep 8

      - name: end time
        run: |
          date

And the runner output in CentOS is as follows:

2020-03-06 05:41:01Z: Listening for Jobs
2020-03-06 05:42:38Z: Running job: Synthesize
2020-03-06 05:42:46Z: Job Synthesize completed with result: Succeeded
2020-03-06 05:42:51Z: Running job: Deeper_Verification
2020-03-06 05:43:02Z: Job Deeper_Verification completed with result: Succeeded
2020-03-06 05:43:04Z: Running job: Estimation
2020-03-06 05:43:15Z: Job Estimation completed with result: Succeeded

Hi @dahuokolmostar ,

Jobs should run in parallel for both hosted runner and self-hosted runner.

But for self-hosted runner, there are some comments:

  • One self-hosted runner can only run one job at a time, when no available runners are idle, the subsequent jobs will be in queueing until available runners are idle.
  • If have enough available self-hosted runners for a workflow run, each job will be assigned a self-hosted runner, and the jobs will run in parallel.
  • When multiple workflows are running, if the workflows are more than the available self-hosted runners, each workflow will be assigned only one self-hosted runner.

Thanks.

2 Likes

Are there any plans to change this? That is so that a runner can run multiple jobs at the same time (concurrently).

It would be really nice, since a lot of the time the jobs are small and don’t require the full machine to run and could run multiple jobs at the same time. Plus most of the time the jobs are spun up in containers so just having fewer runner machines with multiple cpus to spin those up vs having multiple smaller machines or having to run multiple instances of the actions runner service per machine to achieve this…

For more cpu/resource intensive jobs you could select a runner via labels so that it would go onto a machine that is dedicated to that job?

2 Likes

Fact is that currently, the GitLab runner is much better than the Github actions runnner.

Hopefully this will change.