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

Fix: order_by to respect alt #1093

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix: order_by to respect alt #1093

wants to merge 3 commits into from

Conversation

relikd
Copy link
Contributor

@relikd relikd commented Nov 23, 2022

Add missing alt in pad query.

Issue(s) Resolved

Fixes #1092

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)

@@ -1078,7 +1078,7 @@ def get_order_by(self):
"""Returns the order that should be used."""
if self._order_by is not None:
return self._order_by
base_record = self.pad.get(self.path)
base_record = self.pad.get(self.path, alt=self.alt)
Copy link
Contributor

@dairiki dairiki Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like, in this case, we are interested only in base_record.datamodel. The datamodel does not depend on any of the record's .lr files (regardless of alt). Perhaps we should figure out a way that we end up only declaring a dependency on the datamodel .ini file (and and .ini files of datamodels from which it inherits)?

More investigation is probably required to determine whether such an optimization would buy us much (in terms of reducing unnecessary recorded dependencies, and thus reducing unnecessary rebuilds).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this is related to part of PR #1007, where dependency tracking is done in Record.getitem.

Moving dependency tracking to attribute accessors (of both Records and DataModels) rather than recording the dependency upon record traversal would fix this...

Copy link
Contributor Author

@relikd relikd Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this is an issue for all queries with non-default alt. self.pad.get will access the primary alt in that case and record a dependency. I would be happy if, in this case, the datamodel could be accessed without requesting the record and thus avoid a dependency. But for the time being (if an actual fix will take too long) I would appreciate if the alt would be set as a hotfix. This at least prevents unnecessary rebuilds of alternatives if a primary alt page changes.

And dependency tracking via attributes would be superb. There is another issue from 2016 I think where this was proposed. So dependency tracking could finally be applied to individual fields rather than files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And dependency tracking via attributes would be superb. There is another issue from 2016 I think where this was proposed. So dependency tracking could finally be applied to individual fields rather than files.

Yes, that would be nice, but is probably a lot of work, and is not quite what I'm referring to.

My point is that just because a record is fetched (via Pad.get) during the building of an artifact, that does not mean, necessarily, that that artifact depends on that record's source files. It might be better to defer the recording of the dependency until such time as one of the record's fields is accessed, since that does imply a dependency on the source file.

@relikd
Copy link
Contributor Author

relikd commented Nov 27, 2023

I've seen in some release notes that this may have been fixed? Should I close the PR?

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

Successfully merging this pull request may close these issues.

query with alternative records dependency on different alt
2 participants