Learn R Programming

ParallelLogger

ParallelLogger is part of HADES.

Introduction

Support for parallel computation with progress bar, and option to stop or proceed on errors. Also provides logging to console and disk, and the logging persists in the parallel threads. Additional functions support function call automation with delayed execution (e.g. for executing functions in parallel).

Features

  • Functions for parallel computation.
  • Functions for logging, including automated logging for errors and warnings.
  • Functions used for automating analyses.

Examples

# Run a function in parallel:
fun <- function(x) {
  return (x^2)
}

cluster <- makeCluster(numberOfThreads = 3)
result <- clusterApply(cluster, 1:10, fun)
stopCluster(cluster)

# Create a file logger:
addDefaultFileLogger("log.txt")
logTrace("Hello world")

Technology

ParallelLogger is an R package.

System Requirements

Requires R (version 4.0.0 or higher)

Getting Started

In R, to install the latest stable version, install from CRAN:

install.packages("ParallelLogger")

To install the latest development version, install from the develop branch in GitHub:

install.packages("remotes")
library(remotes)
install_github("ohdsi/ParallelLogger", ref = "develop")

User Documentation

Documentation can be found on the package website.

PDF versions of the documentation is also available:

Contributing

Read here how you can contribute to this package.

Support

  • Developer questions/comments/feedback: OHDSI Forum
  • We use the GitHub issue tracker for all bugs/issues/enhancements

Contributing

Read here how you can contribute to this package.

License

ParallelLogger is licensed under Apache License 2.0

Development

ParallelLogger is being developed in R Studio.

Development status

Ready for use

Acknowledgements

  • This project is supported in part through the National Science Foundation grant IIS 1251151.

Copy Link

Version

Install

install.packages('ParallelLogger')

Monthly Downloads

2,297

Version

3.4.1

License

Apache License 2.0

Issues

Pull Requests

Stars

Forks

Maintainer

Martijn Schuemie

Last Published

March 28th, 2025

Functions in ParallelLogger (3.4.1)

excludeFromList

Exclude variables from a list of objects of the same type
logError

Log a message at the ERROR level
createLogger

Create a logger
layoutStackTrace

Logging layout with stack trace
layoutTimestamp

Logging layout with timestamp
layoutSimple

Simple logging layout
layoutParallel

Logging layout for parallel computing
selectFromList

Select variables from a list of objects of the same type
createEmailAppender

Create e-mail appender
createFileAppender

Create file appender
stopCluster

Stop the cluster
saveSettingsToJson

Save a settings object as JSON file
logFatal

Log a message at the FATAL level
unregisterLogger

Unregister a logger
logTrace

Log a message at the TRACE level
logInfo

Log a message at the INFO level
loadSettingsFromJson

Load a settings object from a JSON file
logDebug

Log a message at the DEBUG level
layoutEmail

Logging layout for e-mail
makeCluster

Create a cluster of nodes for parallel computation
layoutErrorReport

Logging layout for error report
logWarn

Log a message at the WARN level
matchInList

In a list of object of the same type, find those that match the input
registerLogger

Register a logger
addDefaultErrorReportLogger

Add the default error report logger
ParallelLogger-package

ParallelLogger: Support for Parallel Computation, Logging, and Function Automation
addDefaultEmailLogger

Add the default e-mail logger
addDefaultConsoleLogger

Add the default console logger
convertSettingsToJson

Convert a settings object to a JSON string
clusterApply

Apply a function to a list using the cluster
addDefaultFileLogger

Add the default file logger
convertJsonToSettings

Converts a JSON string to a settings object
clearLoggers

Remove all registered loggers
clusterRequire

Require a package in the cluster
getThreadNumber

Return the number of the current thread
createConsoleAppender

Create console appender
launchLogViewer

Launch the log viewer Shiny app
createArgFunction

Create an argument function
getPhysicalMemory

Get the total amount of physical memory
getLoggers

Get all registered loggers