Learn R Programming

languageserver (version 0.3.10)

Session: Single R Session for Session Pool

Description

Single R Session for Session Pool

Arguments

Examples

Run this code
# NOT RUN {
# create a session and bind to a session pool
# this step is done in SessionPool$new()
session <- Session$new("session id", parent_pool_ptr, pool_name)

# task acquire a session from session pool
# this step is done in SessionPool$acquire()

# start task
session$start(target, args)

# check session result with is_alive
session$is_alive()

# when task is running
session$is_alive() == TRUE

# when task is done
session$is_alive() == FALSE

# get result when task is done
session$get_result()

# session must be released when task is done
session$release()

#' # use restart() to restart session
session$restart()

# use kill() to restart and release session
session$kill()

# session will be restarted on error
# you can manually <U+201C>kill<U+201D> the process in bash to test this behavior
# }

Run the code above in your browser using DataLab