Suppress hypothesis health check for dask client. (#6589)

This commit is contained in:
Jiaming Yuan 2021-01-11 14:11:57 +08:00 committed by GitHub
parent 80065d571e
commit 78f2cd83d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 15 deletions

View File

@ -6,7 +6,7 @@ import numpy as np
import asyncio import asyncio
import xgboost import xgboost
import subprocess import subprocess
from hypothesis import given, strategies, settings, note from hypothesis import given, strategies, settings, note, HealthCheck
from hypothesis._settings import duration from hypothesis._settings import duration
from test_gpu_updaters import parameter_strategy from test_gpu_updaters import parameter_strategy
@ -18,6 +18,7 @@ from test_with_dask import run_empty_dmatrix_reg # noqa
from test_with_dask import run_empty_dmatrix_cls # noqa from test_with_dask import run_empty_dmatrix_cls # noqa
from test_with_dask import _get_client_workers # noqa from test_with_dask import _get_client_workers # noqa
from test_with_dask import generate_array # noqa from test_with_dask import generate_array # noqa
from test_with_dask import suppress
import testing as tm # noqa import testing as tm # noqa
@ -171,25 +172,30 @@ class TestDistributedGPU:
run_with_dask_dataframe(dxgb.DaskDMatrix, client) run_with_dask_dataframe(dxgb.DaskDMatrix, client)
run_with_dask_dataframe(dxgb.DaskDeviceQuantileDMatrix, client) run_with_dask_dataframe(dxgb.DaskDeviceQuantileDMatrix, client)
@given(params=parameter_strategy, num_rounds=strategies.integers(1, 20), @given(
dataset=tm.dataset_strategy) params=parameter_strategy,
@settings(deadline=duration(seconds=120)) num_rounds=strategies.integers(1, 20),
dataset=tm.dataset_strategy,
)
@settings(deadline=duration(seconds=120), suppress_health_check=suppress)
@pytest.mark.skipif(**tm.no_dask()) @pytest.mark.skipif(**tm.no_dask())
@pytest.mark.skipif(**tm.no_dask_cuda()) @pytest.mark.skipif(**tm.no_dask_cuda())
@pytest.mark.parametrize('local_cuda_cluster', [{'n_workers': 2}], indirect=['local_cuda_cluster']) @pytest.mark.parametrize(
"local_cuda_cluster", [{"n_workers": 2}], indirect=["local_cuda_cluster"]
)
@pytest.mark.mgpu @pytest.mark.mgpu
def test_gpu_hist( def test_gpu_hist(
self, self,
params: Dict, params: Dict,
num_rounds: int, num_rounds: int,
dataset: tm.TestDataset, dataset: tm.TestDataset,
local_cuda_cluster: LocalCUDACluster local_cuda_cluster: LocalCUDACluster,
) -> None: ) -> None:
with Client(local_cuda_cluster) as client: with Client(local_cuda_cluster) as client:
run_gpu_hist(params, num_rounds, dataset, dxgb.DaskDMatrix, run_gpu_hist(params, num_rounds, dataset, dxgb.DaskDMatrix, client)
client) run_gpu_hist(
run_gpu_hist(params, num_rounds, dataset, params, num_rounds, dataset, dxgb.DaskDeviceQuantileDMatrix, client
dxgb.DaskDeviceQuantileDMatrix, client) )
@pytest.mark.skipif(**tm.no_cupy()) @pytest.mark.skipif(**tm.no_cupy())
@pytest.mark.skipif(**tm.no_dask()) @pytest.mark.skipif(**tm.no_dask())

View File

@ -14,7 +14,8 @@ from sklearn.datasets import make_classification
import sklearn import sklearn
import os import os
import subprocess import subprocess
from hypothesis import given, settings, note import hypothesis
from hypothesis import given, settings, note, HealthCheck
from test_updaters import hist_parameter_strategy, exact_parameter_strategy from test_updaters import hist_parameter_strategy, exact_parameter_strategy
from test_with_sklearn import run_feature_weights from test_with_sklearn import run_feature_weights
@ -23,14 +24,19 @@ if sys.platform.startswith("win"):
if tm.no_dask()['condition']: if tm.no_dask()['condition']:
pytest.skip(msg=tm.no_dask()['reason'], allow_module_level=True) pytest.skip(msg=tm.no_dask()['reason'], allow_module_level=True)
from distributed import LocalCluster, Client
from distributed import LocalCluster, Client, get_client
from distributed.utils_test import client, loop, cluster_fixture from distributed.utils_test import client, loop, cluster_fixture
import dask.dataframe as dd import dask.dataframe as dd
import dask.array as da import dask.array as da
from xgboost.dask import DaskDMatrix from xgboost.dask import DaskDMatrix
if hasattr(HealthCheck, 'function_scoped_fixture'):
suppress = [HealthCheck.function_scoped_fixture]
else:
suppress = hypothesis.utils.conventions.not_set
kRows = 1000 kRows = 1000
kCols = 10 kCols = 10
kWorkers = 5 kWorkers = 5
@ -803,7 +809,7 @@ class TestWithDask:
@given(params=hist_parameter_strategy, @given(params=hist_parameter_strategy,
dataset=tm.dataset_strategy) dataset=tm.dataset_strategy)
@settings(deadline=None) @settings(deadline=None, suppress_health_check=suppress)
def test_hist( def test_hist(
self, params: Dict, dataset: tm.TestDataset, client: "Client" self, params: Dict, dataset: tm.TestDataset, client: "Client"
) -> None: ) -> None:
@ -812,7 +818,7 @@ class TestWithDask:
@given(params=exact_parameter_strategy, @given(params=exact_parameter_strategy,
dataset=tm.dataset_strategy) dataset=tm.dataset_strategy)
@settings(deadline=None) @settings(deadline=None, suppress_health_check=suppress)
def test_approx( def test_approx(
self, client: "Client", params: Dict, dataset: tm.TestDataset self, client: "Client", params: Dict, dataset: tm.TestDataset
) -> None: ) -> None: