pecan icon indicating copy to clipboard operation
pecan copied to clipboard

Remove Settings as Global Variable

Open Its-Maniaco opened this issue 2 years ago • 5 comments

This pull tries to fix the issue of 'Settings' being used as Global variable. This is done by creating a local variable 'Settings' and passing that as function argument as required (here in convert.input.R).

Its-Maniaco avatar Jul 07 '22 13:07 Its-Maniaco

I am not sure if this approach is correct. I thought making 'Settings' local and using that should be a work around.

Its-Maniaco avatar Jul 07 '22 13:07 Its-Maniaco

I think this is the line that needs changing: https://github.com/PecanProject/pecan/blob/cd3e4c2dc1739b4165574dd1200f73886d80af9a/base/utils/R/convert.input.R#L100

exists() looks for an R object in the global environment. Looks like it could probably be replaced with something like

Rbinary <- settings$host$Rbinary
if(is.null(Rbinary)) Rbinary <- "R"

Aariq avatar Jul 07 '22 20:07 Aariq

@Aariq @mdietze Based on your suggestions, this is what I came up with.

Its-Maniaco avatar Jul 24 '22 17:07 Its-Maniaco

/document

moki1202 avatar Aug 01 '22 06:08 moki1202

@its-Maniaco Please also add a Roxygen documentation string for the new Rbinary parameter by adding the followin between current lines 57 and 58 of base/utils/R/convert.input.R:

##' @param Rbinary command (including path, if needed) to call the R executable on `host`

infotroph avatar Aug 06 '22 21:08 infotroph

@Its-Maniaco I took the liberty of working up a patch that implements the "read from host list" approach we recommended in the comments above. If you review and merge https://github.com/Its-Maniaco/pecan/pull/1 (note that it's a pull request in your fork of PEcAn, not in the PecanProject upstream that I'm typing this comment inside), my changes should immediately show up here... and if I did it right, this here PR should switch to showing only two files changed instead of 12.

infotroph avatar Aug 25 '22 05:08 infotroph