Skip to content

Commit

Permalink
conditional message
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Sep 21, 2023
1 parent 32cc3c1 commit eb3989b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 21 deletions.
16 changes: 9 additions & 7 deletions R/crew_controller_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ crew_controller_local <- function(
garbage_collection = FALSE,
launch_max = 5L
) {
crew_deprecate(
name = "seconds_exit",
date = "2023-09-21",
version = "0.5.0.9002",
alternative = "none (no longer necessary)",
condition = "message"
)
if (!is.null(seconds_exit)) {
crew_deprecate(
name = "seconds_exit",
date = "2023-09-21",
version = "0.5.0.9002",
alternative = "none (no longer necessary)",
condition = "message"
)
}
client <- crew_client(
name = name,
workers = workers,
Expand Down
16 changes: 9 additions & 7 deletions R/crew_launcher.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ crew_launcher <- function(
launch_max = 5L,
tls = crew::crew_tls()
) {
crew_deprecate(
name = "seconds_exit",
date = "2023-09-21",
version = "0.5.0.9002",
alternative = "none (no longer necessary)",
condition = "message"
)
if (!is.null(seconds_exit)) {
crew_deprecate(
name = "seconds_exit",
date = "2023-09-21",
version = "0.5.0.9002",
alternative = "none (no longer necessary)",
condition = "message"
)
}
name <- as.character(name %|||% crew_random_name())
crew_assert(
inherits(tls, "crew_class_tls"),
Expand Down
16 changes: 9 additions & 7 deletions R/crew_launcher_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ crew_launcher_local <- function(
launch_max = 5L,
tls = crew::crew_tls()
) {
crew_deprecate(
name = "seconds_exit",
date = "2023-09-21",
version = "0.5.0.9002",
alternative = "none (no longer necessary)",
condition = "message"
)
if (!is.null(seconds_exit)) {
crew_deprecate(
name = "seconds_exit",
date = "2023-09-21",
version = "0.5.0.9002",
alternative = "none (no longer necessary)",
condition = "message"
)
}
name <- as.character(name %|||% crew_random_name())
launcher <- crew_class_launcher_local$new(
name = name,
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-crew_controller_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,14 @@ crew_test("map() does not need an empty controller", {
expect_equal(x$schedule$summary()$pushed, 0L)
expect_equal(x$schedule$summary()$collected, 1L)
})

crew_test("deprecate seconds_exit", {
expect_message(
x <- crew_controller_local(
workers = 1L,
seconds_idle = 360,
seconds_exit = 1
),
class = "crew_deprecate"
)
})
4 changes: 4 additions & 0 deletions tests/testthat/test-crew_launcher.R
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,7 @@ crew_test("custom launcher", {
expect_equal(out$launches, 1L)
controller$terminate()
})

crew_test("deprecate seconds_exit", {
expect_message(crew_launcher(seconds_exit = 1), class = "crew_deprecate")
})
7 changes: 7 additions & 0 deletions tests/testthat/test-crew_launcher_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,10 @@ crew_test("crew_launcher_local() can run a task and end a worker", {
seconds_timeout = 5
)
})

crew_test("deprecate seconds_exit", {
expect_message(
crew_launcher_local(seconds_exit = 1),
class = "crew_deprecate"
)
})

0 comments on commit eb3989b

Please sign in to comment.