クラスタ内でパラレルでファイル接続をしようとしています。 グローバル環境では正常に動作しますが、クラスタのメンバーで使用するとエラーメッセージが表示されます(下記のスクリプトを参照)。 私は何かを忘れましたか?パラレル使用時のRファイル接続
提案がありますか?
おかげで、
# This part works
#----------------
cat("This is a test file" , file={f <- tempfile()})
con <- file(f, "rt")
# Doing what I think is the same thing gives an error message when executed in parallel
#--------------------------------------------------------------------------------------
library(parallel)
cl <- makeCluster(2)
## Exporting the object f into the cluster
clusterExport(cl, "f")
clusterEvalQ(cl[1], con <- file(f[[1]], "rt"))
#Error in checkForRemoteErrors(lapply(cl, recvResult)) :
# one node produced an error: cannot open the connection
## Creating the object f into the cluster
clusterEvalQ(cl[1],cat("This is a test file" , file={f <- tempfile()}))
clusterEvalQ(cl[1],con <- file(f, "rt"))
#Error in checkForRemoteErrors(lapply(cl, recvResult)) :
# one node produced an error: cannot open the connection
############ Here is my sessionInfo() ###################
# R version 3.3.0 (2016-05-03)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 7 x64 (build 7601) Service Pack 1
#
# locale:
# [1] LC_COLLATE=French_Canada.1252 LC_CTYPE=French_Canada.1252
# [3] LC_MONETARY=French_Canada.1252 LC_NUMERIC=C
# [5] LC_TIME=French_Canada.1252
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
Windowsの一時フォルダとC:\ tempのような他のフォルダを使用しているスクリプトの実行を避けるMcAfeeアンチウィルスのセキュリティ機能が原因です。したがって、単純な解決策は、このファイルを別のフォルダに作成することです(名前に「temp」が付いていないフォルダを想定しています)。 – Arnaud