From jeroen.ooms at stat.ucla.edu  Sun Feb 12 10:35:44 2017
From: jeroen.ooms at stat.ucla.edu (Jeroen Ooms)
Date: Sun, 12 Feb 2017 10:35:44 +0100
Subject: [Rd] parallel and tempdir()
Message-ID: <CABFfbXtbCgpjK91nWM_O4Q2m3YwyrQ14ibHFohN1pn1OoY5mag@mail.gmail.com>

A forked process in mcparallel will wipe the (shared) tempdir when it
quits. I think this is almost always undesirable:

  file.exists(tempdir())
  parallel::mcparallel(q("no"))
  file.exists(tempdir()) # false
  file.create(tempfile()) # error

A simple solution might be to skip over R_CleanTempDir when
R_isForkedChild. Example patch: https://git.io/vDwyf

In addition, I would like to suggest to add an option to mcparallel to
set a custom tempdir in the fork to prevent potential conflicts. I
tried implementing this myself but found that setting R_TempDir is not
allowed by CMD check, and Sys_TempDir (which is what actually gets
wiped) is invisible behind attribute_hidden. So I suppose this may
only be done in base.



[Rd] parallel and tempdir()
Jeroen Ooms