Running TryCatch within future_apply #769
Replies: 3 comments 2 replies
-
Hi there. Could please edit your comment to use so called fenced code blocks. See https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#fenced-code-blocks for what that is. |
Beta Was this translation helpful? Give feedback.
-
Hi Henrik, |
Beta Was this translation helpful? Give feedback.
-
Should have spent a bit more time researching, easy fix. Thanks Henrik, This is a very easy package to employ and it works really well on all platforms. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Simple question a bit out of my league.
Running a large MICE operation within TryCatch and trying to parallel the process
I am local- live and work in the Presidio. I do a bit of programming in R and have recently used the Future package for a script that I update results quarterly. It is a large MICE imputation routine. I tried future-apply on a small sample and it worked well-impressive. On a larger file not so much.
I have attached the script, if you can take a look and let me know how to make it work.
This is the error:
in ...future.FUN(...future.X_jj, ...) : no loop for break/next, jumping to top level
Here is the script:
library(data.table)
library(tidyverse)
library(caret)
library(mice)
basepath <- "/data/customers/l2/data/commercial/24Q4/"
Vfdir <- file.path(basepath, "voter")
Cfdir <- file.path(basepath, "raw")
ComFileList <- list.files(file.path(basepath, "raw"), full.names = TRUE) #DS server
VotFileList <- list.files(file.path(basepath,"voter"),full.names=TRUE) #DS server
GrabVf <- c(
"LALVOTERID",
"Voters_Age",
"Voters_BirthDate"
)
GrabCom <- c("Individual_Id", "Lalvoterid", "Geocode_Full", "RUS_Code", "State", "Gender", "Inferred_Age", "Marital_Status", "Ethnic_Group", "Homeowner_Probability_Model", "Presence_Of_Children_in_HH", "Education_of_Person", "Estimated_Income_Code", "Zip_Code","BirthDate","Census_Tract","Census_Block","Census_Block_Group",
"Social_Ranking_Index_by_Individual",
"Social_Ranking_Index_by_Area",
"Likely_Income_Ranking_by_Area",
"Likely_Educational_Attainment_Ranking_by_Area")
GrabImp <- c(
"LALCONSUMERID", "Gender", "AgeBracket2", "RUS_Code", "Income", "Ethnic","Ethnic2",
"Education", "Marital", "Children", "Own_Rent", "Zip_Code", "State", "Geocode_Full", "Age_Inferred", "Age_Code", "Age_Othot_Bracket", "Age_L2_Bracket", "AgeBracket4","Bdate",
"Social_Ranking_Index_by_Individual",
"Social_Ranking_Index_by_Area",
"Likely_Income_Ranking_by_Area",
"Likely_Educational_Attainment_Ranking_by_Area","EdNew")
Cdat <- fread(ComFileList[2], colClasses = c("Geocode_Full" = "character", "Zip_Code" = "character"), na.strings = c("", NA), select = GrabCom)
Vdat <- fread(VotFileList[2], select = GrabVf)
setnames(Cdat, "Lalvoterid", "LALVOTERID")
Cdat <- Vdat[Cdat, on = "LALVOTERID"]
library(future)
library(future.apply)
plan(multisession)
options(future.globals.maxSize = 1000 * 1024^2) #memory adjustment - might be a problem
#parallel
#END OF PROGRAM
Beta Was this translation helpful? Give feedback.
All reactions