Skip to content

Instantly share code, notes, and snippets.

@olimay
Last active July 21, 2016 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olimay/12ea57440927bbbaeff6d47f4feef5a2 to your computer and use it in GitHub Desktop.
Save olimay/12ea57440927bbbaeff6d47f4feef5a2 to your computer and use it in GitHub Desktop.
Testing pulsar for CRAN release

Testing pulsar for CRAN release

Here are the sources of some files I made to test examples from the pulsar docs.

library(pulsar)
library(huge)
TEST_DIR = file.path("~","projects", "omake")
setwd(TEST_DIR)
run_example <- function () {
clean_registry()
debug(batch.pulsar)
pulsar_example()
}
clean_registry <- function () {
unlink(file.path(TEST_DIR, "testtorq"), recursive = TRUE)
}
hax_fix_filename <- function () {
file.rename(file.path(TEST_DIR, "simpletorque.tml"),
file.path(TEST_DIR, "simpletorque.tmpl"))
}
pulsar_example <- function() {
## Generate the data with huge:
set.seed(10010)
p <- 40 ; n <- 1200
dat <- huge.generator(n, p, "hub", verbose = FALSE, v = 0.1, u = 0.3)
lams <- getLamPath(0.2, 0.01, len = 40)
## Run batch.pulsar on a Torque cluster
## Get example template and config files
url <- "https://raw.githubusercontent.com/zdk123/pulsar/master/inst/extdata"
download.file(paste(url, "BatchJobsTorque.R", sep = "/"), destfile = ".BatchJobs.R")
download.file(paste(url, "simpletorque.tml", sep="/"), destfile = "simpletorque.tml")
hax_fix_filename() ### HAX LOL!!!!!1
## Give each job 1gb of memory and a limit of 30 minutes
resources <- list(memory="1GB", nodes="1", walltime="00:30:00")
hugeargs <- list(lambda=lams, verbose=FALSE)
out.p <- batch.pulsar(dat$data, fun=huge::huge, fargs=hugeargs,
rep.num=100, criterion=c('stars', 'gcd'),
job.res=resources, regdir=file.path(getwd(), "testtorq"))
plot(out.p)
}
@olimay
Copy link
Author

olimay commented Jul 21, 2016

When I run the code right now, I get the following conditions:

Sourcing configuration file: '.BatchJobs.R'
Creating dir: /Users/opm/projects/omake/testtorq
Saving registry: /Users/opm/projects/omake/testtorq/registry.RData
Adding 100 jobs to DB.
Error in system2(command = command, args = args, stdout = stdout, stderr = stderr,  : 
  error in running command

Here's the line (in batch.pulsar) that throws the error:

out <- batchply(data, estFun, fun, fargs, isamp, regid, regdir, 
    conffile, job.res, progressbar = progressbars)

I haven't tried to debug batchply just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment