Skip to content
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

Remove local library attachment in module run script #107

Merged
merged 5 commits into from
Dec 18, 2023

Conversation

anthonysena
Copy link
Collaborator

Aims to fix #96 by removing the local library attachment and to simply use the libraries recorded in the module lock file. At the moment this assumes the modules have all of the necessary dependencies available to run the auto-generated script.

@anthonysena anthonysena requested a review from azimov December 14, 2023 16:49
Copy link

codecov bot commented Dec 14, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (00d0c00) 78.05% compared to head (dd3634b) 67.69%.

Files Patch % Lines
R/RunModule.R 0.00% 2 Missing ⚠️
R/ResultModelCreation.R 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop     #107       +/-   ##
============================================
- Coverage    78.05%   67.69%   -10.37%     
============================================
  Files            8        8               
  Lines          793      780       -13     
============================================
- Hits           619      528       -91     
- Misses         174      252       +78     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anthonysena anthonysena linked an issue Dec 14, 2023 that may be closed by this pull request
tempEmulationSchema = NULL
)
}
# if (!(Sys.getenv("CDM5_REDSHIFT_USER") == "" &
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the redshift tests are failing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I need to debug this but for now I've disabled the RedShift tests. It appears to be related to the way I'm downloading the jdbc driver and the tests cannot find the driver for that one for some reason.

if (isCdmExecution) {
connectionDetails <- Strategus::retrieveConnectionDetails(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will keyring and ParallelLogger still have issues? They are called in other places in this script and that would be harder to fix? I've been trying to break this and it seems ok though

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is still possible - the reason why these work now is because they are included in the module renv.lock environment. Assuming the module is restored properly AND has these dependencies it will work. I'd like to formalize these type of dependencies as mentioned in #69.

@anthonysena anthonysena merged commit a185331 into develop Dec 18, 2023
12 of 14 checks passed
@anthonysena anthonysena deleted the issue-96-library-isolation branch December 18, 2023 13:13
@hmorgancooper
Copy link

Hey :) I was having issues running Strategus due to the renv not being able to find packages in my local library. I think this issue is the one to fix that so I'm posting this here but sorry if this isn't the right spot.

I tried running the develop branch of strategus to test the fix and I am now getting an error with the CohortGeneratorModule.

It cannot find the MetaData.json inside /instantiatedmodules/CohortGeneratorModule_0.2.1. I took a look in that folder and it is empty apart from .Rhistory.

Does anyone have any ideas what might be going on?

@anthonysena
Copy link
Collaborator Author

Hi @hmorgancooper - I am guessing a bit here but the fact that the folder exists but it is empty (apart from the .Rhistory) leads me to think that the code was unable to download the CohortGeneratorModule from GitHub. I'm not sure of your environment but is that a possibility?

@hmorgancooper
Copy link

It could be that!

Does the Strategus develop branch attempt to download the module from github if it's not present? Or do I need to download it and have it in my r environment? I do have CohortGenerator already installed but I'm assuming I need CohortGeneratorModule as well?

Another point, I originally had the main branch of Strategus which I removed and then replaced with develop to test the new change. Is this likely to have caused any weirdness with the other modules or am I ok to try that?

Thanks!

@anthonysena
Copy link
Collaborator Author

Hi - Strategus will attempt to download and install the module if it is not found in the INSTANTIATED_MODULES_FOLDER. The develop branch of Strategus will go one step further to verify that the renv dependencies defined in the renv.lock file that is present in the root of the module folder before it attempts to run the Strategus study.

Removing/reinstalling Strategus will not remove any prior modules that were previously installed. Hope this helps and please let me know if you are able to get the modules installed. Thanks!

@hmorgancooper
Copy link

hmorgancooper commented Jan 23, 2024

Hey Anthony, thanks for the help :) The error message has changed which means I'm making progress!

I deleted the empty CohortGeneratorModule from the instantiated modules folder and it recreated it successfully (I think). The CohortModule package ran as far as I can tell. It threw up some warnings about not being able to rename some files because they did not exist (cohort_inclusion.csv, cohort_inc_result.csv etc) but it did finish.

I'm now erroring out in the CohortIncidenceModule.
I have a warning saying the renv is out of sync - apparently OhdsiRTools and Strategus are not available. When I run renv::restore() it's telling me the library is already synchronized with the lockfile though.

The actual error now is a java SQL error - Syntax error: Expected ")" but got keyword GROUPS at [59:5].

I am using BigQuery SQL which has caused some issues in the past. I got this 'hint' in the errorReportSql.txt
--HINT DISTRIBUTE_ON_KEY(subject_id)

For some context I am trying to run the HowOften Study (I can ask about this issue on that github page too if that makes more sense)

Thanks!

@hmorgancooper
Copy link

I managed to get the whole study to run! Thank you for the help :)

In case anyone runs into a something similar here is the link to the issue I raised on HowOften.
ohdsi-studies/HowOften#14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove local library package dependencies
3 participants