Skip to content

Commit 1e7dad2

Browse files
authored
address Timing stopped at exit handler on engine fit (#1117)
1 parent 853d814 commit 1e7dad2

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

R/fit_helpers.R

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,26 @@ form_form <-
4444
spec = object
4545
)
4646

47-
elapsed <- system.time(
48-
res$fit <- eval_mod(
49-
fit_call,
50-
capture = control$verbosity == 0,
51-
catch = control$catch,
52-
envir = env,
53-
...
54-
),
55-
gcFirst = FALSE
47+
time <- proc.time()
48+
res$fit <- eval_mod(
49+
fit_call,
50+
capture = control$verbosity == 0,
51+
catch = control$catch,
52+
envir = env,
53+
...
5654
)
55+
elapsed <- proc.time() - time
5756
res$preproc <- list(y_var = all.vars(rlang::f_lhs(env$formula)))
5857
res$elapsed <- list(elapsed = elapsed, print = control$verbosity > 1L)
5958

6059
res
6160
}
6261

63-
xy_xy <- function(object,
64-
env,
65-
control,
66-
target = "none",
67-
...,
62+
xy_xy <- function(object,
63+
env,
64+
control,
65+
target = "none",
66+
...,
6867
call = rlang::caller_env()) {
6968

7069
if (inherits(env$x, "tbl_spark") | inherits(env$y, "tbl_spark"))
@@ -97,16 +96,15 @@ xy_xy <- function(object,
9796

9897
res <- list(lvl = levels(env$y), spec = object)
9998

100-
elapsed <- system.time(
101-
res$fit <- eval_mod(
102-
fit_call,
103-
capture = control$verbosity == 0,
104-
catch = control$catch,
105-
envir = env,
106-
...
107-
),
108-
gcFirst = FALSE
99+
time <- proc.time()
100+
res$fit <- eval_mod(
101+
fit_call,
102+
capture = control$verbosity == 0,
103+
catch = control$catch,
104+
envir = env,
105+
...
109106
)
107+
elapsed <- proc.time() - time
110108

111109
if (is.atomic(env$y)) {
112110
y_name <- character(0)

0 commit comments

Comments
 (0)