Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
cb4972ee
Unverified
Commit
cb4972ee
authored
Mar 18, 2024
by
Oliver Borchert
Committed by
GitHub
Mar 17, 2024
Browse files
[ci] Fix R 3.6 tests, dask tests, compatibility with dask>=2024.3.1 (#6357)
parent
b27d81ea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
11 deletions
+30
-11
.ci/test.sh
.ci/test.sh
+3
-3
.ci/test_r_package.sh
.ci/test_r_package.sh
+2
-0
.ci/test_r_package_windows.ps1
.ci/test_r_package_windows.ps1
+5
-1
.github/workflows/r_package.yml
.github/workflows/r_package.yml
+1
-2
python-package/lightgbm/compat.py
python-package/lightgbm/compat.py
+11
-1
tests/python_package_test/test_dask.py
tests/python_package_test/test_dask.py
+8
-4
No files found.
.ci/test.sh
View file @
cb4972ee
...
...
@@ -126,9 +126,9 @@ fi
# older versions of Dask are incompatible with pandas>=2.0, but not all conda packages' metadata accurately reflects that
#
# ref: https://github.com/microsoft/LightGBM/issues/6030
CONSTRAINED_DEPENDENCIES
=
"'dask
-core
>=2023.5.0' 'distributed>=2023.5.0' 'pandas>=2.0'"
CONSTRAINED_DEPENDENCIES
=
"'dask>=2023.5.0' 'distributed>=2023.5.0' 'pandas>=2.0'"
if
[[
$PYTHON_VERSION
==
"3.7"
]]
;
then
CONSTRAINED_DEPENDENCIES
=
"'dask
-core
' 'distributed' 'pandas<2.0'"
CONSTRAINED_DEPENDENCIES
=
"'dask' 'distributed' 'pandas<2.0'"
fi
# including python=version[build=*cpython] to ensure that conda doesn't fall back to pypy
...
...
@@ -322,7 +322,7 @@ matplotlib.use\(\"Agg\"\)\
# importing the library should succeed even if all optional dependencies are not present
conda uninstall
-n
$CONDA_ENV
--force
--yes
\
cffi
\
dask
-core
\
dask
\
distributed
\
joblib
\
matplotlib
\
...
...
.ci/test_r_package.sh
View file @
cb4972ee
...
...
@@ -81,6 +81,8 @@ fi
# Installing R precompiled for Mac OS 10.11 or higher
if
[[
$OS_NAME
==
"macos"
]]
;
then
brew update-reset
--auto-update
brew update
--auto-update
if
[[
$R_BUILD_TYPE
==
"cran"
]]
;
then
brew
install
automake
||
exit
1
fi
...
...
.ci/test_r_package_windows.ps1
View file @
cb4972ee
...
...
@@ -91,7 +91,11 @@ if ($env:R_MAJOR_VERSION -eq "3") {
$
env
:
R_LIB_PATH
=
"
$
env
:
BUILD_SOURCESDIRECTORY
/RLibrary"
-replace
'[\\]'
,
'/'
$
env
:
R_LIBS
=
"
$
env
:
R_LIB_PATH
"
$
env
:
PATH
=
"
$
env
:
RTOOLS_BIN
;"
+
"
$
env
:
RTOOLS_MINGW_BIN
;"
+
"
$
env
:
R_LIB_PATH
/R/bin/x64;"
+
$
env
:
PATH
$
env
:
CRAN_MIRROR
=
"https://cran.rstudio.com"
if
([
version
]
$
env
:
R_VERSION
-lt
[
version
]
"4.0"
)
{
$
env
:
CRAN_MIRROR
=
"https://cran-archive.r-project.org"
}
else
{
$
env
:
CRAN_MIRROR
=
"https://cran.rstudio.com"
}
$
env
:
MIKTEX_EXCEPTION_PATH
=
"
$
env
:
TEMP
\miktex"
# don't fail builds for long-running examples unless they're very long.
...
...
.github/workflows/r_package.yml
View file @
cb4972ee
...
...
@@ -275,7 +275,6 @@ jobs:
clang-version
:
-
16
-
17
-
18
runs-on
:
ubuntu-latest
container
:
rhub/debian-clang-devel
env
:
...
...
@@ -316,7 +315,7 @@ jobs:
all-r-package-jobs-successful
:
if
:
always()
runs-on
:
ubuntu-latest
needs
:
[
test
,
test-r-sanitizers
,
test-r-debian-clang
]
needs
:
[
test
,
test-r-debian-clang
]
steps
:
-
name
:
Note that all tests succeeded
uses
:
re-actors/alls-green@v1.2.2
...
...
python-package/lightgbm/compat.py
View file @
cb4972ee
...
...
@@ -164,7 +164,17 @@ try:
from
dask.distributed
import
Client
,
Future
,
default_client
,
wait
DASK_INSTALLED
=
True
except
ImportError
:
# catching 'ValueError' here because of this:
# https://github.com/microsoft/LightGBM/issues/6365#issuecomment-2002330003
#
# That's potentially risky as dask does some significant import-time processing,
# like loading configuration from environment variables and files, and catching
# ValueError here might hide issues with that config-loading.
#
# But in exchange, it's less likely that 'import lightgbm' will fail for
# dask-related reasons, which is beneficial for any workloads that are using
# lightgbm but not its Dask functionality.
except
(
ImportError
,
ValueError
):
DASK_INSTALLED
=
False
dask_array_from_delayed
=
None
# type: ignore[assignment]
...
...
tests/python_package_test/test_dask.py
View file @
cb4972ee
...
...
@@ -213,13 +213,17 @@ def _create_data(objective, n_samples=1_000, output="array", chunk_size=500, **k
def
_r2_score
(
dy_true
,
dy_pred
):
numerator
=
((
dy_true
-
dy_pred
)
**
2
).
sum
(
axis
=
0
,
dtype
=
np
.
float64
)
denominator
=
((
dy_true
-
dy_true
.
mean
(
axis
=
0
))
**
2
).
sum
(
axis
=
0
,
dtype
=
np
.
float64
)
return
(
1
-
numerator
/
denominator
).
compute
()
y_true
=
dy_true
.
compute
()
y_pred
=
dy_pred
.
compute
()
numerator
=
((
y_true
-
y_pred
)
**
2
).
sum
(
axis
=
0
)
denominator
=
((
y_true
-
y_true
.
mean
(
axis
=
0
))
**
2
).
sum
(
axis
=
0
)
return
1
-
numerator
/
denominator
def
_accuracy_score
(
dy_true
,
dy_pred
):
return
da
.
average
(
dy_true
==
dy_pred
).
compute
()
y_true
=
dy_true
.
compute
()
y_pred
=
dy_pred
.
compute
()
return
(
y_true
==
y_pred
).
mean
()
def
_constant_metric
(
y_true
,
y_pred
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment