Unverified Commit 02209bbb authored by Dillon Cullinan's avatar Dillon Cullinan Committed by GitHub
Browse files

ci: Limit cpus in docker processes (#3251)


Signed-off-by: default avatarDillon Cullinan <dcullinan@nvidia.com>
parent 1208f017
...@@ -40,7 +40,10 @@ runs: ...@@ -40,7 +40,10 @@ runs:
using: "composite" using: "composite"
steps: steps:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 #v3.11.1
with:
# This is not # of CPUs, this is CPU priority, 1024 is the default
driver-opts: 'cpu-shares=100'
- name: Login to NGC - name: Login to NGC
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push' if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
shell: bash shell: bash
......
...@@ -8,6 +8,10 @@ inputs: ...@@ -8,6 +8,10 @@ inputs:
image_tag: image_tag:
description: 'Image Tag to run tests on' description: 'Image Tag to run tests on'
required: true required: true
cpu_limit:
description: 'Maximum number of cores available to docker'
required: false
default: '10'
runs: runs:
...@@ -16,11 +20,13 @@ runs: ...@@ -16,11 +20,13 @@ runs:
- name: Run tests - name: Run tests
shell: bash shell: bash
env: env:
NUM_CPUS: ${{ inputs.cpu_limit }}
CONTAINER_ID: test_${{ github.run_id }}_${{ github.run_attempt }}_${{ github.job }} CONTAINER_ID: test_${{ github.run_id }}_${{ github.run_attempt }}_${{ github.job }}
PYTEST_XML_FILE: pytest_test_report.xml PYTEST_XML_FILE: pytest_test_report.xml
HF_HOME: /runner/_work/_temp HF_HOME: /runner/_work/_temp
run: | run: |
docker run --runtime=nvidia --rm --gpus all -w /workspace \ docker run --runtime=nvidia --rm --gpus all -w /workspace \
--cpus=${NUM_CPUS} \
--network host \ --network host \
--name ${{ env.CONTAINER_ID }}_pytest \ --name ${{ env.CONTAINER_ID }}_pytest \
${{ inputs.image_tag }} \ ${{ inputs.image_tag }} \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment