timeout

0th

Percentile

timeout

This function limits the cpu time spent on single model fitting. It simply sets the killing process of itself to sleep for chosen number of seconds. Shouldn't be called from R console. The function is not used under Windows OS.

Keywords
methods, error
Usage
timeout(expr, seconds, my.pid)
Arguments
expr
Expression to be time limited
seconds
Number of seconds
my.pid
Process PID
Aliases
  • timeout
Examples
## The function is currently defined as
function (expr, seconds, my.pid) 
{
    killer.pid <- system(intern = TRUE, paste("(sleep", seconds, 
        "; kill -9", my.pid, ")>/dev/null&
 echo $!", sep = ""))
    on.exit(system(paste("kill", killer.pid, "> /dev/null 2>&1", 
        sep = "")))
    withCallingHandlers(expr, interrupt = function(...) {
        stop("Timedout", call. = FALSE)
    })
  }
Documentation reproduced from package fscaret, version 0.8.5.1, License: GPL-2 | GPL-3

Community examples

Looks like there are no examples yet.