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

greta in "imports" of a targets workflow #599

Open
smwindecker opened this issue Dec 15, 2023 · 2 comments
Open

greta in "imports" of a targets workflow #599

smwindecker opened this issue Dec 15, 2023 · 2 comments
Labels
Milestone

Comments

@smwindecker
Copy link

smwindecker commented Dec 15, 2023

Re: seamless integration of greta into targets

To make greta models available to downstream targets we need to "awaken" the model using a tar_hook_before() per the examples and discussion here and here.

Although these short-term fixes have worked fine, they fail to work if greta is added to the imports argument of tar_option_set() per below example. There is no issue with having greta listed in the packages argument.

tar_option_set(

  # packages that your targets need to run
  packages = c('greta'),
  imports = c('greta')
)

@njtierney has suggested this may have to do with making the entire namespace of greta available in the global environment.

It would be helpful to solve this issue because having the package in the imports argument means your targets pipeline is checking changes in the internal code of package and rerunning the workflow accordingly, per these guidelines about package invalidation.

@njtierney
Copy link
Collaborator

This is something that is good to know about, as it could definitely trip people up!

However, I think I would not recommend putting greta in the "imports" argument of tar_option_set as a general rule, although I can imagine there might be exceptions.

I think the preferable answer is to use renv to manage a specific package version of greta, if that is what you require, as recommended in the guidelines about package-based invalidation:

Usually, local package libraries do not need to change very often, and it is best to maintain a reproducible project library using renv.

Rather than loading greta locally on your machine and installing from there. The situation I am imagining where greta is required to be in imports is when you are developing specific functions within greta and are working on it locally and also using a targets pipeline. I'm not sure if that will come up very often?

I'd be curious if this issue arises if putting greta.gp inside of imports as well.

@njtierney
Copy link
Collaborator

Also a note that perhaps functions that import, e.g., greta::normal, inside a local package that is imported in targets import, might be causing an issue here as well.

@njtierney njtierney added this to the 0.6.0 milestone Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants