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

Using ORDERLY_PATH_DEFAULT_REMOTE environment variable #328

Open
LorenzoCattarino opened this issue Jul 11, 2023 · 4 comments
Open

Using ORDERLY_PATH_DEFAULT_REMOTE environment variable #328

LorenzoCattarino opened this issue Jul 11, 2023 · 4 comments

Comments

@LorenzoCattarino
Copy link

LorenzoCattarino commented Jul 11, 2023

Hello orderly developers!

I am having an issue using orderly_pull_archive(). I am not able to provide a full reproducible example but I hope that what I am trying to do is clear from the below description.

I set up a shared disk system with a copy of my orderly project on a shared drive all my team members have access to.

If I run the report "get_data" on the shared drive and then try to pull it locally using orderly_pull_archive("get_data") I get the error:

Error: Environment variable 'ORDERLY_PATH_DEFAULT_REMOTE' is not set
	(used in orderly_config.yml:remote:default:args:path)

This happens despite having created an orderly_envir.yml file with the ORDERLY_PATH_DEFAULT_REMOTE environment variable, as explained in the vignette.

I can successfully pull the copy of the report from remote using one of the following workarounds:

config <- orderly::orderly_config()

envir_file <- orderly:::orderly_envir_read(config$root)

orderly::orderly_default_remote_set(envir_file["ORDERLY_PATH_DEFAULT_REMOTE"])

orderly::orderly_pull_archive("get_data")

or

config <- orderly::orderly_config()

envir_file <- orderly:::orderly_envir_read(config$root)

path_remote <- envir_file["ORDERLY_PATH_DEFAULT_REMOTE"]

remote <- orderly::orderly_remote_path(path_remote)

orderly::orderly_pull_archive("get_data", remote = remote)

Do I need to set the remote or define the remote argument in orderly_pull_archive() EVERY TIME I want to use orderly_pull_archive()? From the vignette it looks like I should be able to pull a copy of the report by just using the "ORDERLY_PATH_DEFAULT_REMOTE" environment variable?

Any advise is appreciated!

Thanks
Lorenzo

@richfitz
Copy link
Member

richfitz commented Jul 12, 2023

Lorenzo! Nice to hear from you :)

If you're using orderly, do you mind if we have a chat at some point as we're in the middle of rewriting everything. I'd be interested to see how you're using it, and if there's anything we can do to make that easier for you as we rewrite it.

The above should work, so something is probably wrong with the configuration. I can try and recreate it, but it would be most efficient if you could create a minimal example (e.g., a small zip file) that illustrates your setup with no sensitive data, just a dummy get_data report. It would also be useful to know what version of orderly you have (packageVersion("orderly")); it's possible this is some bug that is fixed

@LorenzoCattarino
Copy link
Author

Hey Rich! Thanks a lot for your reply. I hope all is well.

So I created a simple orderly project with one dummy task (attached below as zip file). I copied that folder to another directory on my windows machine (which acts as the remote place).

Then I run the lines in the repex.R file (probably not the best name I know). The first attempt fails despite having the ORDERLY_PATH_DEFAULT_REMOTE variable in the orderly_envir.yml. This is the problem I am having. The second attempts works.

This hopefully clarifies what I am trying to do and the problem I am having. Please let me know if not and I can provide more information / try to create a better example.

Also, I am using orderly version ‘1.4.3’.

It would be great to chat on how we use orderly here at UKHSA. It has been massively helpful in supporting our incident response work. Happy to book some time to meet when convenient.

Thank you very much
Lorenzo (lorenzo.cattarino@ukhsa.gov.uk)

orderly_test.zip

@richfitz
Copy link
Member

Thanks Lorenzo - I can confirm this and can also confirm that it is still present in the current development version (1.6.1).

The workaround is to edit your .Renviron:

usethis::edit_r_environ()

and add

ORDERLY_PATH_DEFAULT_REMOTE=C:/Users/lorenzo.cattarino/remote_location/orderly_test

(note that this uses = and not :)

I've got a fix that you can try with:

remotes::install_github("vimc/orderly@remote-env", upgrade = FALSE)

(in a new session), which will give you version 1.6.2; let me know if that works on your real case.

@LorenzoCattarino
Copy link
Author

Thanks Rich.

The workaround works great and the fix too on my real case.

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

No branches or pull requests

2 participants