Accept project without cache dir
Closed this issue · 4 comments
Report an Issue / Request a Feature
I'm submitting a (Check one with "x") :
- [?] bug report
- [?] feature request
Issue Severity Classification -
(Check one with "x") :
- 1 - Severe
- 2 - Moderate
- 3 - Low
Expected Behavior
If the global/config.dcf file states that cache is not used, it might not be necessary to have a cache folder.
Current Behavior
ProjectTemplate:::.mandatory.files
[1] "config/global.dcf" "cache" "data"
means that a cache dir is always required, no mather if it is used or not.
Version Information
0.82 for ProjectTemplate
Possible Solution
Make ProjectTemplate:::.mandatory.files
a function that only include cache if needed by global/config.dcf.
HI @eribul, this is an interesting thought. In the global.dcf
there are 2 cache flags: cache_loading
and cache_loaded_data
. I'm assuming for this conversation you are referring to cache_loading
and that if cache_loading
is set to FALSE you aren't using the cache directory. I'm also assuming that you have manually removed the cache directory. If I'm missing something please let me know!
ProjectTemplate
is meant as a framework that provides sensible defaults. This sets novices on a good path, which includes caching data for faster load time. At the same time, ProjectTemplate
shouldn't get in the way of experienced users. If you don't want a cache
folder you should not need a cache
folder!
It's an easy change making cache
not mandatory. What should ProjectTemplate
do if a person has removed the cache
directory and then decides they want caching? Should it simply fail, putting the burden on you to figure out what went wrong? Should it provide an error message that a cache
directory should be present and require you to make the cache
directory? Should it create the cache
directory, notify the user, and get on with the work?
Before making the change, these are the questions I'm mulling over. Would love your thoughts! I'm leaning towards creating the directory if this wouldn't get in your way.
Hi agin!
Yes, I had removed it manually for a project without any data of its own (usnig data from SQL database and just exporting a report).
I agree! To create the cahce folder with a message sounds great :-)
Hi @eribul,
I've been checking edge cases associated with removing the cache
directory. Not having a cache
directory may interfere with other features. Caching is very much integrated with ProjectTemplate
going forward. I also recognize that sometimes the cache
directory is removed! The error message coming from .stopifnotproject
could be very confusing if the cache directory is missing. It simply says "<current_directory> is not a ProjectTemplate directory." This is not very informative and can lead someone down a very frustrating path if the cache
directory or the data
directory is missing.
Rather than catching all the places where the cache
could be used, checking for the cache
directory, and creating a cache
directory if missing, I think the way forward is providing a more informative error message. I'm adding to the existing error message the following: "If you believe you are in a ProjectTemplate directory and seeing this message in error, try running migrate.project(). migrate.project() will ensure the ProjectTemplate structure is consistent with your version of ProjectTemplate."
Sounds great! I agree!