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

Replace Node$fields and Node$fieldsAll with Node$attributes* #3

Open
brownag opened this issue Mar 26, 2021 · 5 comments
Open

Replace Node$fields and Node$fieldsAll with Node$attributes* #3

brownag opened this issue Mar 26, 2021 · 5 comments

Comments

@brownag
Copy link
Member

brownag commented Mar 26, 2021

I believe this is issued on install when the the .rdata files for the data.tree objects are moved to lazyload db.

I figured it would be resolved by re-building/re-saving the objects with a current version of {data.tree}... but no such luck. They build fine, no messages. Perhaps it will resolve itself? We do not use either of these R6 methods directly in the scripts to build the trees for tree_calc.

*** moving datasets to lazyload DB
[1] "Node$fields will be deprecated in the next release. Please use Node$attributes instead."
[1] "Node$fieldsAll will be deprecated in the next release. Please use Node$attributesAll instead."
... [repeated]

We could take an alternate approach where we store a .rda of a data.frame which is "promoted" to a suitable Node/data.tree via a pathString. That is "simpler" than storing a serialized R6 object for a few reasons...

We can make the data.tree as is currently done in e.g. https://github.com/ncss-tech/interpretation-engine/blob/master/misc/internal-datasets/HSG/tr.hsg.R via a function "on the fly" (possibly based on user input/parameters) or on package load or similar.

@Matherion
Copy link

Hey @brownag and @dylanbeaudette! Did you perhaps find a solution for this? I'll also reach out to the data.tree developers, but the last update to the package was about 3 years ago. On the other hand, this error is starting to drive me crazy 😬 It also seems to be triggered now in R by, well, pretty much anything once you have a data.tree object in memory 🙂

@brownag
Copy link
Member Author

brownag commented Aug 20, 2023

@Matherion

A general fix, but keeping the data.tree in .rda files, would be to set LazyData: false in DESCRIPTION, then load the datasets with data() in interactive use, or load(system.file(...)) internally, which seems not to cause the $fields or $fieldsAll to be called.

The datasets could alternately, as I proposed above, be be simple (e.g. data.frame) representation of the information to build the data.tree. On load a data.tree object would be constructed from the source data and kept in the package environment, a custom environment, or similar. Access to these internal objects would be by functions that check if the object has been loaded, if not load and build it. We have not done much development on this package internals recently, and none of our code calls $fields or $fieldsAll so I don't find that we run up against the messages much in general use.

The messages (and Node $fields / $fieldsAll) need to be removed from data.tree, actually deprecating them as the message says will cause all sorts of warnings to be issued in the same way that we currently get print() output.

It does not appear to me that any code internal to the data.tree package calls them, but rather this is the result of some internal iteration over those objects for lazy loading, and also possibly things like the IDE interrogating objects in the environment?

@Matherion
Copy link

That seems great, thanks! 🙏
I'll link to this from gluc/data.tree#166 and try to find out whether there is any chance of an update to the package 😬

@gluc
Copy link

gluc commented Nov 11, 2023

Sorry for the late reply. Will be fixed in the next release, due for Nov 2023.

@brownag
Copy link
Member Author

brownag commented Nov 12, 2023

Thanks @gluc!! Just as a heads up, with data.tree 1.1.0, and lazy loading data.tree objects built with 1.1.0, we now get the following:

==> R CMD INSTALL --preclean --no-multiarch --with-keep.source interpretation-engine

* installing to library ‘/home/andrew/R/x86_64-pc-linux-gnu-library/4.3’
* installing *source* package ‘InterpretationEngine’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
Warning: 'Node$fields' is deprecated.
Use 'Node$attributes' instead.
See help("Deprecated")
Warning: 'Node$fieldsAll' is deprecated.
Use 'Node$attributesAll' instead.
See help("Deprecated")
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (InterpretationEngine)

In R CMD CHECK we get this, which is a bit "worse" than the print() messages we had before:

─  checking whether package ‘InterpretationEngine’ can be installed ... [32s/32s] WARNING (32s)
   Found the following significant warnings:
     Warning: 'Node$fields' is deprecated.
     Warning: 'Node$fieldsAll' is deprecated.
   See ‘/home/andrew/workspace/InterpretationEngine.Rcheck/00install.out’ for details.

Again, we never explicitly reference $fields or $fieldsAll, but during lazy loading apparently these are called repeatedly. This is not a huge problem for this package specifically because it is not on CRAN.

I was planning on removing lazy loading, and possibly not storing the data.tree objects at all anymore, so will likely implement that for the time being until these are completely removed.

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

3 participants