Implementation of ModuleInterface for executing a function in a R package. Uses future package for execution.

PackageFunctionModule

Format

An object of class R6ClassGenerator of length 25.

Class Constructor

new(name, fun, package = "base", assignedProcesses = 1)

  • name: Unique character string that identifies this module instance.

  • fun: function this module will execute. Must be a character string.

  • package: Name of the R package fun. Must be a character string.

  • assignedProcesses: Integer number of processes to assign to the execution of this module.

Public

clearOutputCache()

  • Clears output cache stored in this instance so memory can be reclaimed.

  • Returns: NULL.

errorCheck(executionCheck = FALSE, ...)

  • Runs error checking on the internal state of this object for erroneous values.

  • executionCheck: when set to TRUE, runs additional checks to determine if ready for execution.

  • ...: not used by this component.

  • Returns: NULL, will raise a fatal error if an error is found.

getFuncObj()

  • Gets the base R function object that is called when a module's execution is started.

  • Returns: R function object.

getInputs()

  • Gets a named logical vector where the names are the possible inputs into a module and the values indicate if an input is required.

  • Returns: logical vector.

getName()

  • Gets the name of this function.

  • Returns: character string that is the name of this module.

getOutput()

  • Gets the output of the function executed by this module.

  • Returns: The output of the function if the execution has completed. NULL will be returned if the execution has not been started or is still in progress.

getSaveInfo()

  • Gets a named list of internal states of this object which can be used to save this object on disk.

  • Returns: a named list

hasCompleted()

  • Indicates if the execution of the associated function of this module is complete.

  • Returns: a boolean where TRUE indicates the execution is complete and FALSE indicates the execution is not complete or not started.

startExecution(args)

  • Starts the execution of the function associated with this module. This is non-blocking if using an asynchronous.

  • args: named list of arguments for function associated with this module

  • Returns: NULL

Private

assignedProcesses

  • Number of processes assigned to execute this module.

fun

  • Stores associated function name.

futurePromise

  • Stores promise of future output of a function.

name

  • Unique character string that identifies this module instance.

package

  • Stores associated R package name.

Static Class Methods

PackageFunctionModule-cash-initFromSaveData