Skip to content

memory: add test for call_and_shelve performance#791

Merged
ogrisel merged 8 commits intojoblib:masterfrom
aabadie:call_and_shelve_test
Oct 25, 2018
Merged

memory: add test for call_and_shelve performance#791
ogrisel merged 8 commits intojoblib:masterfrom
aabadie:call_and_shelve_test

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Oct 15, 2018

This test verifies that the call_and_shelve function doesn't perform a load of cached data every time it is used.

The idea is to verify that the access time of the file containing the cached file. It should remain untouched after each calls. And getting result using MemorizedResult.get will change the access time since the data must be read.

See #757

This test verifies call_and_shelve doesn't perform a load of cached data every time it is used
@aabadie aabadie requested a review from ogrisel October 15, 2018 11:55
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 15, 2018

Codecov Report

Merging #791 into master will increase coverage by 0.63%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #791      +/-   ##
==========================================
+ Coverage   94.73%   95.36%   +0.63%     
==========================================
  Files          44       44              
  Lines        6319     6340      +21     
==========================================
+ Hits         5986     6046      +60     
+ Misses        333      294      -39
Impacted Files Coverage Δ
joblib/test/test_memory.py 98.11% <100%> (+0.06%) ⬆️
joblib/_parallel_backends.py 95.6% <0%> (-0.41%) ⬇️
joblib/test/test_memmapping.py 99.41% <0%> (+0.29%) ⬆️
joblib/test/test_parallel.py 96.82% <0%> (+0.57%) ⬆️
joblib/func_inspect.py 95.45% <0%> (+1.13%) ⬆️
joblib/logger.py 86.84% <0%> (+1.31%) ⬆️
joblib/disk.py 81.66% <0%> (+1.66%) ⬆️
joblib/test/common.py 88.13% <0%> (+1.69%) ⬆️
joblib/pool.py 91.37% <0%> (+1.72%) ⬆️
joblib/test/test_store_backends.py 97.05% <0%> (+5.88%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acca6b9...6d3a59e. Read the comment docs.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Oct 15, 2018

Ok, it's failing on windows because the access time is not accurate enough (I found this that explains why).
So the new test is now skipped on NT based OSes.

@aabadie aabadie force-pushed the call_and_shelve_test branch from 18f0bc3 to db8aa11 Compare October 15, 2018 13:05
@aabadie aabadie force-pushed the call_and_shelve_test branch from f5d2ced to 6252e85 Compare October 24, 2018 06:53
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Oct 24, 2018

@ogrisel, I updated the test the way we discussed IRL.

Copy link
Copy Markdown
Contributor

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM.

in str(w[-1].message)


def test_call_and_shelve_performance(tmpdir):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

_performance is really too generic a name. Please rename to "test_call_and_shelve_lazily_load_stored_result".

if test_access_time == os.stat(test_access_time_file.strpath).st_atime:
# Skip this test when access time cannot be retrieved with enough
# precision from the file system (e.g. NTFS on windows).
return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use pytest.skip("filesystem does not support fine-grained access time attribute") to make it explicitly that the test is skipped.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Oct 24, 2018

@ogrisel, comments addressed

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Oct 24, 2018

The appveyor failure seems unrelated

@aabadie aabadie force-pushed the call_and_shelve_test branch from 6ef0d13 to 6d3a59e Compare October 24, 2018 14:43
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Oct 24, 2018

I'v retriggered the CI and now it's all green again.

@ogrisel ogrisel merged commit 013fc83 into joblib:master Oct 25, 2018
yarikoptic added a commit to yarikoptic/joblib that referenced this pull request Apr 12, 2019
* tag '0.13.0':
  Release 0.13.0
  Use https (joblib#805)
  MTN bump loky to 2.4.2 (joblib#804)
  DOC: provide some useful variables for Makefile (joblib#794)
  DOC serialization and processes (joblib#803)
  ENH update loky 2.4.0 (joblib#802)
  FIX backward compatibility for nested backend (joblib#789)
  enable python 3.7 (joblib#795)
  memory: add test for call_and_shelve performance (joblib#791)
  FIX nested backend not changed by SequentialBackend (joblib#792)
  cloudpickle 0.6.0 (joblib#788)
  FIX nested backend setting n_jobs=-1 (joblib#785)
  Raises a more explicit exception when a corrupted MemorizedResult is loaded (joblib#768)
  Back to dev mode
yarikoptic added a commit to yarikoptic/joblib that referenced this pull request Apr 12, 2019
* releases:
  Release 0.13.0
  Use https (joblib#805)
  MTN bump loky to 2.4.2 (joblib#804)
  DOC: provide some useful variables for Makefile (joblib#794)
  DOC serialization and processes (joblib#803)
  ENH update loky 2.4.0 (joblib#802)
  FIX backward compatibility for nested backend (joblib#789)
  enable python 3.7 (joblib#795)
  memory: add test for call_and_shelve performance (joblib#791)
  FIX nested backend not changed by SequentialBackend (joblib#792)
  cloudpickle 0.6.0 (joblib#788)
  FIX nested backend setting n_jobs=-1 (joblib#785)
  Raises a more explicit exception when a corrupted MemorizedResult is loaded (joblib#768)
  Back to dev mode
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