-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add folder for user installation test * update tests to run in parallel * fix linting errors in dummy script * add normal test to compare * empty dummy script for now * try to only run loggers * separate tests into multiple workflows * remove horovod setup for all to test which needs it * remove old pytest * remove old directory * update tests to hopefully work in parallel * remove split tests * remove tensorflow building for tests * fix linting errors * add missing marker and add uv to generic torch * change version in pytest * update generic torch with check for NO_CUDA flag * add other fixtures and add comment with how to build tf * fix linting errors * add comment about env variables * fix grammar * add no cache dir to pip install * small bugfix in generic_torch
- Loading branch information
1 parent
86762f0
commit 9192008
Showing
8 changed files
with
5,479 additions
and
35,176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,34 @@ | ||
--- | ||
name: Unit and integration tests | ||
name: Testing with pytest | ||
|
||
on: | ||
pull_request: | ||
branches: [main, dev] | ||
|
||
jobs: | ||
test-itwinai: | ||
name: Test itwinai with pytest | ||
test-torch: | ||
name: Testing with pytest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install compilers for Horovod | ||
run: | | ||
sudo apt-get update && | ||
sudo apt-get install -y gcc-11 g++-11 && | ||
sudo apt-get install -y cmake && | ||
sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev && | ||
gcc --version && | ||
cmake --version && | ||
mpirun --version | ||
- name: Set up Python 3.11.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11.9 | ||
|
||
- name: Make PyTorch virtualenv | ||
shell: bash -l {0} | ||
run: make torch-env-cpu | ||
|
||
- name: Make Tensorflow virtualenv | ||
shell: bash -l {0} | ||
run: make tensorflow-env-cpu | ||
|
||
# NOTE, to change the name in which tests are run, set custom TORCH_ENV and TF_ENV env variables. | ||
# Default environment names are ".venv-pytorch" and ".venv-tf" | ||
- name: Run pytest for workflows | ||
shell: bash -l {0} | ||
run: .venv-pytorch/bin/pytest -v ./tests/ -m "not hpc" | ||
# Comment this back in to also build tensorflow env | ||
# - name: Make Tensorflow virtualenv | ||
# shell: bash -l {0} | ||
# run: make tensorflow-env-cpu | ||
|
||
# NOTE, to change the name of the env in which tests are run, set custom TORCH_ENV | ||
# and TF_ENV env variables. Default environment names are ".venv-pytorch" and | ||
# ".venv-tf" | ||
|
||
- name: Run pytest for workflows | ||
shell: bash -l {0} | ||
run: .venv-pytorch/bin/pytest -v -n logical ./tests/ -m "not hpc and not tensorflow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
# - Anna Lappe <[email protected]> - CERN | ||
# ------------------------------------------------------------------------------------- | ||
|
||
import shutil | ||
import tempfile | ||
from pathlib import Path | ||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
|
@@ -27,37 +28,40 @@ | |
|
||
@pytest.fixture(scope="module") | ||
def console_logger(): | ||
yield ConsoleLogger(savedir="/tmp/console/test_mllogs", log_freq=1) | ||
shutil.rmtree("/tmp/console/test_mllogs", ignore_errors=True) | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
save_dir = Path(temp_dir) / "console/test_mllogs" | ||
yield ConsoleLogger(savedir=save_dir, log_freq=1) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def mlflow_logger(): | ||
yield MLFlowLogger( | ||
savedir="/tmp/mlflow/test_mllogs", | ||
experiment_name="test_experiment", | ||
tracking_uri="file:///tmp/mlruns", | ||
) | ||
shutil.rmtree("/tmp/mlflow/test_mllogs", ignore_errors=True) | ||
shutil.rmtree("/tmp/mlruns", ignore_errors=True) | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
save_dir = Path(temp_dir) / "mlflow/test_mllogs" | ||
yield MLFlowLogger( | ||
savedir=save_dir, | ||
experiment_name="test_experiment", | ||
) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def wandb_logger(): | ||
yield WandBLogger(savedir="/tmp/wandb/test_mllogs", project_name="test_project") | ||
shutil.rmtree("/tmp/wandb/test_mllogs", ignore_errors=True) | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
save_dir = Path(temp_dir) / "wandb/test_mllogs" | ||
yield WandBLogger(savedir=save_dir, project_name="test_project") | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def tensorboard_logger_tf(): | ||
yield TensorBoardLogger(savedir="/tmp/tf_tb/test_mllogs", framework="tensorflow") | ||
shutil.rmtree("/tmp/tf_tb/test_mllogs", ignore_errors=True) | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
save_dir = Path(temp_dir) / "tf_tb/test_mllogs" | ||
yield TensorBoardLogger(savedir=save_dir, framework="tensorflow") | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def tensorboard_logger_torch(): | ||
yield TensorBoardLogger(savedir="/tmp/torch_tb/test_mllogs", framework="pytorch") | ||
shutil.rmtree("/tmp/torch_tb/test_mllogs", ignore_errors=True) | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
save_dir = Path(temp_dir) / "torch_tb/test_mllogs" | ||
yield TensorBoardLogger(savedir=save_dir, framework="pytorch") | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.