Skip to content

Commit

Permalink
migrate assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Sep 18, 2023
1 parent 1fabc4f commit 0e0c169
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Description: In computationally demanding analysis projects,
'clustermq' by Schubert (2019) <doi:10.1093/bioinformatics/btz284>),
and 'batchtools' by Lang, Bischel, and Surmann (2017)
<doi:10.21105/joss.00135>.
Version: 0.5.0
Version: 0.5.0.9000
License: MIT + file LICENSE
URL: https://wlandau.github.io/crew/, https://github.com/wlandau/crew
BugReports: https://github.com/wlandau/crew/issues
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# crew 0.5.0.9000

* Migrate checks to enforce features in version 0.5.0 for reverse dependencies.

# crew 0.5.0

* Suppress interactive browser on Windows which launched on each worker previously (@psychelzh).
Expand Down
12 changes: 3 additions & 9 deletions R/crew_client.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,20 @@ crew_client <- function(
seconds_interval = 0.25,
seconds_timeout = 10
) {
# TODO: turn these into warnings:
if (!is.null(tls_enable)) {
crew_deprecate(
name = "tls_enable",
date = "2023-09-15",
version = "0.4.1",
alternative = "argument tls and function crew_tls()",
condition = "message"
alternative = "argument tls and function crew_tls()"
)
}
if (!is.null(tls_config)) {
crew_deprecate(
name = "tls_config",
date = "2023-09-15",
version = "0.4.1",
alternative = "argument tls and function crew_tls()",
condition = "message"
alternative = "argument tls and function crew_tls()"
)
}
name <- as.character(name %|||% crew_random_name())
Expand Down Expand Up @@ -214,16 +211,13 @@ crew_class_client <- R6::R6Class(
self$host,
self$port
)
get_password <- function() {
self$tls$password
}
mirai::daemons(
n = self$workers,
url = url,
dispatcher = TRUE,
seed = NULL,
tls = self$tls$client(),
pass = get_password(),
pass = self$tls$password,
token = TRUE,
.compute = self$name
)
Expand Down
22 changes: 7 additions & 15 deletions R/crew_launcher.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ crew_class_launcher <- R6::R6Class(
"seconds_wall",
"seconds_exit",
"tasks_max",
"tasks_timers"
# TODO: add launch_max
"tasks_timers",
"launch_max"
)
for (field in fields) {
crew_assert(
Expand Down Expand Up @@ -297,13 +297,10 @@ crew_class_launcher <- R6::R6Class(
crew_assert(identical(colnames(self$workers), cols))
crew_assert(nrow(self$workers) > 0L)
}
# TODO: forbid NULL tls objects:
if (!is.null(self$tls)) {
crew_assert(
inherits(self$tls, "crew_class_tls"),
message = "field tls must be an object created by crew_tls()"
)
}
crew_assert(
inherits(self$tls, "crew_class_tls"),
message = "field tls must be an object created by crew_tls()"
)
invisible()
},
#' @description List of arguments for `mirai::daemon()`.
Expand All @@ -324,12 +321,7 @@ crew_class_launcher <- R6::R6Class(
timerstart = self$tasks_timers,
exitlinger = self$seconds_exit * 1000,
cleanup = cleanup,
# TODO: always use tls objects:
tls = if_any(
is.null(self$tls),
NULL,
self$tls$worker(name = self$name)
),
tls = self$tls$worker(name = self$name),
rs = mirai::nextstream(self$name)
)
},
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-crew_client.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ crew_test("crew_client() works", {
})

crew_test("crew_client() deprecate tls_enable", {
expect_message(
expect_warning(
crew_client(host = "127.0.0.1", tls_enable = TRUE),
class = "crew_deprecate"
)
})

crew_test("crew_client() deprecate tls_config", {
expect_message(
expect_warning(
crew_client(host = "127.0.0.1", tls_config = list()),
class = "crew_deprecate"
)
Expand Down

0 comments on commit 0e0c169

Please sign in to comment.