Open hwlim opened 5 years ago
Hi, good questions. This is taking place in the future package, so I transferred this issue over there. I need to think about this, but this is actually a design issue above the future framework that applies to all R packages/code that parses command-line arguments - who gets to "own" which argument, and how to you tell others that you've already "consumed" an argument. It's an interesting problem (and I have a few related thoughts around base::commandArgs()
from the past that fits into the problem too).
Thank you so much for the quick reply. At the moment, I changed my option flag. and I understand that it is more like architectural problem. FYI, a similar example is "-g" for native R gui option.
Thank you.
There's actually a workaround implemented in the future package that allows you to hide some command-line arguments from the future package when it's loaded. See ?future::future.options
and option future.cmdargs
- it allows you to override the CLI arguments that future sees. Something like:
cmdargs <- base::commandArgs()
# Drop -p <n>
idx <- match("-p", cmdargs)
if (length(idx) > 0) cmdargs <- cmdargs[-(idx, idx+1L)]
options(future.cmdargs = cmdargs)
Note that this has to be done before the future package is loaded, so might not be doable in all cases. This is a bit of a hack, because that option was intended for troubleshooting/debugging/testing the future package and not really intended to be used by others, but if it's useful - why not.
Great! This will help in my situation. Thank you for the tip!!
Hi
I made an R script that can take command line options with help from optparse package and Rscript. However, when I add "-p" option for my own purpose, it seems to conflict with "future parallel processing" and I get following warning:
Is there any way to avoid this conflict other than using another option alphabet in optprase? Thank you.