rave-session: Create, register, list, and remove 'RAVE' sessions

rave-sessionR Documentation

Create, register, list, and remove 'RAVE' sessions

Description

Create, register, list, and remove 'RAVE' sessions

Usage

new_session(update = FALSE)

use_session(x)

launch_session(
  x,
  host = "127.0.0.1",
  port = NULL,
  options = list(jupyter = TRUE, jupyter_port = NULL, as_job = TRUE, launch_browser =
    TRUE, single_session = FALSE)
)

session_getopt(keys, default = NA, namespace = "default")

session_setopt(..., .list = NULL, namespace = "default")

remove_session(x)

remove_all_sessions()

list_session(path = session_root(), order = c("none", "ascend", "descend"))

start_session(
  session,
  new = NA,
  host = "127.0.0.1",
  port = NULL,
  jupyter = NA,
  jupyter_port = NULL,
  as_job = TRUE,
  launch_browser = TRUE,
  single_session = FALSE
)

shutdown_session(
  returnValue = invisible(),
  session = shiny::getDefaultReactiveDomain()
)

Arguments

update

logical, whether to update to latest 'RAVE' template

host

host 'IP' address, default is 'localhost'

port

port to listen

options

additional options, including jupyter, jupyter_port, as_job, and launch_browser

keys

vector of characters, one or more keys of which the values should be obtained

default

default value if key is missing

namespace

namespace of the option; default is 'default'

..., .list

named list of key-value pairs of session options. The keys must be characters, and values must be simple data types (such as numeric vectors, characters)

path

root path to store the sessions; default is the "tensor_temp_path" in raveio_getopt

order

whether to order the session by date created; choices are 'none' (default), 'ascend', 'descend'

session, x

session identification string, or session object; use list_session to list all existing sessions

new

whether to create a new session instead of using the most recent one, default is false

jupyter

logical, whether to launch 'jupyter' instance as well. It requires additional setups to enable 'jupyter' lab

jupyter_port

port used by 'jupyter' lab, can be set by 'jupyter_port' option in raveio_setopt

as_job

whether to launch the application as 'RStudio' job, default is true if 'RStudio' is detected; when running without 'RStudio', this option is always false

launch_browser

whether to launch browser, default is true

single_session

whether to enable single-session mode. Under this mode, closing the main frame will terminate 'RAVE' run-time session, otherwise the 'RAVE' instance will still open in the background

returnValue

passed to stopApp

Value

new_session

returns a session object with character 'session_id' and a function 'launch_session' to launch the application from this session

use_session

returns a session object, the same as new_session under the condition that corresponding session exists, or raise an error if the session is missing

list_session

returns a list of all existing session objects under the session root

remove_session

returns a logical whether the corresponding session has been found and removed

Examples


if(interactive()){

  sess <- new_session()
  sess$launch_session()

  all_sessions <- list_session()
  print(all_sessions)

  # Use existing session
  session_id <- all_sessions[[1]]$session_id
  sess <- use_session(session_id)
  sess$launch_session()

  # Remove session
  remove_session(session_id)
  list_session()
}


ravedash documentation built on Oct. 16, 2022, 1:06 a.m.