Skip to content

Commit 19ba09a

Browse files
Merge branch 'feature/evalFuture' into develop
2 parents 7aef330 + 355ea78 commit 19ba09a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1303
-1006
lines changed

.Rbuildignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Rplots.pdf$
5151
# Package specific
5252
#----------------------------
5353
^[.]BatchJobs[.]R$
54-
[.]future
54+
^[.]future
5555

5656
#----------------------------
5757
# Miscellaneous

.github/workflows/R-CMD-check.yaml

+51-46
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
R-CMD-check:
77
if: "! contains(github.event.head_commit.message, '[ci skip]')"
88

9-
timeout-minutes: 15
10-
9+
timeout-minutes: 30
10+
1111
runs-on: ${{ matrix.config.os }}
1212

1313
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) ${{ matrix.config.label }}
@@ -19,34 +19,41 @@ jobs:
1919
- {os: windows-latest, r: 'devel' }
2020
- {os: windows-latest, r: 'release' }
2121
- {os: windows-latest, r: 'oldrel' }
22-
- {os: macOS-latest, r: 'devel' }
22+
# - {os: macOS-latest, r: 'devel' }
2323
- {os: macOS-latest, r: 'release' }
24-
- {os: macOS-latest, r: 'oldrel' }
25-
- {os: ubuntu-latest, r: 'devel' }
24+
# - {os: macOS-latest, r: 'oldrel' }
25+
# - {os: ubuntu-latest, r: 'devel' }
2626
- {os: ubuntu-latest, r: 'release' }
2727
- {os: ubuntu-latest, r: 'oldrel' }
2828
- {os: ubuntu-latest, r: 'oldrel-1' }
2929
- {os: ubuntu-latest, r: 'oldrel-2' }
3030
- {os: ubuntu-latest, r: '4.0' }
31+
32+
- {os: ubuntu-latest, r: 'release' , availablecores: 1, label: 'availableCores.system=1' }
33+
- {os: ubuntu-latest, r: 'release' , availablecores: 2, label: 'availableCores.system=2' }
3134
- {os: ubuntu-latest, r: 'release' , language: ko, label: ko }
3235
- {os: ubuntu-latest, r: 'release' , language: zh_CN, label: zh_CN }
3336
- {os: ubuntu-latest, r: 'release' , language: zh_TW, label: zh_TW }
34-
37+
3538
env:
3639
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
37-
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
40+
R_KEEP_PKG_SOURCE: yes
3841
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
42+
## Test in other locale (optional)
43+
LANGUAGE: ${{ matrix.config.language }}
44+
## R (>= 4.4.0) Note, no trailing underscore (sic!)
45+
_R_COMPARE_LANG_OBJECTS: eqonly
3946
## R CMD check
4047
_R_CHECK_CRAN_INCOMING_: false
41-
_R_CHECK_LENGTH_1_CONDITION_: true
42-
_R_CHECK_LENGTH_1_LOGIC2_: true
4348
_R_CHECK_MATRIX_DATA_: true
4449
_R_CHECK_SUGGESTS_ONLY_: true
4550
_R_CHECK_THINGS_IN_TEMP_DIR_: true
51+
_R_CHECK_TESTS_NLINES_: 300
4652
RCMDCHECK_ERROR_ON: note
47-
## Test in other locale (optional)
48-
LANGUAGE: ${{ matrix.config.language }}
49-
53+
## Specific to futures
54+
R_PARALLELLY_AVAILABLECORES_SYSTEM: ${{ matrix.config.availablecores }}
55+
R_FUTURE_RNG_ONMISUSE: error
56+
5057
steps:
5158
- uses: actions/checkout@v4
5259

@@ -55,58 +62,56 @@ jobs:
5562
- uses: r-lib/actions/setup-r@v2
5663
with:
5764
r-version: ${{ matrix.config.r }}
58-
59-
- name: Query R package dependencies
60-
run: |
61-
install.packages('remotes')
62-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
63-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
64-
shell: Rscript {0}
65-
66-
- name: Cache R packages
67-
if: runner.os != 'Windows'
68-
uses: actions/cache@v4
65+
http-user-agent: ${{ matrix.config.http-user-agent }}
66+
use-public-rspm: true
67+
68+
- uses: r-lib/actions/setup-r-dependencies@v2
6969
with:
70-
path: ${{ env.R_LIBS_USER }}
71-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
72-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
70+
extra-packages: |
71+
any::rcmdcheck
72+
any::remotes
73+
needs: check
7374

74-
- name: Install R package system dependencies (Linux)
75-
if: runner.os == 'Linux'
76-
env:
77-
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
75+
- name: Install package itself (special case)
7876
run: |
79-
Rscript -e "remotes::install_github('r-hub/sysreqs')"
80-
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
81-
sudo -s eval "$sysreqs"
82-
sudo apt install -y libcurl4-openssl-dev
83-
84-
- name: Install R package dependencies
85-
run: |
86-
remotes::install_deps(dependencies = TRUE)
87-
install.packages(".", repos = NULL, type = "source") ## self vignette engine
88-
shell: Rscript {0}
89-
90-
- name: Install 'rcmdcheck'
91-
run: |
92-
remotes::install_cran("rcmdcheck")
93-
library(rcmdcheck) ## triggers an error, if installation failed
77+
install.packages(".", repos = NULL, type = "source") ## needed by parallel workers
9478
shell: Rscript {0}
9579

9680
- name: Session info
9781
run: |
9882
options(width = 100)
83+
parallelly::availableCores(which = "all")
84+
sapply(c(physical_cores = FALSE, logical_cores = TRUE), parallel::detectCores)
85+
if (require(RhpcBLASctl, quietly=TRUE)) c(get_num_procs = get_num_procs(), get_num_cores = get_num_cores(), blas_get_num_procs = blas_get_num_procs(), omp_get_num_procs = omp_get_num_procs(), omp_get_max_threads = omp_get_max_threads())
9986
capabilities()
10087
pkgs <- installed.packages()[, "Package"]
10188
sessioninfo::session_info(pkgs, include_base = TRUE)
89+
## Verify LANGUAGE settings by generating a translatable error
90+
cat(sprintf("LANGUAGE=%s\n", sQuote(Sys.getenv("LANGUAGE"))))
91+
cat(sprintf("locales: %s\n", sQuote(Sys.getlocale())))
92+
tryCatch(log("a"), error = conditionMessage)
10293
shell: Rscript {0}
10394

10495
- name: Check
96+
if: runner.os != 'Windows'
97+
env:
98+
## FIXME: Eventually update to 'R_FUTURE_GLOBALS_ONREFERENCE=error'
99+
R_FUTURE_GLOBALS_ONREFERENCE: "warning"
100+
R_FUTURE_PLAN: ${{ matrix.config.plan }}
105101
run: |
106102
if (nzchar(Sys.getenv("R_FUTURE_PLAN")) || getRversion() < "3.5.0") Sys.setenv(RCMDCHECK_ERROR_ON = "error")
107103
rcmdcheck::rcmdcheck(
108104
build_args = if (getRversion() < "3.5.0") "--no-build-vignettes",
109-
args = c("--no-manual", "--as-cran", if (.Platform$OS.type == "windows" && getRversion() >= "4.2.0") "--no-multiarch", if (getRversion() < "3.5.0") c("--no-vignettes", "--no-build-vignettes", "--ignore-vignettes")),
105+
args = c("--no-manual", "--as-cran", if (getRversion() < "3.5.0") c("--no-vignettes", "--no-build-vignettes", "--ignore-vignettes")),
106+
check_dir = "check"
107+
)
108+
shell: Rscript {0}
109+
110+
- name: Check (Windows)
111+
if: runner.os == 'Windows'
112+
run: |
113+
rcmdcheck::rcmdcheck(
114+
args = c("--no-manual", "--as-cran", if (.Platform$OS.type == "windows" && getRversion() >= "4.2.0") "--no-multiarch"),
110115
check_dir = "check"
111116
)
112117
shell: Rscript {0}

.github/workflows/future_tests.yaml

+20-29
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ jobs:
66
future_tests:
77
if: "! contains(github.event.head_commit.message, '[ci skip]')"
88

9-
timeout-minutes: 15
9+
timeout-minutes: 30
1010

11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-latest
1212

1313
name: future.plan=${{ matrix.future.plan }}
1414

1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
future:
19-
- { plan: 'future.callr::callr' }
19+
- { plan: 'future.callr::callr' }
2020

2121
env:
2222
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23-
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
2423
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
2524
## R CMD check
26-
_R_CHECK_LENGTH_1_CONDITION_: true
27-
_R_CHECK_LENGTH_1_LOGIC2_: true
2825
_R_CHECK_MATRIX_DATA_: true
2926
_R_CHECK_CRAN_INCOMING_: false
3027
## Specific to futures
@@ -37,41 +34,35 @@ jobs:
3734

3835
- uses: r-lib/actions/setup-r@v2
3936
with:
40-
r-version: release
37+
use-public-rspm: true
4138

42-
- name: Query R package dependencies
43-
run: |
44-
install.packages('remotes')
45-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
46-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
47-
shell: Rscript {0}
48-
49-
- name: Cache R packages
50-
uses: actions/cache@v4
39+
- uses: r-lib/actions/setup-r-dependencies@v2
5140
with:
52-
path: ${{ env.R_LIBS_USER }}
53-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
54-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
41+
extra-packages: |
42+
any::rcmdcheck
43+
any::remotes
44+
any::sessioninfo
45+
any::covr
46+
needs: check
5547

56-
- name: Install R package system dependencies (Linux)
57-
if: runner.os == 'Linux'
58-
env:
59-
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
48+
- name: Install dependencies
6049
run: |
61-
Rscript -e "remotes::install_github('r-hub/sysreqs')"
62-
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
63-
sudo -s eval "$sysreqs"
50+
remotes::install_deps(dependencies = TRUE)
51+
install.packages(".", repos=NULL, type="source")
52+
shell: Rscript {0}
6453

65-
- name: Install R package dependencies
54+
- name: Session info
6655
run: |
67-
remotes::install_deps(dependencies = TRUE)
68-
install.packages(".", repos=NULL, type="source") ## needed by parallel workers
56+
options(width = 100)
57+
pkgs <- installed.packages()[, "Package"]
58+
sessioninfo::session_info(pkgs, include_base = TRUE)
6959
shell: Rscript {0}
7060

7161
- name: Install 'future.tests' and any backend R packages
7262
run: |
7363
remotes::install_cran("future.tests")
7464
remotes::install_github("HenrikBengtsson/future.tests", ref="develop")
65+
if (grepl("::", plan <- "${{ matrix.future.plan }}") && nzchar(pkg <- sub("::.*", "", plan))) install.packages(pkg)
7566
shell: Rscript {0}
7667

7768
- name: Session info

.github/workflows/test-coverage.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ jobs:
2626

2727
- uses: r-lib/actions/setup-r-dependencies@v2
2828
with:
29-
extra-packages: any::covr, any::xml2
29+
extra-packages: |
30+
any::covr
31+
any::xml2
32+
any::remotes
3033
needs: coverage
3134

32-
- name: Install itself
35+
- name: Install package itself (special case)
3336
run: |
3437
install.packages(".", repos = NULL, type = "source")
3538
shell: Rscript {0}

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
# Contributing to the 'future.callr' package
33

4-
This Git repository uses the [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/) branching model (the [`git flow`](https://github.com/petervanderdoes/gitflow-avh) extension is useful for this). The [`develop`](https://github.com/HenrikBengtsson/future.callr/tree/develop) branch contains the latest contributions and other code that will appear in the next release, and the [`master`](https://github.com/HenrikBengtsson/future.callr) branch contains the code of the latest release, which is exactly what is currently on [CRAN](https://cran.r-project.org/package=future.callr).
4+
This Git repository uses the [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/) branching model (the [`git flow`](https://github.com/petervanderdoes/gitflow-avh) extension is useful for this). The [`develop`](https://github.com/futureverse/future.callr/tree/develop) branch contains the latest contributions and other code that will appear in the next release, and the [`master`](https://github.com/futureverse/future.callr) branch contains the code of the latest release, which is exactly what is currently on [CRAN](https://cran.r-project.org/package=future.callr).
55

6-
Contributing to this package is easy. Just send a [pull request](https://help.github.com/articles/using-pull-requests/). When you send your PR, make sure `develop` is the destination branch on the [future.callr repository](https://github.com/HenrikBengtsson/future.callr). Your PR should pass `R CMD check --as-cran`, which will also be checked by <a href="https://github.com/HenrikBengtsson/future.callr/actions?query=workflow%3AR-CMD-check">GitHub Actions</a> and when the PR is submitted.
6+
Contributing to this package is easy. Just send a [pull request](https://help.github.com/articles/using-pull-requests/). When you send your PR, make sure `develop` is the destination branch on the [future.callr repository](https://github.com/futureverse/future.callr). Your PR should pass `R CMD check --as-cran`, which will also be checked by <a href="https://github.com/futureverse/future.callr/actions?query=workflow%3AR-CMD-check">GitHub Actions</a> and when the PR is submitted.
77

88
We abide to the [Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/) of Contributor Covenant.

DESCRIPTION

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
Package: future.callr
2-
Version: 0.8.2-9004
2+
Version: 0.8.2-9206
33
Depends:
44
R (>= 3.4.0),
5-
future (>= 1.33.0)
5+
future (>= 1.40.0)
66
Imports:
7-
callr (>= 2.0.3)
7+
parallelly,
8+
callr
89
Suggests:
910
globals,
1011
future.apply,
@@ -23,5 +24,6 @@ License: LGPL (>= 2.1)
2324
LazyLoad: TRUE
2425
URL: https://future.callr.futureverse.org, https://github.com/futureverse/future.callr
2526
BugReports: https://github.com/futureverse/future.callr/issues
27+
Encoding: UTF-8
2628
RoxygenNote: 7.3.2
2729
Roxygen: list(markdown = TRUE)

NAMESPACE

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
S3method(getExpression,CallrFuture)
4-
S3method(nbrOfFreeWorkers,callr)
3+
S3method(interruptFuture,CallrFutureBackend)
4+
S3method(launchFuture,CallrFutureBackend)
5+
S3method(nbrOfFreeWorkers,CallrFutureBackend)
6+
S3method(nbrOfWorkers,CallrFutureBackend)
57
S3method(print,CallrFuture)
68
S3method(resolved,CallrFuture)
79
S3method(result,CallrFuture)
8-
S3method(run,CallrFuture)
9-
export(CallrFuture)
10+
S3method(stopWorkers,CallrFutureBackend)
11+
export(CallrFutureBackend)
1012
export(CallrFutureError)
1113
export(callr)
1214
importFrom(callr,r_bg)
15+
importFrom(future,Future)
16+
importFrom(future,FutureBackend)
1317
importFrom(future,FutureError)
18+
importFrom(future,FutureInterruptError)
1419
importFrom(future,FutureWarning)
15-
importFrom(future,MultiprocessFuture)
1620
importFrom(future,UnexpectedFutureResultError)
17-
importFrom(future,availableCores)
18-
importFrom(future,getExpression)
19-
importFrom(future,getGlobalsAndPackages)
21+
importFrom(future,interrupt)
22+
importFrom(future,interruptFuture)
23+
importFrom(future,launchFuture)
2024
importFrom(future,nbrOfFreeWorkers)
2125
importFrom(future,nbrOfWorkers)
2226
importFrom(future,resolved)
2327
importFrom(future,result)
2428
importFrom(future,run)
29+
importFrom(future,stopWorkers)
30+
importFrom(parallelly,availableCores)
31+
importFrom(parallelly,killNode)
2532
importFrom(utils,capture.output)
26-
importFrom(utils,globalVariables)
2733
importFrom(utils,str)
2834
importFrom(utils,tail)

NEWS.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Version (development version)
22

3-
* ...
3+
## New Features
4+
5+
* Now 'callr' futures can be interrupted using `interrupt()`.
6+
An interrupted future can be `reset()` and relaunched.
7+
8+
* A future that failed due to the 'callr' worker process was
9+
terminated is now considerred interrupted, which for instance
10+
means that it can be `reset()`.
411

512

613
# Version 0.8.2 [2023-08-08]

R/001.bquote.R

-5
This file was deleted.

0 commit comments

Comments
 (0)