[Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Henrik Bengtsson
Hi, in BiocParallel, is there a suggested (or planned) best standards for making *locally* assigned variables (e.g. functions) available to the applied function when it runs in a separate R process (which will be the most common use case)? I understand that avoid local variables should be

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Michael Lawrence
An analog to clusterExport is a good idea. To make it even easier, we could have a dynamic environment based on object tables that would catch missing symbols and download them from the parent thread. But maybe there's some benefit to being explicit? Michael On Sun, Nov 3, 2013 at 12:39 PM,

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Henrik Bengtsson
On Sun, Nov 3, 2013 at 1:29 PM, Michael Lawrence lawrence.mich...@gene.com wrote: An analog to clusterExport is a good idea. To make it even easier, we could have a dynamic environment based on object tables that would catch missing symbols and download them from the parent thread. But maybe

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Ryan
Here's an easy thing we can add to BiocParallel in the short term. The following code defines a wrapper function withBPExtraErrorText that simply appends an additional message to the end of any error that looks like it is about a missing variable. We could wrap every evaluation in a similar

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Ryan
Another potential easy step we can do is that if FUN function in the user's workspace, we automatically export that function under the same name in the children. This would make recursive functions just work, but it might be a bit too magical. On 11/3/13, 2:38 PM, Ryan wrote: Here's an easy

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Gabriel Becker
Henrik, See https://github.com/duncantl/CodeDepends (as used by used by https://github.com/gmbecker/RCacheSuite). It will identify necessarily defined symbols (input variables) for code that is not doing certain tricks (eg get(), mixing data.frame columns and gobal variables in formulas, etc ).

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Ryan
I guess all we need to do is to detect whether a function would try to access a free variable in the user's workspace, and warn/error if so. It looks like CodeDepends could do that. I could try to come up with an implementation. I guess we would add CodeDepends as an optional dependency for

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Gabriel Becker
Ryan (et al), FYI: f function() { x = rnorm(x) x } findGlobals(f) [1] = { rnorm x should be in the list of globals but it isn't. ~G sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3]

Re: [Bioc-devel] BiocParallel: Best standards for passing locally assigned variables/functions, e.g. a bpExport()?

2013-11-03 Thread Ryan
Ok, here is my attempt at a function to get the list of user-defined free variables that a function refers to: https://gist.github.com/DarwinAwardWinner/7298557 Is uses codetools, so it is subject to the limitations of that package, but for simple examples, it successfully detects when a