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 slow displacement test #6652

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Fix slow displacement test #6652

merged 2 commits into from
Jun 13, 2024

Conversation

greenape
Copy link
Member

@greenape greenape commented Jun 11, 2024

I have:

  • Formatted any Python files with black
  • Brought the branch up to date with master
  • Added any relevant Github labels
  • Added tests for any new additions
  • Added or updated any relevant documentation
  • Added an Architectural Decision Record (ADR), if appropriate
  • Added an MPLv2 License Header if appropriate
  • Updated the Changelog

Description

Makes a couple of changes to the tests for the Displacement class, which speed up the tests substantially. Namely, storing the reused reference location, and supplying a subscriber subset.


🚀 This description was created by Ellipsis for commit 0df9736

Summary:

Optimized Displacement class tests by caching reference locations and limiting data scope, with modifications to specific tests and methods.

Key points:

  • Optimized Displacement class tests by caching reference locations and limiting data scope.
  • Modified test_get_all_users_in_reference_location and test_subscriber_with_home_loc_but_no_calls_is_nan in flowmachine/tests/test_displacement.py.
  • Added store() method to cache daily_location results.
  • Introduced subscriber_subset to limit data scope in tests.

Generated with ❤️ by ellipsis.dev

@greenape greenape added tests Issues relating to tests FlowMachine Issues related to FlowMachine performance labels Jun 11, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to bc51970 in 43 seconds

More details
  • Looked at 41 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_rh3vqPM03BTJULMG


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

flowmachine/tests/test_displacement.py Show resolved Hide resolved
Copy link

codecov bot commented Jun 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.30%. Comparing base (b3a93b4) to head (0df9736).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6652   +/-   ##
=======================================
  Coverage   92.30%   92.30%           
=======================================
  Files         268      268           
  Lines       10590    10590           
  Branches      856      856           
=======================================
  Hits         9775     9775           
  Misses        676      676           
  Partials      139      139           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on f7c5ac8 in 1 minute and 19 seconds

More details
  • Looked at 32 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_WquEHFAKETXPVxhJ


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

flowmachine/tests/test_displacement.py Show resolved Hide resolved
Copy link

cypress bot commented Jun 12, 2024

Passing run #22840 ↗︎

0 4 0 0 Flakiness 0

Details:

Use reduced subset where possible
Project: FlowAuth Commit: 0df973660c
Status: Passed Duration: 00:51 💡
Started: Jun 13, 2024 8:55 AM Ended: Jun 13, 2024 8:56 AM

Review all test suite changes for PR #6652 ↗︎

@greenape greenape added the ready-to-merge Label indicating a PR is OK to automerge label Jun 12, 2024
@greenape greenape requested a review from Thingus June 12, 2024 12:57
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 3c04dcc in 1 minute and 22 seconds

More details
  • Looked at 32 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_MXWGV53071CzUBPA


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.


assert isnan(df.loc[subscriber].value)
sub = df.loc[subscriber].value
assert sub is None
Copy link
Contributor

Choose a reason for hiding this comment

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

The test expects None for a subscriber with no activity, which contradicts the typical use of NaN for missing numerical data in pandas. Consider reverting this to check for NaN to align with standard practices and the test's intent.

Suggested change
assert sub is None
assert isnan(sub)

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 0df9736 in 2 minutes and 6 seconds

More details
  • Looked at 32 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_shrg1ym9XtEwUD6t


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.


assert isnan(df.loc[subscriber].value)
sub = df.loc[subscriber].value
assert sub is None
Copy link
Contributor

Choose a reason for hiding this comment

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

The test name and assertion contradict each other. The test is named test_subscriber_with_home_loc_but_no_calls_is_nan but asserts that the value is None instead of NaN. If the behavior has changed intentionally, consider renaming the test to reflect the new behavior or adjusting the assertion to match the expected behavior.

Suggested change
assert sub is None
assert isnan(sub)

@greenape greenape merged commit 9ed4076 into master Jun 13, 2024
39 checks passed
@greenape greenape deleted the fix-slow-displacement-test branch June 13, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FlowMachine Issues related to FlowMachine performance ready-to-merge Label indicating a PR is OK to automerge tests Issues relating to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant