-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executing settings functions inside renvs #51
Comments
I think this is yet another argument for why, for the 'main' Strategus modules, we want them to be integrated into the Strategus package, using a single central lock file, as argued here. |
Just making a note since we're moving towards moving the modules into Strategus v1.x but I think this is still a potential issue. Similar to the discussion in #148, what's our process for initializing an environment for designing a Strategus study? Here is a proposed workflow, assuming that: an OHDSI network study is proposed, a protocol exists, etc and we've setup our R environment following the HADES R Setup instructions:
The workflow above is still not sufficient to answer the question: how do I know that the environment used to design the study is the same as the one specified (in the renv.lock) to execute it? Here are some thoughts:
Looking forward to hearing others ideas on this topic & approach. |
Even though I suggested that for now we keep the renv lock file and specifications separately, I propose further down the line we integrate the two into a single object. We really need to ensure the set of R packages used to create the specifications is the same as the one used to execute the analysis, and therefore we need a hard link between lock file and specifications. Having a hash code is nice, but how do you find the renv lock file that matches it? And what if you can't find a match? Recording the HADES package versions is the same as integrating a renv lock file, right? |
We're agreed on this point and we can use #144 to discuss how we want to include this into the analysis specification. @chrisknoll mentioned in #147 (comment):
I'd support this idea as well - we want to have a release of Strategus that has been verified to work with the dependencies detailed in the renv.lock file. I'm going to close this issue since I'd prefer to track these types of design discussions and decisions in #148 since for v1.x we're decided on in-sourcing the modules and having a single renv.lock (somewhere) that controls the dependencies for the packages. What's not clear at the moment is how we 1) recommend developers use Strategus to create a network study and 2) how we distribute a network study which should be the focus in #148. |
There will be a problem on many systems where creating a study requires installed versions of specific R packages.
For example, if I want to use
CohortGenerator
with subsets I can define this in my base R/system R environment with CohortGenerator version0.8.0
and then feed this to a package using version0.7.0
. In this situation I could add Cohorts with subsets.However, doing this one of two things will happen:
Both these situations are bad and (currently) the only solution would be to make sure your system env and Strategus module env are the same.
Note that this will happen even with any parameters. For example, cohort diagnostics creates a
FeatureExtraction
default feature set inside the base package.However - I propose an alternative solution; to allow execution of settings creation inside module
renv
contexts and make this the standard procedure.In the simplest case, the module functions exposed (e.g.
getSharedResources
) should not require many changes, but module developers should be provided with an API to call into the module environment.In a more complex case I would like to be able to create arbitrary code execution inside the
renv
with something like this:Note, I include similar code (though not designed to be exported in its current state) in this PR.
There is a lot of complexity here though - we would only really want this code to create serialized payloads for the strategus design definitions.
Passing data between the calling script and the renv is also an example. The best solution for these situations is probably to store the input and output as an RDS file somewhere (rstudio optionally does this when sourcing jobs, allowing you to copy the calling environment to the child process and allowing the child process to copy results back to the parent R session).
The text was updated successfully, but these errors were encountered: