Ticket #12670 (closed enhancement: fixed)

Opened 15 months ago

Last modified 15 months ago

Store lazy import caches in .sage/cache/ rather than in .sage

Reported by: jhpalmieri Owned by: jason
Priority: minor Milestone: sage-5.0
Component: misc Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers: Florent Hivert
Authors: John Palmieri Merged in: sage-5.0.beta10
Dependencies: Stopgaps:

Description

After building and running many versions of Sage, my .sage directory is littered with files with names like

_Applications_sage_builds_sage-5.0.beta7-gcc_devel_sage-main-lazy_import_cache.pickle

We should instead store these in a subdirectory of .sage. The attached patch makes this change.

Attachments

trac_12670-lazy-cache.patch Download (1.6 KB) - added by jhpalmieri 15 months ago.
(Sage library)

Change History

Changed 15 months ago by jhpalmieri

(Sage library)

comment:1 Changed 15 months ago by jhpalmieri

  • Status changed from new to needs_review

comment:2 Changed 15 months ago by hivert

Hi John,

I noticed the same for me. Thanks for tacking care of that. By the way, in my .sage the mentioned file are all only 6 bytes long which seems to be rather small for a cache. Is it normal ? Is the cache actually working ?

Florent

comment:3 follow-up: ↓ 4 Changed 15 months ago by jhpalmieri

Hi Florent,

My files are only 6 bytes long, too. I don't know anything about the actual code involved in the caches, so I don't know if they're working. (I think they may be the first step toward something more significant, but I'm not sure.) In any case, it's certainly ridiculous to have files with ugly names over 80 characters long, especially if they only contain 6 bytes, stored in a semi-public place.

comment:4 in reply to: ↑ 3 Changed 15 months ago by hivert

  • Reviewers set to Florent Hivert

My files are only 6 bytes long, too. I don't know anything about the actual code involved in the caches, so I don't know if they're working. (I think they may be the first step toward something more significant, but I'm not sure.) In any case, it's certainly ridiculous to have files with ugly names over 80 characters long, especially if they only contain 6 bytes, stored in a semi-public place.

Sure ! I'm reviewing your code and ask for those file on sage-devel. Right no I think it is ready to go I just want to wait the results of the tests.

Florent

comment:5 Changed 15 months ago by nbruin

The only calls to save_cache_file I've been able to find are in sage/all.py (this file is apparently skipped by search_src) and in the doctest of save_cache_file. This cache only seems to be involved with get_star_imports and that only gets used in sage.misc.lazy_import if there is a "*" in the input. So indeed, this cache is never used as far as I can see.

comment:6 Changed 15 months ago by hivert

  • Status changed from needs_review to positive_review

The test passes and the code looks good so I'm ok to set the positive review. However, something else has to be done: either to expand the cases where the cache is used or simply to remove it at all. In the mean time I feel that the patch here should enter sage.

comment:7 Changed 15 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.0.beta10
Note: See TracTickets for help on using tickets.