Skip to content
Open
46 changes: 16 additions & 30 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ concurrency:
jobs:
cpu-tests:
runs-on: ${{ matrix.os }}
env:
UV_SYSTEM_PIP: 1
CLEARML_NO_DEFAULT_SERVER: 1
CLEARML_API_HOST: "http://localhost"
CLEARML_WEB_HOST: "http://localhost"
CLEARML_FILES_HOST: "http://localhost"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this vs CLEARML_OFFLINE_MODE=1, https://clear.ml/docs/latest/docs/guides/set_offline/#setting-task-to-offline-mode

def set_bypass_mode(cls, bypass: bool) -> None:
"""
Set ``clearml.Task`` to offline mode.
Will bypass all outside communication, and will save all data and logs to a local session folder.
Should only be used in "standalone mode", when there is no access to the *clearml-server*.
Args:
bypass: If ``True``, all outside communication is skipped.
Data and logs will be stored in a local session folder.
For more information, please refer to `ClearML docs
<https://clear.ml/docs/latest/docs/clearml_sdk/task_sdk/#offline-mode>`_.
"""
from clearml import Task
setattr(cls, "_bypass", bypass)
Task.set_offline(offline_mode=bypass)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand that, but without
CLEARML_API_HOST: "http://localhost"
CLEARML_WEB_HOST: "http://localhost"
CLEARML_FILES_HOST: "http://localhost"
the following error is produced:
FAILED tests/ignite/contrib/engines/test_common.py::test_setup_clearml_logging - ValueError: ClearML configuration could not be found (missing `~/clearml.conf` or Environment CLEARML_API_HOST)

timeout-minutes: 85
defaults:
run:
Expand All @@ -57,57 +63,37 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Install uv and Python
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}

- name: Get year & week number
id: get-date
run: |
echo "date=$(/bin/date "+%Y-%U")" >> $GITHUB_OUTPUT

- name: Get pip cache dir
id: pip-cache
run: |
pip install -U pip || python -m pip install -U pip
echo "pip_cache=$(pip cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
with:
path: |
${{ steps.pip-cache.outputs.pip_cache }}
key: ${{ steps.get-date.outputs.date }}-pytorch-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pytorch-channel }}-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ steps.get-date.outputs.date }}-pytorch-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pytorch-channel }}-

- run: pip install pip wheel setuptools -Uqq
cache: true

- name: Install PyTorch
if: ${{ matrix.pytorch-channel == 'pytorch' }}
run: pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
run: uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu

- name: Install PyTorch (nightly)
if: ${{ matrix.pytorch-channel == 'pytorch-nightly' }}
run: pip install torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --pre
run: uv pip install torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --pre

- name: Install dependencies
run: |
pip install -r requirements-dev.txt
pip install .
pip list
uv pip install -r requirements-dev.txt
uv pip install -e .
uv pip list

- name: Check code formatting
run: |
bash ./tests/run_code_style.sh install
bash ./tests/run_code_style.sh lint

- name: Ensure mypy is installed in uv environment
run: uv pip install mypy
- name: Run Mypy
# https://github.com/pytorch/ignite/pull/2780
#
if: ${{ matrix.os == 'ubuntu-latest' && matrix.pytorch-channel == 'pytorch-nightly'}}
run: |
bash ./tests/run_code_style.sh mypy

# Download MNIST: https://github.com/pytorch/ignite/issues/1737
# to "/tmp" for unit tests
- name: Download MNIST
Expand Down
Loading