replay: Replay part or all of an experiment

Description Usage Arguments Details See Also Examples

View source: R/betr.R

Description

replay plays back an experiment using records stored on disk. All requests from clients, and all commands issued on the command line, will be replayed. Afterwards the experiment can be continued.

Usage

1
2
replay(experiment, folder = NULL, maxtime = Inf, speed = NULL,
  ask = FALSE, live = FALSE, clients = NULL)

Arguments

experiment

an object of class Experiment

folder

which record to use. Default is the current session or the most recent session found

maxtime

replay only 'maxtime' seconds of the original session

speed

how long to wait between each command or request

ask

ask before replaying each command or request

live

run the replay "live", with the web server continuing to serve

clients

(character vector) only replay requests from clients

Details

betr records requests and commands in a folder named <experiment name>-YYYY-MM-DD-HHMMSS, where the date and time record when ready was called. Within this folder, the subfolder 'record' holds details. If folder is not given, the default is either the current session name, or the most recently accessed folder matching the format above.

Each file in the folder records a single command or request. The filename records the time after experiment start that the command/request was processed. Details are stored in the file using the YAML format, which is quite self-explanatory and easy to edit.

Unless live=TRUE, the experiment will be stopped before replay(if it is already started). In any case, the subject table will be reinitialized and ready will be called. This has the effect of calling any user-defined on_ready function.

speed can be numeric or "realtime". A numeric gives the number of seconds to wait before executing each command or request. "realtime" means, go at the speed of the original session. live=TRUE implies speed="realtime" unless speed is explicitly set.

If maxtime is given, only the first maxtime seconds of the experiment will be replayed. This is useful if you want to "rewind" the experiment because of lab problems, or during debugging.

If ask is TRUE then the experimenter will be prompted before each command or request is replayed:

Note that replay creates a new session. This means that you cannot do

replay(expt, maxtime=30) replay(expt, maxtime=120)

: the first replay will have created a new session with only the commands from the first 30 seconds. If you want to move backward and forward within a session, use replay(expt, folder="xxx") where xxx is the specific session of interest.

See Also

Other command line functions: get_url, info, map, nperiods, print,Experiment,ANY-method, print,Experiment-method, print_stages, session_name; halt; load_commands; merge_subjects; next_stage; pause; ready; restart; start.Experiment; trace_stage, untrace_stage

Examples

1
2
3
start(expt)
# something goes wrong after 2 minutes
replay(expt, maxTime=120)

hughjonesd/betr documentation built on May 17, 2019, 9:11 p.m.