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

Use cached property in commands validation #295

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Aug 15, 2023

Description

This just moves to code to use a nicer pattern for cached properties. This required a slight change in when the exclude intervals are fetched from Google sheets.

The PR also makes one small out-of-scope change to remove the unused update_tlm() base method. That originally served a purpose but is no longer used.

Interface impacts

Testing

Used local ska3-performance installation.

Unit tests

  • Mac (importantly the newly-available validation regression tests)
(ska3-perf) ➜  kadi git:(use-cached-property) git rev-parse HEAD             
87bf8716ac03e51bef60a2f53f21d609df3e67f9
(ska3-perf) ➜  kadi git:(use-cached-property) pytest kadi
==================================================== test session starts ====================================================
platform darwin -- Python 3.10.8, pytest-7.2.1, pluggy-1.0.0
rootdir: /Users/aldcroft/git, configfile: pytest.ini
plugins: timeout-2.1.0, anyio-3.6.2
collected 218 items                                                                                                         

kadi/commands/tests/test_commands.py ...........................................................................      [ 34%]
kadi/commands/tests/test_states.py ......................x.............................................x............. [ 72%]
..........                                                                                                            [ 76%]
kadi/commands/tests/test_validate.py ...................                                                              [ 85%]
kadi/tests/test_events.py ..........                                                                                  [ 89%]
kadi/tests/test_occweb.py ......................                                                                      [100%]

======================================== 216 passed, 2 xfailed in 135.94s (0:02:15) =========================================

Independent check of unit tests by Jean

  • Linux

Functional tests

No functional testing.

@taldcroft taldcroft self-assigned this Aug 15, 2023
@taldcroft taldcroft force-pushed the use-cached-property branch 2 times, most recently from 1b670dc to d9b77d5 Compare November 21, 2023 20:07
@taldcroft taldcroft changed the base branch from master to numpydoc November 21, 2023 20:08
@taldcroft taldcroft changed the title WIP: Use cached property Use cached property in commands validation Nov 21, 2023
Base automatically changed from numpydoc to master November 21, 2023 22:15
@taldcroft taldcroft changed the base branch from master to validate-unit-test November 22, 2023 16:33
@jeanconn jeanconn mentioned this pull request Nov 24, 2023
1 task
Base automatically changed from validate-unit-test to master November 24, 2023 18:28
f"Fetching telemetry for {self.msids} between {self.start.date} and"
f" {self.stop.date}"
)
_tlm = get_telem_table(self.msids, self.start, self.stop)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're moving away from using attributes directly to store these (viaCLS._attribute_names) it feels a little odd to bother with the underscore names, as we tend not to use them generally.

Copy link
Member Author

@taldcroft taldcroft Nov 29, 2023

Choose a reason for hiding this comment

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

This is to not overload the method function itself. I.e. inside def tlm(self), tlm is defined as the unbound method. A type checker or IDE will notice stuff like this. I could call everything out but I think the current naming somewhat hints at the property-ness of the methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, I wasn't suggesting tlm as the replacement but fine to leave these with the current naming hinting at the property-ness of the internals.

@taldcroft taldcroft merged commit a0059af into master Nov 29, 2023
4 checks passed
@taldcroft taldcroft deleted the use-cached-property branch November 29, 2023 18:55
This was referenced Jan 9, 2024
@javierggt javierggt mentioned this pull request Feb 6, 2024
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.

2 participants