Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for marking and skipping slow tests, temporarily mark pydantic tests as slow #589

Merged
merged 7 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ jobs:
image: nemoci.azurecr.io/bionemo:${{ github.run_id }}
options: --gpus all
volumes:
- /home/azureuser/actions-runner-bionemo/cache:/root/.cache
- /home/azureuser/actions-runner-bionemo/cache:/github/home/.cache
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}

- name: Run tests
run: ./ci/scripts/run_pytest.sh --no-nbval
env:
BIONEMO_DATA_SOURCE: ngc
run: ./ci/scripts/run_pytest.sh --no-nbval --skip-slow

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand All @@ -110,5 +112,14 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: ${{ github.run_id }}

clean-up:
needs: run-tests
runs-on: self-hosted-nemo-gpus-1
if: ${{ always() }}
steps:
- name: clean up image
run: docker rmi nemoci.azurecr.io/bionemo:${{ github.run_id }}

# TODO: exclude tests from base image; run tests from github workspace mounted in the image.
# TODO: upload coverage report to codecov.io
# TODO: figure out way of cleaning up working directory (requires sudo or for us to fix file ownership from release container)
4 changes: 4 additions & 0 deletions ci/scripts/run_pytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Usage: $(basename "$0") [OPTIONS]
Options:
--skip-docs Skip running tests in the docs directory
--no-nbval Skip jupyter notebook validation tests
--skip-slow Skip tests marked as slow (@pytest.mark.slow)

Note: Documentation tests (docs/) are only run when notebook validation
is enabled (--no-nbval not set) and docs are not skipped
Expand All @@ -48,13 +49,15 @@ export BIONEMO_DATA_SOURCE PYTHONDONTWRITEBYTECODE PYTORCH_CUDA_ALLOC_CONF
declare -a coverage_files
SKIP_DOCS=false
NO_NBVAL=false
SKIP_SLOW=false
error=false

# Parse command line arguments
while (( $# > 0 )); do
case "$1" in
--skip-docs) SKIP_DOCS=true ;;
--no-nbval) NO_NBVAL=true ;;
--skip-slow) SKIP_SLOW=true ;;
-h|--help) usage ;;
*) echo "Unknown option: $1" >&2; usage 1 ;;
esac
Expand Down Expand Up @@ -83,6 +86,7 @@ PYTEST_OPTIONS=(
--cov-report=xml:coverage.xml
)
[[ "$NO_NBVAL" != true ]] && PYTEST_OPTIONS+=(--nbval-lax)
[[ "$SKIP_SLOW" == true ]] && PYTEST_OPTIONS+=(-m "not slow")

# Define test directories
TEST_DIRS=(./sub-packages/bionemo-*/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def dummy_parquet_train_val_inputs(tmp_path):
return train_cluster_path, valid_cluster_path


# TODO: These tests currently take an inordinate amount of time. See https://jirasw.nvidia.com/browse/BIONEMO-553
@pytest.mark.slow
def test_pretrain_pydantic_cli(dummy_protein_dataset, dummy_parquet_train_val_inputs, tmpdir):
result_dir = tmpdir.mkdir("results")
train_cluster_path, valid_cluster_path = dummy_parquet_train_val_inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def test_bionemo2_rootdir(data_path):
assert data_path.is_dir(), f"Test data directory is supposed to be a directory.\n{data_error_str}"


# TODO: These tests currently take an inordinate amount of time. See https://jirasw.nvidia.com/browse/BIONEMO-553
@pytest.mark.slow
def test_pretrain_cli_from_ckpt(tmpdir, data_path):
# Same as test_pretrain, but includes a checkpoint to initialize from.
result_dir = Path(tmpdir.mkdir("results"))
Expand Down Expand Up @@ -83,6 +85,8 @@ def test_pretrain_cli_from_ckpt(tmpdir, data_path):
assert (result_dir / "test-experiment").exists(), "Could not find test experiment directory."


# TODO: These tests currently take an inordinate amount of time. See https://jirasw.nvidia.com/browse/BIONEMO-553
@pytest.mark.slow
def test_pretrain_cli(tmpdir, data_path):
"""trains from scratch"""
# data_path: Path = load("single_cell/testdata-20240506") / "cellxgene_2023-12-15_small" / "processed_data"
Expand Down Expand Up @@ -123,6 +127,8 @@ def test_pretrain_cli(tmpdir, data_path):
assert (result_dir / "test-experiment").exists(), "Could not find test experiment directory."


# TODO: These tests currently take an inordinate amount of time. See https://jirasw.nvidia.com/browse/BIONEMO-553
@pytest.mark.slow
def test_finetune_cli(tmpdir, data_path):
"""Uses CLI to invoke the entrypoint"""
# data_path: Path = load("single_cell/testdata-20240506") / "cellxgene_2023-12-15_small" / "processed_data"
Expand Down
Loading