Skip to content

Commit

Permalink
Merging updates from VisionEval-Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dflynn-volpe committed Mar 12, 2019
2 parents 5ac9e8e + 7db175c commit 407a0b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
10 changes: 5 additions & 5 deletions sources/VEGUI/FutureTaskProcessor.R
Expand Up @@ -7,8 +7,8 @@
# it is not required to specify workers -- if not then it will default to future::availableCores()
# use myNumTasks+1 because future uses one process for itself.

if (!require(future)) install.packages("future")
library(future)
if (!require(future.callr)) install.packages("future.callr")
library(future.callr)


asyncTasksRunning <- list()
Expand Down Expand Up @@ -261,9 +261,9 @@ fakeDataProcessing <- function(name, duration, sys_sleep = FALSE) {
} #end fakeDataProcessing


testAsync <- function(loops = future::availableCores() - 1) {
plan(multiprocess)
print(paste0("future::availableCores(): ", future::availableCores()))
testAsync <- function(loops = future.callr::availableCores() - 1) {
plan(callr)
print(paste0("future.callr::availableCores(): ", future.callr::availableCores()))
loops <- 10 #
baseWait <- 3
for (loopNumber in 1:loops) {
Expand Down
16 changes: 11 additions & 5 deletions sources/VEGUI/global.R
Expand Up @@ -9,7 +9,7 @@ suppressPackageStartupMessages({
library(shinyFiles)
library(data.table)
library(shinyBS)
library(future)
library(future.callr)
library(testit)
library(jsonlite)
library(DT)
Expand All @@ -36,11 +36,12 @@ options(DT.options = list(dom = 'tip', rownames = 'f'))

# Set future processors

planType <- 'multiprocess' # Will VEGUI work at all with sequential?
planType <- 'callr' # Will VEGUI work at all with sequential?

if ( exists('planType') && planType == 'multiprocess'){
if ( exists('planType') && planType == 'callr'){
NWorkers <- max(availableCores()-1, 1)
plan(multiprocess, workers = NWorkers, gc=TRUE)
# plan(callr, workers = NWorkers, gc=TRUE)
plan(callr, workers = NWorkers)
} else {
plan(sequential)
}
Expand Down Expand Up @@ -104,7 +105,12 @@ myFileTypes_ls <- list(

# Get the volumes of local drive
# Changes to this line may affect tests. See run_vegui_test.R
volumeRoots = c('.' = '.', '..' = '..', getVolumes("")())
# JR NOTE:
# Should be fine, as long as the line starts with "volumeRoots = c("
# Hacking on something un-parameterized like this violates the whole notion of
# of what a "test" is.
volumeRoots = c('Models' = '../models', '.' = '.', '..' = '..', getVolumes("")())
if (length(volumeRoots)>3) names(volumeRoots)[c(2,3)] <- c( basename(getwd()), basename(normalizePath(file.path(getwd(),".."))) )

# Define utility functions ----------------------------------------

Expand Down

0 comments on commit 407a0b9

Please sign in to comment.