Bsub
Send R code/R scripts/shell commands to LSF cluster without leaving R
Install / Use
/learn @jokergoo/BsubREADME
Submitter and Monitor of the LSF Cluster
It sends R code/R scripts/shell commands to LSF cluster without leaving R.
Install
Directly from CRAN:
install.packages("bsub")
Or from GitHub:
if (!requireNamespace("devtools", quietly = TRUE))
install.packages("devtools")
devtools::install_github("jokergoo/bsub")
Documentation
The online documentation is available at https://jokergoo.github.io/bsub/.
Submit jobs
Directly submit R chunk:
library(bsub)
# R code
bsub_chunk(name = "example", memory = 10, hours = 10, cores = 4,
{
fit = NMF::nmf(...)
# you better save `fit` into a permanent file
saveRDS(fit, file = "/path/of/fit.rds")
})
Submit an R script:
# R script
bsub_script(name = "example",
script = "/path/of/foo.R", ...)
Submit shell commands:
# shell commands
bsub_cmd(name = "example",
cmd = "samtools view ...", ...)
Kill jobs:
bkill(job_id)
Job dependencies
job1 = bsub_chunk(...)
job2 = bsub_chunk(...)
bsub_chunk(..., dependency = c(job1, job2))
View job info
View job summaries:
bjobs
brecent
bjobs_running
bjobs_pending
bjobs_done
bjobs_exit
An example of the job queries is as follows:

View job log:
job_log(job_id)
Interactive job monitor
monitor()
The job summary table:
<p><img width="907" alt="monitor" src="https://github.com/jokergoo/bsub/assets/449218/9970a50d-dbf6-4477-9a8b-5344f641b8ba"></p>Job log:
<p><img width="905" alt="job_log" src="https://github.com/jokergoo/bsub/assets/449218/b2faa77c-6dc1-4578-b52c-73bc7a739ba9"></p>Job dependency diagram:
<p><img width="895" alt="dependency_graph" src="https://github.com/jokergoo/bsub/assets/449218/eaf85ef6-32bb-4c09-a3d4-1069cf11a404"></p>License
MIT @ Zuguang Gu
