flr / FLa4a

The repository for the JRC initiative on stock assessment
https://fishreg.jrc.ec.europa.eu/web/a4a
12 stars 6 forks source link

Fix for possible race condition in parallel runs #121

Closed iambaim closed 5 years ago

iambaim commented 6 years ago

This introduces simpler execute permission check in check.executable().

Because writing-and-then-deleting the transient syslog.txt file can possibly trigger race condition during parallel R sessions.

We recently faced this error when running FLa4a in parallel (using forceach - %dopar%):

Error in e$fun(obj, substitute(ex), parent.frame(), e$data) :
  worker initialization failed: package or namespace load failed for ‘FLa4a’:
 .onAttach failed in attachNamespace() for 'FLa4a', details:
  call: file(con, "r")
  error: cannot open the connection
Calls: source ... withVisible -> eval -> eval -> %dopar% -> <Anonymous>
In addition: Warning messages:
1: replacing previous import ‘ggplot2::%+%’ by ‘FLCore::%+%’ when loading ‘ggplo
2: replacing previous import ‘reshape::expand’ by ‘FLCore::expand’ when loading
3: multiple methods tables found for ‘fwdWindow’
4: multiple methods tables found for ‘refpts’
5: multiple methods tables found for ‘msy’
Execution halted

This commit seems to have fixed it.