-
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
fixes #1757 - renders if package is read-only #1768
Conversation
I'm at lunch but don't merge this. There's a better fix that we discussed while fixing the reports for the site. |
@jwildfire @lauramaxwell I'd be surprised if I passed a relative path and the write happened relative to my temp dir, which is what this fix would do. But the default Does relative-to-working-directory seem like the right answer, or should we do something else? I can implement it, I just wouldn't do so quite how @dpastoor did. @dpastoor As a work-around, if you pass an absolute path via |
@jonthegeek yes lets talk shortly in the zoom call about this. The biggest "issue" i have with this is in the CI/CD pipeline, this function is buried in the orchestration yaml a bit, making it harder to control the strOutput, especially for things like generating a temp name. |
I'm working on an alternate solution that addresses both @jonthegeek and @dpastoor use cases. It will be ready to review/comment on by tomorrow morning. |
I put up a proposed solution that should work for a temp context by checking permissions of the output directory and creating the temp structure if it is not writable. This also breaks apart specifying a custom file name ( I'm also considering addressing #1724 with this PR as well, since it relates to @dpastoor's point about specifying output directories and file names within workflows. We can discuss further in the morning- I'll be logging off shortly. |
Thanks @lauramaxwell for the thoughts, I like some of the ideas you've proposed here! unfortunately I do not think this will fix the issue I was running into. In particular, the issue I was running would still hit here I think:
when the gsm package dir is read only, the resulting render will fail, because it drops an intermediate md file in the directory of the rmd, so from an access perspective, instead if we could change the file.access check to instead by that if the report_path is a read-only dir, then we'd want to shift it to a temp dir. My other general concern with the approach of rendering within the packages system.file/inst dir has other potential problems - if you try to run a Report_KRI from two processes at the same time they can clobber each other with that intermediate file dropped. It has always felt safest to me that when you're rendering in any sort of scenario that there could be any concurrent access to where a render is called, to do that in a temp dir scoped to the process. |
ah, right. Thanks, @dpastoor. I got a bit mixed up trying to solve for both issues. I think i have a solution-
Does this seem like it will solve the issue? |
If you're like me, i like to see the code- so something like this:
|
Good call! I'd also update the examples (and any other usage) to assign the function call to something, like |
ok, i'm moving forward with this. it also looks like we can specify |
@jonthegeek @dpastoor this is ready for re-review. I think we can work on #1724 in a separate PR, unless one of you wants to tackle it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're exporting RenderRmd
, I made some suggestions to harden it a bit. Let's do all the checks there, since anything we save will need to deal with the write access thing. Also be sure to update anywhere that these functions are called (I didn't check that the args all still make sense).
Co-authored-by: Jon Harmon <jon.harmon@atorusresearch.com>
@jonthegeek edits made! thanks for the feedback :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I've tested this in a pipeline on one of the self-hosted runners where gsm is installed globally as read only into /opt/rpkgs/gsm/gsm. Prior behavior was it would fail with a permissions error, now its passing.