From 071e10c1d1c492d4ee28e0c8a8e1a5206225f4ca Mon Sep 17 00:00:00 2001 From: Philip Hyunsu Cho Date: Wed, 29 Jul 2020 04:29:57 -0700 Subject: [PATCH] [CI] Fix broken Docker container 'cpu' (#5956) --- Jenkinsfile | 4 +-- Jenkinsfile-win64 | 2 +- tests/ci_build/Dockerfile.cpu | 10 ++---- tests/ci_build/conda_env/cpu_test.yml | 33 +++++++++++++++++++ .../win64_test.yml} | 0 tests/ci_build/runxgb.sh | 2 ++ tests/ci_build/test_python.sh | 1 + 7 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 tests/ci_build/conda_env/cpu_test.yml rename tests/ci_build/{win64_conda_env.yml => conda_env/win64_test.yml} (100%) diff --git a/Jenkinsfile b/Jenkinsfile index d8309f1fb..d800dbc89 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -159,7 +159,7 @@ def Lint() { def container_type = "cpu" def docker_binary = "docker" sh """ - ${dockerRun} ${container_type} ${docker_binary} make lint + ${dockerRun} ${container_type} ${docker_binary} bash -c "source activate cpu_test && make lint" """ deleteDir() } @@ -173,7 +173,7 @@ def SphinxDoc() { def docker_binary = "docker" def docker_extra_params = "CI_DOCKER_EXTRA_PARAMS_INIT='-e SPHINX_GIT_BRANCH=${BRANCH_NAME}'" sh """#!/bin/bash - ${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} make -C doc html + ${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} bash -c "source activate cpu_test && make -C doc html" """ deleteDir() } diff --git a/Jenkinsfile-win64 b/Jenkinsfile-win64 index 7c9654f6e..3f4611404 100644 --- a/Jenkinsfile-win64 +++ b/Jenkinsfile-win64 @@ -127,7 +127,7 @@ def TestWin64() { bat "build\\testxgboost.exe" echo "Installing Python dependencies..." def env_name = 'win64_' + UUID.randomUUID().toString().replaceAll('-', '') - bat "conda env create -n ${env_name} --file=tests/ci_build/win64_conda_env.yml" + bat "conda env create -n ${env_name} --file=tests/ci_build/conda_env/win64_test.yml" echo "Installing Python wheel..." bat """ conda activate ${env_name} && for /R %%i in (python-package\\dist\\*.whl) DO python -m pip install "%%i" diff --git a/tests/ci_build/Dockerfile.cpu b/tests/ci_build/Dockerfile.cpu index 4dd860a88..bcdf99981 100644 --- a/tests/ci_build/Dockerfile.cpu +++ b/tests/ci_build/Dockerfile.cpu @@ -19,13 +19,9 @@ ENV PATH=/opt/python/bin:$PATH ENV GOSU_VERSION 1.10 -# Install Python packages in default env -RUN \ - pip install pyyaml cpplint pylint astroid sphinx numpy scipy pandas matplotlib sh \ - recommonmark guzzle_sphinx_theme mock breathe graphviz hypothesis\ - pytest scikit-learn wheel kubernetes urllib3 jsonschema boto3 && \ - pip install https://h2o-release.s3.amazonaws.com/datatable/stable/datatable-0.7.0/datatable-0.7.0-cp37-cp37m-linux_x86_64.whl && \ - pip install "dask[complete]" +# Create new Conda environment +COPY conda_env/cpu_test.yml /scripts/ +RUN conda env create -n cpu_test --file=/scripts/cpu_test.yml # Install lightweight sudo (not bound to TTY) RUN set -ex; \ diff --git a/tests/ci_build/conda_env/cpu_test.yml b/tests/ci_build/conda_env/cpu_test.yml new file mode 100644 index 000000000..027a85df1 --- /dev/null +++ b/tests/ci_build/conda_env/cpu_test.yml @@ -0,0 +1,33 @@ +name: cpu_test +channels: +- conda-forge +dependencies: +- python=3.7 +- pip +- wheel +- pyyaml +- cpplint +- pylint +- numpy +- scipy +- scikit-learn +- pandas +- matplotlib +- dask +- python-graphviz +- hypothesis +- astroid +- sphinx +- sh +- recommonmark +- mock +- breathe +- pytest +- python-kubernetes +- urllib3 +- jsonschema +- boto3 +- awscli +- pip: + - guzzle_sphinx_theme + - datatable diff --git a/tests/ci_build/win64_conda_env.yml b/tests/ci_build/conda_env/win64_test.yml similarity index 100% rename from tests/ci_build/win64_conda_env.yml rename to tests/ci_build/conda_env/win64_test.yml diff --git a/tests/ci_build/runxgb.sh b/tests/ci_build/runxgb.sh index 60a9cc68f..4825dccf5 100755 --- a/tests/ci_build/runxgb.sh +++ b/tests/ci_build/runxgb.sh @@ -1,5 +1,7 @@ #!/bin/bash +source activate cpu_test + export DMLC_SUBMIT_CLUSTER=local submit="python3 dmlc-core/tracker/dmlc-submit" diff --git a/tests/ci_build/test_python.sh b/tests/ci_build/test_python.sh index fbd364466..55c3037d0 100755 --- a/tests/ci_build/test_python.sh +++ b/tests/ci_build/test_python.sh @@ -45,6 +45,7 @@ case "$suite" in ;; cpu) + source activate cpu_test install_xgboost pytest -v -s --fulltrace tests/python cd tests/distributed