gianba / SeizureDetection

3 stars 0 forks source link

SeizureDetection

Run from command line

./terminal-runner <data> <cores>

Example: ./terminal-runner ../data 4

Debugging parallel execution

It is possible to log workers' work by making use of the socket calls defined in the R utils package: http://stat.ethz.ch/R-manual/R-devel/library/utils/html/00Index.html

The write.socket function is probably non thread-safe, so it is a good idea to split the logs across several ports.

Steps:

Example:

tryCatch({
  fileData <- loadFileAndExtractFeatures(filePath, transformations$ica, transformations$pca, transformations$n_components)
}, error=function(e) {
  log.socket <- make.socket(port=4000)
  write.socket(log.socket, sprintf(paste0(as.character(Sys.time()), ": ", paste('Error extracting features from file', filePath), "\n")))
  write.socket(log.socket, sprintf(paste0(as.character(Sys.time()), ": ", e, "\n")))
  close.socket(log.socket)
  return(NA)
})