set task function hook according to

setTaskHook(
  status = c("queued", "draft", "running", "completed", "aborted", "failed"),
  fun
)

getTaskHook(
  status = c("queued", "draft", "running", "completed", "aborted", "failed")
)

Arguments

status

one of "queued", "draft", "running", "completed", "aborted", or "failed".

fun

function it must return a TRUE or FALSE in the end of function body, when it's TRUE this function will also terminate monitor process, if FALSE, function called, but not going to terminate task monitoring process.

Value

object from setHook and getHook.

Examples

getTaskHook("completed")
#> function(...) { #> cat("\r", "completed") #> return(TRUE) #> } #> <environment: 0x7f93442681d0>
setTaskHook("completed", function() { message("completed") return(TRUE) })