parabar 1.4.0
Added
- Add vignette
foreach.Rmdto illustrate howparabarcan be used in conjunction with theforeachpackage. The implementation for the%dopar%operator is provided by thedoParabarpackage. Theforeach.Rmdvignette is locally build from theforeach.Rmd.origfile.
parabar 1.3.0
CRAN release: 2024-12-10
Added
- Update
AsyncBackendto allow forceful stopping of the cluster. This is controlled by the package optionstop_forceful, which, when set toTRUE, permits the backend to stop the cluster even if tasks are running or if tasks have finished but their results have not yet been read into the main session. The stopping logic is now based on the newly added classSessionState. Closes #59. - Add
SessionStateclass to easily check if an asynchronous backend is ready for certain operations. - Add tests for the
SessionStateandTaskStateclasses, and other improvements to the existing tests. - Introduce “pseudo-tests” for
SyncBackendandAsyncBackendfinalizers. These tests don’t perform real assertions but instead verify that finalizers are invoked when backend instances are garbage collected. As of now, there appears to be no reliable way to programmatically capture conditions handled within a finalizer triggered by manualgc()invocation.
Changed
- Remove
SyncBackendandAsyncBackenddestructors in favour ofRfinalizers registered viabase::reg.finalizer. - Rename
ServicetoBackendServicefor clarity and consistency. While the nameServicemakes sense in the context of theparabarpackage, it can be confusing when usingparabarin conjunction with other packages (e.g., in the context of thepowerlypackage). The new nameBackendServiceis hopefully more descriptive and less likely to clash with other packages. - Update
comparison.Rmdvignette to refresh the comparison betweenparabarandpbapplypackages. - Update design diagram and improved its readability and the client code examples.
- Refactor
task_is_runningtest helper to accept more context types. - Update
Specificationto allow backends with a single core. Closes #71.
Fixed
- Fix error triggered by the invocation of the backend destructors (i.e., see issue #61). Clean-up of resources is now handled via the
base::reg.finalizermechanism, with finalizers being automatically registered when a backend is created. This ensures that the cluster is stopped and resources are released even if the user forgets to callstop_backendexplicitly. Closes #61. - Fix the
sinkredirect to use the correct destination onWindows(i.e.,nulinstead of/dev/null). Closes #74.
parabar 1.1.1
CRAN release: 2024-02-05
Added
- Add tests for progress tracking context when executed tasks throw an error. In relation to #44.
parabar 1.1.0
CRAN release: 2023-05-07
Added
- Update implementations of
Service$applyoperation forBackendclasses to validate the providedmarginargument before running the parallel operation. - Add helper
Helper$check_array_marginsto validate the margins provided to theService$applyoperation. - Add exception
Exception$array_margins_not_compatiblefor using improper margins in theService$applyoperation. - Add exception
Exception$primitive_as_task_not_allowedfor trying to decorate primitive functions with progress tracking in theProgressTrackingContextclass. - Add helper
Helper$is_of_classto check if an object is of a given class. - Add optional arguments to the
get_outputoperation ofSyncBackendfor consistency. - Add more tests to improve coverage.
- Add implementation for
Service$lapplyandService$applyoperations for all classes that implement theServiceinterface. - Add
par_lapplyandpar_applyfunctions to the userAPI. These functions can be used to run tasks in parallel akin toparallel::parLapplyandparallel::parApply, respectively. - Add
UserApiConsumerR6class that provides an opinionated wrapper around the developerAPIof theparabarpackage. All parallel operations (e.g.,par_sapplyandpar_lapply) follow more or less the same pattern. TheUserApiConsumerencapsulates this pattern and makes it easier to extendparabarwith new parallel functions (e.g.,par_apply) while avoiding code duplication. TheUserApiConsumerclass can also be used as a standalone class for parallel operations, however, its primary purpose is to be used by the parallel task execution functions in the userAPI.
Changed
- Force early evaluation for the
xargument of task execution functions inProgressTrackingContextclass. - Update the log file for progress tracking to include
parabarin file name. - Disable warnings for
file.createinProgressTrackingContextclass. This warning is superfluous since the code handles creation failures. - Refactor test helpers to avoid code duplication.
- Update
par_sapplyto use theUserApiConsumerclass. - Update the developer
APIR6classes to implement thelapplyparallel operation.
Fixed
- Ensure task execution errors are propagated to the main session in
AsyncBackend. Closes #35. - Fixed the rendering of
CC BY 4.0license icons inREADME.mdfor the package website. - Update
.decoratemethod ofProgressTrackingContextto be more flexible. More specifically, the method will now throw when primitive functions are provided for decoration. The method can now handle both inline functions (i.e.,function(x) x) and functions that have a body defined in terms of compound expressions (i.e.,function(x) { x }). Closes #32. - Fix the
exportoperation in theSyncBackendandContextclasses to fallback to the parent environment if the argumentenvironmentis not provided.
parabar 1.0.0
Added
- Add
CC BY 4.0license for package documentation, vignettes, and website content. - Add code coverage
GitHubworkflow viacodecovand badge inREADME. - Add tests for end-user API and developer API.
- Add vignette
comparison.Rmdto compareparabarto thepbapplypackage, and provide rough benchmarks. Thecomparison.Rmdvignette is locally build from thecomparison.Rmd.origfile (i.e., see this resource for more information). - Add active biding
Options$progress_log_pathto handle generation of temporary files for tracking the execution progress of tasks ran in parallel. Using a custom path (e.g., for debugging) is also possible by setting this active binding to a desired path.
Changed
- Refactor
Specificationfor testing purposes. - Replace
\dontrun{}statements in examples withtry()calls. - Update example for
Optionsclass to feature theprogress_log_pathactive binding. - Update progress logging injection approach in
.decoratemethod ofProgressTrackingContextto usebquoteinstead ofsubstitute. -
Breaking. Rename class
ProgressDecoratortoProgressTrackingContextto be more consistent with the idea of backends that run in contexts. - Add
...optional arguments to signature ofget_outputmethod inServiceinterface. - Update private method
.make_logofProgressDecoratorto use theprogress_log_pathoption. - Update
UMLdiagram to include missing classes and changed methods. Also updated the corresponding diagram figure in the package documentation.
parabar 0.10.1
CRAN release: 2023-02-28
parabar 0.10.0
Added
- Add new exported wrappers to the
pkgdownreference section. - Add several exported wrappers to the user API:
-
clear: to clean a provided backend instance. -
export: to export variables from a given environment to the.GlobalEnvof the backend instance. -
peek: to list the variables names available on the backend instance. -
evaluate: to evaluate arbitrary expressions on the backend instance.
-
- Add type checks for the exported functions (i.e., the user API).
- Add helper method for checking and validating the type of an object. The
Helper$check_object_typemethod checks if the type of an object matches an expected type. If that is not the case, the helper throws an error (i.e.,Exception$type_not_assignable).
Changed
- Add
.scssstyles to override the table column width for the exported wrappers table in thepkgdownwebsite. - Update
READMEand package documentation to mention new exported wrappers. - Update order of topics for website reference section generated via
pkgdown. - Update
roxygen2@examplesfor exported wrappers. The code for the examples is located in the documentation for thestart_backendfunction. All other exported wrappers (i.e.,clear,export,peek,evaluate, andpar_sapply) inherit the@examplessection fromstart_backend. - Update references in
@seealsodocumentation sections. - Change
backendargument ofpar_sapplytobackend = NULL. This implies, thatpar_sapplywithout a backend behaves identically tobase::sapply.
parabar 0.9.4
Added
- Add custom styles to
extra.scssto improve documentation website. - Add
S3print method for theLOGOobject.
Changed
- Improve documentation for exported objects.
- Merge documentations of
get_option,set_option, andset_default_options. - Improved
README. More specifically, added description forServiceinterface methods and enabled documentation linking (i.e., via?) forpkgdownwebsite.
Fixed
- Add missing export for
Optionsclass. - Ensure the examples in
ProgressBarusewait = TRUEwhen fetching the output. - Fix bug in the
evaluatebackend operation. The expression passed toevaluatewas not correctly passed down the function chain toparallel::clusterCall. See this question onStackOverflowfor clarifications. Closes #9.
parabar 0.9.3
Changed
- Change type of private field
.bar_configinProgressDecoratorclass tolist. This way, theconfigure_bar()method ofProgressBarclass becomes an optional step.
Fixed
- Implement file locking when logging progress from child processes to avoid race conditions. The implementation is based on the
filelockpackage. Closes #8. - Fix typo in
DESCRIPTION.
parabar 0.9.2
Fixed
- Update
man-roxygen/parabar.R\html{...}to fixHTMLvalidation errors. Closes #6. - Fix package description in
DESCRIPTIONfile to comply withCRANrequirements.
parabar 0.9.0
Added
- Add package website via
pkgdownandGitHubpages. - Add
GitHubworkflow to automatically check the package on several platforms andRversions. - Export all
R6classes as developer API and regenerate the namespace. - Add preliminary package documentation to
READMEfile. - Add exported wrapper
par_sapplyto run tasks in parallel and display a progress bar if appropriate. - Add exported wrapper
stop_backendto stop a backend instance. - Add exported wrapper
start_backendto create a backend instance based on the specified specification. - Add exported wrapper
configure_barfor configuring the type and behavior of the progress bar. - Add exported wrapper
set_optionforHelper$set_option. This function is available to end-users and can be used to set the value of a specific option. - Add helper method for setting package options. The static method
Helper$set_optionis a wrapper aroundbase::getOptionthat sets the value of a specific option if it exists, or throws an error otherwise. - Add package object documentation and relevant information in
DESCRIPTIONfile. - Add
parabarlogo startup message for interactiveRsessions. - Add function to generate package logo based on the
ASCIItemplate ininst/assets/logo/parabar-logo.txt. - Add exported wrapper
get_optionforHelper$get_option. This function is available to end-users and can be used to get the value of a specific option or its default value. - Add helper method for getting package options or their defaults. The static method
Helper$get_optionis a wrapper aroundbase::getOptionthat returns the value of a specific option if it exists, or the default value set by theOptionsclass otherwise. - Add
OptionsR6class andset_default_optionsfunction to manage package options forparabar. The documented fields of theOptionsclass represent the options that can be configured by the user. Theset_default_optionsfunction can be used to set the default package options and is automatically run at package load time. In a nutshell,set_default_optionsstores an instance ofOptionsin thebase::.Optionslist under the keyparabar. - Implement initial software design. For a helicopter view, the design consists of
backendandcontextobjects. Abackendrepresents a set of operations that can be deployed on a cluster produced byparallel::makeCluster. The backend, therefore, interacts with the cluster via specific operations defined by theServiceinterface. Thecontextrepresents the specific conditions in which the backend operations are invoked. A regular context object simply forwards the call to the corresponding backend method. However, a more complex context can augment the operation before invoking the backend operation. One example of a complex context is theProgressDecoratorclass. This class extends the regularContextclass and decorates the backendsapplyoperation to provide progress tracking and display a progress bar. - Add context classes to consume and decorate backend APIs. Since the context classes implement the
Serviceinterface, the client can interact with context objects as if they represents instances ofBackendtype. This release introduces the following contexts:-
Context: represents a regular context that wraps backend objects. In other words, allServicemethods calls implemented by this context are forwarded to the corresponding methods implemented by the backend object. -
ProgressDecorator: represents a progress tracking context. This context decorates thesapplymethod available on the backend instance to log the progress after each task execution and display a progress bar. -
ContextFactory: represents a blueprint for obtaining specific context instances.
-
- Add classes to work with synchronous and asynchronous backends:
-
Service: represents an interface that all concrete backends must implement. It contains the methods (i.e., operations) that can be requested from a given backend instance. These methods form the main API ofparabar. -
Backend: represents an abstract class that implements theServiceinterface. It contains fields and methods relevant to all concrete backend implementations that extend the class. -
SyncBackend: represents a concrete implementation for a synchronous backend. When executing a task in parallel via thesapplymethod, the caller process (i.e., usually the interactiveRsession) is blocked until the task finishes executing. -
AsyncBackend: represents a concrete implementation for an asynchronous backend. After lunching a task in parallel via thesapplymethod, the method returns immediately leaving the caller process (e.g., the interactiveRsession) free. The computation of the task is offloaded to a permanent backgroundRsession. One can read the state of the task using the public field (i.e., active binding)task_state. Furthermore, the results can be fetched from the background session using theget_outputmethod, which can either block the main process to wait for the results, or attempt to fetch them immediately and throw an error if not successful. -
Specification: represents an auxiliary class that encapsulates the logic for determining the type of cluster to create (i.e., viaparallel::makeCluster), and the number of nodes (i.e.,Rprocesses) for the cluster. -
TaskState: represents an auxiliary class that encapsulates the logic for determining the state of a task. -
BackendFactory: represents a blueprint for obtaining concrete backend implementations.
-
- Add
Helper,Warning, andExceptionR6classes. These classes contain static member methods that provide useful utilities, handle warning messages, and throw informative errors, respectively. - Add
UMLdiagram for package classes. The classes provided byparabarcan be split in three categories, namely (1) backend classes responsible for managing clusters, (2) context classes that decorate backend objects with additional functionality (e.g., progress tracking), and (3) progress bar classes providing a common interface for creating and interacting with various progress bars.
parabar 0.1.0
Added
- Add
Barabstraction for working with progress bars inR. Currently, two types of of progress bars are supported (i.e.,BasicBarandModernBar).BasicBaruses as engine theutils::txtProgressBar, andModernBarrelies on theR6class obtained fromprogress::progress_bar. Specific concrete instances of these bar types can be requested from theBarFactory.
