From 1f50524585fec7ddb04e0c428e875e06f75bc82f Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Mon, 10 Jun 2024 09:48:47 -0400 Subject: [PATCH] ci: Print and stop stale containers after run --- .github/workflows/ci.yml | 9 +++------ .github/workflows/doc-build-dev-nightly.yml | 3 --- .github/workflows/doc-build-release.yml | 3 --- .github/workflows/test-run-custom.yml | 6 +++--- .github/workflows/test-run-dev-version-nightly.yml | 6 +++--- .github/workflows/test-run-nightly.yml | 6 +++--- .github/workflows/test-run-old-versions-weekly.yml | 6 +++--- .github/workflows/test-run-solvermode-weekly.yml | 6 +++--- .github/workflows/test-run-wo-codegen-weekly.yml | 6 +++--- Makefile | 5 ++++- doc/source/conf.py | 1 + 11 files changed, 26 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac07412667a..39cdebd5ecd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,9 +126,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Install pyfluent run: make install @@ -231,9 +228,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Add version information run: make version-info @@ -531,6 +525,9 @@ jobs: env: FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} + - name: Cleanup previous docker containers + run: make cleanup-previous-docker-containers + - name: Upload 24.2 Coverage Artifacts if: matrix.image-tag == 'v24.2.0' uses: actions/upload-artifact@v4 diff --git a/.github/workflows/doc-build-dev-nightly.yml b/.github/workflows/doc-build-dev-nightly.yml index 400681b1bc2..75ac102ee28 100644 --- a/.github/workflows/doc-build-dev-nightly.yml +++ b/.github/workflows/doc-build-dev-nightly.yml @@ -33,9 +33,6 @@ jobs: sudo apt update sudo apt-get install pandoc libegl1 make xvfb libfontconfig1 libxrender1 libxkbcommon-x11-0 -y - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Install pyfluent run: make install diff --git a/.github/workflows/doc-build-release.yml b/.github/workflows/doc-build-release.yml index 59842e8f364..45e03d61c51 100644 --- a/.github/workflows/doc-build-release.yml +++ b/.github/workflows/doc-build-release.yml @@ -35,9 +35,6 @@ jobs: sudo apt update sudo apt-get install pandoc libegl1 make xvfb libfontconfig1 libxrender1 libxkbcommon-x11-0 -y - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Install pyfluent run: make install diff --git a/.github/workflows/test-run-custom.yml b/.github/workflows/test-run-custom.yml index 9ad19746614..2447da49729 100644 --- a/.github/workflows/test-run-custom.yml +++ b/.github/workflows/test-run-custom.yml @@ -55,9 +55,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Add version information run: make version-info @@ -111,3 +108,6 @@ jobs: poetry python -m pytest -v --no-cov --capture=no -k test_parametric_workflow --nightly env: FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} + + - name: Cleanup previous docker containers + run: make cleanup-previous-docker-containers diff --git a/.github/workflows/test-run-dev-version-nightly.yml b/.github/workflows/test-run-dev-version-nightly.yml index 8ea00981d69..1a7baa0deaf 100644 --- a/.github/workflows/test-run-dev-version-nightly.yml +++ b/.github/workflows/test-run-dev-version-nightly.yml @@ -35,9 +35,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Add version information run: make version-info @@ -84,6 +81,9 @@ jobs: env: FLUENT_IMAGE_TAG: v25.1.0 + - name: Cleanup previous docker containers + run: make cleanup-previous-docker-containers + - name: Update Fluent image env: GITHUB_TOKEN: ${{ secrets.ADMIN_ACCESS_TOKEN }} diff --git a/.github/workflows/test-run-nightly.yml b/.github/workflows/test-run-nightly.yml index 7d64c189eea..2209ee82b3f 100644 --- a/.github/workflows/test-run-nightly.yml +++ b/.github/workflows/test-run-nightly.yml @@ -35,9 +35,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Add version information run: make version-info @@ -84,6 +81,9 @@ jobs: env: FLUENT_IMAGE_TAG: v24.2.0 + - name: Cleanup previous docker containers + run: make cleanup-previous-docker-containers + - name: Upload 24.2 Coverage Results to Codecov uses: codecov/codecov-action@v4 with: diff --git a/.github/workflows/test-run-old-versions-weekly.yml b/.github/workflows/test-run-old-versions-weekly.yml index 015a0416120..cddbbb905cc 100644 --- a/.github/workflows/test-run-old-versions-weekly.yml +++ b/.github/workflows/test-run-old-versions-weekly.yml @@ -35,9 +35,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Add version information run: make version-info @@ -195,3 +192,6 @@ jobs: make unittest-all-${{ matrix.version }} env: FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} + + - name: Cleanup previous docker containers + run: make cleanup-previous-docker-containers diff --git a/.github/workflows/test-run-solvermode-weekly.yml b/.github/workflows/test-run-solvermode-weekly.yml index be8edc49103..000936849da 100644 --- a/.github/workflows/test-run-solvermode-weekly.yml +++ b/.github/workflows/test-run-solvermode-weekly.yml @@ -36,9 +36,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Add version information run: make version-info @@ -80,3 +77,6 @@ jobs: run: | make install-test make unittest-solvermode-251 + + - name: Cleanup previous docker containers + run: make cleanup-previous-docker-containers diff --git a/.github/workflows/test-run-wo-codegen-weekly.yml b/.github/workflows/test-run-wo-codegen-weekly.yml index 80b210b0c6e..062d272c8a5 100644 --- a/.github/workflows/test-run-wo-codegen-weekly.yml +++ b/.github/workflows/test-run-wo-codegen-weekly.yml @@ -35,9 +35,6 @@ jobs: restore-keys: | Python-${{ runner.os }}-${{ matrix.python-version }} - - name: Cleanup previous docker containers - run: make cleanup-previous-docker-containers - - name: Add version information run: make version-info @@ -127,3 +124,6 @@ jobs: make unittest-all-${{ matrix.version }}-no-codegen env: FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} + + - name: Cleanup previous docker containers + run: make cleanup-previous-docker-containers diff --git a/Makefile b/Makefile index 3a5f3a2a276..b699c1fa408 100644 --- a/Makefile +++ b/Makefile @@ -151,5 +151,8 @@ compare-flobject: @python .ci/compare_flobject.py cleanup-previous-docker-containers: - @if [ -n "$(docker ps -a -q)" ]; then docker stop $(docker ps -a -q); fi + @if [ -n "$(docker ps -a -q)" ]; then \ + docker inspect --format='{{.Config.Labels.test_name}}' $(docker ps -a -q); \ + docker stop $(docker ps -a -q); \ + fi @if [ -n "$(docker ps -a -q)" ]; then docker rm -vf $(docker ps -a -q); fi diff --git a/doc/source/conf.py b/doc/source/conf.py index 310cbcadf0f..c3bea0310d4 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -135,6 +135,7 @@ def _stop_fluent_container(gallery_conf, fname): .split() ) for container_name in container_names: + print(f"Container still running for script {fname}") subprocess.run(f"docker stop {container_name}", shell=is_linux) except Exception: pass