Learn R Programming

bsub (version 1.1.0)

bsub_chunk: Submit R code

Description

Submit R code

Usage

bsub_chunk(code,
    name = NULL,
    packages = bsub_opt$packages,
    image = bsub_opt$image,
    variables = character(),
    share = character(),
    working_dir = bsub_opt$working_dir,
    hours = 1,
    memory = 1,
    cores = 1,
    R_version = bsub_opt$R_version,
    temp_dir = bsub_opt$temp_dir,
    output_dir = bsub_opt$output_dir,
    dependency = NULL,
    enforce = bsub_opt$enforce,
    local = bsub_opt$local,
    script = NULL,
    start = NULL,
    end = NULL,
    save_var = FALSE,
    sh_head = bsub_opt$sh_head)

Arguments

code

The code chunk, it should be embraced by { }.

name

If name is not specified, an internal name calculated by digest on the chunk is automatically assigned.

packages

A character vector with package names that will be loaded before running the script. There is a special name _in_session_ that loads all the packages loaded in current R session.

image

A character vector of RData/rda files that will be loaded before running the script. When image is set to TRUE, all variables in .GlobalEnv will be saved into a temporary file and all attached packages will be recorded. The temporary files will be removed after the job is finished.

variables

A character vector of variable names that will be loaded before running the script. There is a special name _all_functions_ that saves all functions defined in the global environment.

share

A character vector of variables names for which the variables are shared between jobs. Note the temporary .RData files are not deleted automatically.

working_dir

The working directory.

hours

Running time of the job.

memory

Memory usage of the job. It is measured in GB.

cores

Number of cores.

R_version

R version.

temp_dir

Path of temporary folder where the temporary R/bash scripts will be put.

output_dir

Path of output folder where the output/flag files will be put.

dependency

A vector of job IDs that current job depends on.

enforce

If a flag file for the job is found, whether to enforce to rerun the job.

local

Run job locally (not submitting to the LSF cluster)?

script

Path of a script where code chunks will be extracted and sent to the cluster.It is always used with start and end arguments.

start

A numeric vector that contains line indices of the starting code chunk or a character vector that contain regular expression to match the start of code chunks.

end

Same setting as start.

save_var

Whether save the last variable in the code chunk? Later the variable can be retrieved by retrieve_var.

sh_head

Commands that are written as head of the sh script.

Value

Job ID.

See Also

Examples

Run this code
# NOT RUN {
bsub_chunk(name = "example", memory = 10, hours = 10, cores = 4,
{
    Sys.sleep(5)
})
# }

Run the code above in your browser using DataLab