Unverified Commit f38f118c authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] fix partial matching of keyword arguments in lgb.cv() (fixes #3629) (#3630)

* [ci] [R-package] fix issue with partial argument name matches

* fix partial name matches

* simpler NOTE check

* change conditions

* simplify
parent bcdf1162
...@@ -11,6 +11,15 @@ export PATH="$R_LIB_PATH/R/bin:$PATH" ...@@ -11,6 +11,15 @@ export PATH="$R_LIB_PATH/R/bin:$PATH"
# https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html # https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html
export _R_CHECK_SYSTEM_CLOCK_=0 export _R_CHECK_SYSTEM_CLOCK_=0
# ignore R CMD CHECK NOTE checking how long it has
# been since the last submission
export _R_CHECK_CRAN_INCOMING_REMOTE_=0
# CRAN ignores the "installed size is too large" NOTE,
# so our CI can too. Setting to a large value here just
# to catch extreme problems
export _R_CHECK_PKG_SIZES_THRESHOLD_=60
# Get details needed for installing R components # Get details needed for installing R components
R_MAJOR_VERSION=( ${R_VERSION//./ } ) R_MAJOR_VERSION=( ${R_VERSION//./ } )
if [[ "${R_MAJOR_VERSION}" == "3" ]]; then if [[ "${R_MAJOR_VERSION}" == "3" ]]; then
...@@ -181,19 +190,8 @@ if [[ $check_succeeded == "no" ]]; then ...@@ -181,19 +190,8 @@ if [[ $check_succeeded == "no" ]]; then
exit -1 exit -1
fi fi
if grep -q -R "WARNING" "$LOG_FILE_NAME"; then if grep -q -E "NOTE|WARNING|ERROR" "$LOG_FILE_NAME"; then
echo "WARNINGS have been found by R CMD check!" echo "NOTEs, WARNINGs, or ERRORs have been found by R CMD check"
exit -1
fi
ALLOWED_CHECK_NOTES=2
NUM_CHECK_NOTES=$(
cat ${LOG_FILE_NAME} \
| grep -e '^Status: .* NOTE.*' \
| sed 's/[^0-9]*//g'
)
if [[ ${NUM_CHECK_NOTES} -gt ${ALLOWED_CHECK_NOTES} ]]; then
echo "Found ${NUM_CHECK_NOTES} NOTEs from R CMD check. Only ${ALLOWED_CHECK_NOTES} are allowed"
exit -1 exit -1
fi fi
......
...@@ -62,6 +62,15 @@ $env:CTAN_PACKAGE_ARCHIVE = "$env:CTAN_MIRROR/tm/packages/" ...@@ -62,6 +62,15 @@ $env:CTAN_PACKAGE_ARCHIVE = "$env:CTAN_MIRROR/tm/packages/"
# https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html # https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html
$env:_R_CHECK_SYSTEM_CLOCK_ = 0 $env:_R_CHECK_SYSTEM_CLOCK_ = 0
# ignore R CMD CHECK NOTE checking how long it has
# been since the last submission
$env:_R_CHECK_CRAN_INCOMING_REMOTE_ = 0
# CRAN ignores the "installed size is too large" NOTE,
# so our CI can too. Setting to a large value here just
# to catch extreme problems
$env:_R_CHECK_PKG_SIZES_THRESHOLD_ = 60
if (($env:COMPILER -eq "MINGW") -and ($env:R_BUILD_TYPE -eq "cmake")) { if (($env:COMPILER -eq "MINGW") -and ($env:R_BUILD_TYPE -eq "cmake")) {
$env:CXX = "$env:RTOOLS_MINGW_BIN/g++.exe" $env:CXX = "$env:RTOOLS_MINGW_BIN/g++.exe"
$env:CC = "$env:RTOOLS_MINGW_BIN/gcc.exe" $env:CC = "$env:RTOOLS_MINGW_BIN/gcc.exe"
...@@ -156,23 +165,11 @@ if ($env:COMPILER -ne "MSVC") { ...@@ -156,23 +165,11 @@ if ($env:COMPILER -ne "MSVC") {
Check-Output $check_succeeded Check-Output $check_succeeded
Write-Output "Looking for issues with R CMD check results" Write-Output "Looking for issues with R CMD check results"
if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "ERROR" -CaseSensitive -Quiet) { if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "NOTE|WARNING|ERROR" -CaseSensitive -Quiet) {
echo "ERRORs have been found by R CMD check!" echo "NOTEs, WARNINGs, or ERRORs have been found by R CMD check"
Check-Output $False
}
if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -CaseSensitive -Quiet) {
echo "WARNINGS have been found by R CMD check!"
Check-Output $False Check-Output $False
} }
$note_str = Get-Content -Path "${LOG_FILE_NAME}" | Select-String -Pattern '.*Status.* NOTE' | Out-String ; Check-Output $?
$relevant_line = $note_str -match '(\d+) NOTE'
$NUM_CHECK_NOTES = $matches[1]
$ALLOWED_CHECK_NOTES = 2
if ([int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES) {
Write-Output "Found ${NUM_CHECK_NOTES} NOTEs from R CMD check. Only ${ALLOWED_CHECK_NOTES} are allowed"
Check-Output $False
}
} else { } else {
$env:TMPDIR = $env:USERPROFILE # to avoid warnings about incremental builds inside a temp directory $env:TMPDIR = $env:USERPROFILE # to avoid warnings about incremental builds inside a temp directory
$INSTALL_LOG_FILE_NAME = "$env:BUILD_SOURCESDIRECTORY\00install_out.txt" $INSTALL_LOG_FILE_NAME = "$env:BUILD_SOURCESDIRECTORY\00install_out.txt"
......
...@@ -317,8 +317,8 @@ lgb.cv <- function(params = list() ...@@ -317,8 +317,8 @@ lgb.cv <- function(params = list()
# set up training set # set up training set
indexDT <- data.table::data.table( indexDT <- data.table::data.table(
indices = train_indices indices = train_indices
, weight = getinfo(data = data, name = "weight")[train_indices] , weight = getinfo(dataset = data, name = "weight")[train_indices]
, init_score = getinfo(data = data, name = "init_score")[train_indices] , init_score = getinfo(dataset = data, name = "init_score")[train_indices]
) )
data.table::setorderv(x = indexDT, cols = "indices", order = 1L) data.table::setorderv(x = indexDT, cols = "indices", order = 1L)
dtrain <- slice(data, indexDT$indices) dtrain <- slice(data, indexDT$indices)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment