Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 1 | # NOTE(andreaf) The number of vcpus is not available on all systems. |
| 2 | # See https://github.com/ansible/ansible/issues/30688 |
| 3 | # When not available, we fall back to ansible_processor_cores |
| 4 | - name: Get hw.logicalcpu from sysctl |
| 5 | shell: sysctl hw.logicalcpu | cut -d' ' -f2 |
| 6 | register: sysctl_hw_logicalcpu |
| 7 | when: ansible_processor_vcpus is not defined |
| 8 | |
| 9 | - name: Number of cores |
| 10 | set_fact: |
| 11 | num_cores: "{{ansible_processor_vcpus|default(sysctl_hw_logicalcpu.stdout)}}" |
| 12 | |
| 13 | - name: Set concurrency for cores == 3 or less |
| 14 | set_fact: |
| 15 | default_concurrency: "{{ num_cores }}" |
| 16 | when: num_cores|int <= 3 |
| 17 | |
| 18 | - name: Limit max concurrency when more than 3 vcpus are available |
| 19 | set_fact: |
| 20 | default_concurrency: "{{ num_cores|int // 2 }}" |
| 21 | when: num_cores|int > 3 |
| 22 | |
| 23 | - name: Run Tempest |
Andreas Jaeger | ba2f479 | 2018-01-12 16:48:52 +0100 | [diff] [blame^] | 24 | command: tox -e {{tox_envlist}} -- {{tempest_test_regex|quote}} --concurrency={{tempest_concurrency|default(default_concurrency)}} |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 25 | args: |
| 26 | chdir: "{{devstack_base_dir}}/tempest" |
| 27 | become: true |
| 28 | become_user: tempest |