Closed 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q closed 3 hours ago
As @fbenke-pik discovered, the situation is somewhat different. madrat
only fingerprints functions if their package is registered through madratAttach()
, which all packages do during attachment, and packages are only attached when they are Depends
dependencies of packages that are being attached themselves. Otherwise they are only loaded.
Two possible solutions present themselves:
Depends
dependencies, with the ensuing bloated search paths.madratAttach()
during .onLoad()
.The first is actually the policy we currently have in place. I think the 2nd solution does not work as madratAttach() in some cases needs to happen before .onLoad is being run.
The first is actually the policy we currently have in place.
As in "an undocumented policy in contradiction to the stated 'R Language Rules'"?
I think the 2nd solution does not work as madratAttach() in some cases needs to happen before .onLoad is being run.
.onLoad()
runs before .onAttach()
.
This bug does not affect input data generation currently, but has the potential to screw it up in intractable ways.
For context, see pik-piam/mrremind#573, pik-piam/GDPuc#38 and this discussion.
Two facts can conspire to break the madrat caching for input data preparation.
to be discovered by
madrat
and have their functions included in the fingerprinting for cache invalidation.Using plausible changes to the
mrdriver
package [↑] as an example,GDPuc
is loaded, but never attached. (So this is wrong.) Consequently,madrat
caching ingnorestoolConvertGDP()
in the fingerprinting, possibly leading to corrupted caches.Yes, there is a warning. But the warnings of the input data generation are ignored as a matter of policy, and truncated to 50 in any case.
Actually attaching, not only loading
GDPuc
yields different result:This is not an issue currently for input data generation, as
GDPuc
is imported explicitly in several packages (mrcommons
,mrfactors
,mrfaocore
,mrland
,mrremind
,mrvalidation
,piamInterfaces
). But should that be changed, caches will rot.