# Jobs inside stages not executing in parallel

**URL:** <https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021>\
**Category:** Travis CI Discussions & Feedback\
**Tags:** travis-build\
**Created:** [June 15, 2020, 5:39pm UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021 "2020-06-15T17:39:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cryptox31](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@cryptox31](https://travis-ci.community/u/cryptox31)\
**Post date:** [June 15, 2020, 5:39pm UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021/1 "2020-06-15T17:39:13Z")

</div>

I have tried various configurations inside `stages` but I am unable to make travis execute jobs in parallel inside stages.

I have gone through these links:

- [https://docs.travis-ci.com/user/build-stages/](https://docs.travis-ci.com/user/build-stages/)
- [https://docs.travis-ci.com/user/build-stages/using-yaml-aliases/](https://docs.travis-ci.com/user/build-stages/using-yaml-aliases/) (test staging part)  
and I have still not gotten it(stage `FVT`) to work in parallel

This one snippet of the travis yaml

```auto
dist: trusty
language: java
sudo: true
group: bluezone
jdk: openjdk11
services:
  - docker

branches:
  only:
    - develop

before_cache:
  - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
  apt: true
  directories:
    - $HOME/.gradle/caches
    - $HOME/.gradle/wrapper
    - $HOME/.cache/pip
install:
  # Install Ansible.
  - sudo apt-get update
  - sudo apt-get install python3
  - sudo -H pip install --upgrade pip
  - sudo -H pip install ansible
  - sudo apt-get install sshpass

jobs:
  include:
    - stage: "Build and Deploy"
      script: ./playbooks/dev/deploy_image.sh
    - &fvt
      stage: test
      script: ./qa/src/test/resources/test1.sh
    - <<: *fvt
      script: ./qa/src/test/resources/test2.sh

```

and this is another snippet (The section above jobs.include is not pasted as it is same as the 1st snippet):

```auto
jobs:
  include:
    - stage: "Build and Deploy"
      script: 
      - ./playbooks/dev/deploy_image.sh
    - stage: "FVT"
      name: "A"
      script:
      - ./qa/src/test/resources/test1.sh
    - stage: "FVT"
      name: "B"
      script:
      - ./qa/src/test/resources/test2.sh

```

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 15, 2020, 8:21pm UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021/2 "2020-06-15T20:21:17Z")

</div>

When reporting problems, please consider including:

1. What you are trying to achieve
2. What you have tried (probably a link to the configuration)
3. What happened instead (often, pointing to a build log URL, in the form of [https://travis-ci.com/OWNER/REPO/build/NNNNNNN](https://travis-ci.com/OWNER/REPO/build/NNNNNNN) would be helpful).

---

<div class="post-metadata">

**Author:** ![cryptox31](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@cryptox31](https://travis-ci.community/u/cryptox31)\
**Post date:** [June 15, 2020, 9:28pm UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021/3 "2020-06-15T21:28:46Z")

</div>

The title itself says that jobs are not executing in parallel.

Unfortunately, I cannot link the travis repo here because it’s a private repo.

Do you know what are the possible reasons for the jobs inside stages not executing in parallel?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 16, 2020, 12:16am UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021/4 "2020-06-16T00:16:58Z")

</div>

They could be queued simultaneously, but one of them could be held in the queue for a few different reasons. Your organization might be running too many jobs, and your repo might have a limit on the number of concurrent jobs. Without concrete information, we cannot really help you. If you wish to discuss it in private, please email [support@travis-ci.com](mailto:support@travis-ci.com).

---

<div class="post-metadata">

**Author:** ![cryptox31](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@cryptox31](https://travis-ci.community/u/cryptox31)\
**Post date:** [June 17, 2020, 4:04pm UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021/5 "2020-06-17T16:04:11Z")

</div>

So, I figured what the problem was.

I changed the concurrent build setting to two and parallel jobs inside stages started working

 ![image](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/0/0edc1c3415013a217e36395f02438db2989dbfa6.png)  
but this caused a side effect to our builds because our builds depend on external servers to test the build we deploy to.

Is there a way to only allow parallel builds inside stages and limit to 1 concurrent build?

---

<div class="post-metadata">

**Author:** ![cryptox31](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@cryptox31](https://travis-ci.community/u/cryptox31)\
**Post date:** [June 23, 2020, 10:09pm UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021/6 "2020-06-23T22:09:56Z")

</div>

@BanzaiMan Any updates?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 24, 2020, 12:03pm UTC](https://travis-ci.community/t/jobs-inside-stages-not-executing-in-parallel/9021/7 "2020-06-24T12:03:02Z")

</div>

> [@cryptox31](#):
>
> Is there a way to only allow parallel builds inside stages and limit to 1 concurrent build?

Then there is no need to have these in the same stage. Just separate them into different stages. “Build 1”, “Build 2”, “Build 3”, etc.
