Skip to content

Commit 883996a

Browse files
committed
more misc dev. utils
1 parent e71d689 commit 883996a

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

tools/experimental-utils.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,11 @@ py_str.docstring_parser.common.DocstringParam <- function(x) {
108108
d[-1] %<>% paste("#' ", .)
109109
writeLines(d)
110110
}
111+
112+
113+
maybe_rename <- function(x, ...) {
114+
spec <- list(...)
115+
i <- names(x) %in% spec
116+
names(x)[i] <- names(spec)[spec == names(x)[i]]
117+
x
118+
}

tools/install-nightly.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#! /usr/bin/env Rscript
2+
3+
4+
5+
for (nm in c("tf-nightly", "tf-nightly-cpu"))
6+
keras::install_keras(
7+
version = nm,
8+
envname = nm,
9+
method = "conda",
10+
restart_session = FALSE
11+
)

tools/setup-test-envs.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#! /usr/bin/env Rscript
22

3-
if(FALSE) # fresh start
3+
args <- commandArgs(TRUE)
4+
5+
if("--fresh" %in% args) # fresh start
46
unlink(reticulate::miniconda_path(), recursive = TRUE)
57

6-
vers <- c("2.1", "2.2", "2.3", "2.4", "2.5", "2.6.0rc2", "nightly")
8+
vers <- c("2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "nightly")
79
vers <- paste0(vers, "-cpu")
810

911
names(vers) <- paste0("tf-", vers)
1012
names(vers) <- sub(".0rc[0-9]+", "", names(vers))
1113

14+
1215
if(!reticulate:::miniconda_exists())
1316
reticulate::install_miniconda()
1417

tools/test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export TF_CPP_MIN_LOG_LEVEL=2
1010
# 3 = INFO, WARNING, and ERROR messages are not printed
1111

1212

13-
for i in {1..7}
13+
for i in 2.{1..6} nightly
1414
do
15-
TMPDIR="/tmp/r-keras-tests/tf-2.$i/"
15+
TMPDIR="/tmp/r-keras-tests/tf-$i/"
1616
mkdir -p $TMPDIR
1717
rsync -a --delete . $TMPDIR
18-
gnome-terminal --title="keras test: tf 2.$i" --working-directory=$TMPDIR -- \
19-
Rscript -e "{options(error=recover); cat('\n\n\n'); reticulate::use_miniconda('tf-2.$i-cpu', required=TRUE); devtools::test(); scan('stdin', nlines=1)}"
18+
gnome-terminal --title="keras test: tf $i" --working-directory=$TMPDIR -- \
19+
Rscript -e "{options(error=recover); cat('\n\n\n'); reticulate::use_miniconda('tf-$i-cpu', required=TRUE); devtools::test(); scan('stdin', nlines=1)}"
2020
# Rscript -e "{cat('\n\n\n'); }"
2121
done

0 commit comments

Comments
 (0)