New cacheDir causes cache to be ignored(?)

Description

Using a cache across client seems broken when using a custom cache directory.

Repro:

In Python:
!mkdir ~/asdfasdfasdf
syn.cache.cache_root_dir='~/asdfasdfasdf'
f = syn.get('syn4994640')

Then in R:
synapseCacheDir('~/asdfasdfasdf')
ent <- synGet('syn4994640')

Or switch the order between R and Python. Either way the file gets downloaded the second time from R/Python

See

Environment

None

Activity

Show:
Ziming Dong
April 10, 2017, 8:57 PM

that only happens in the constructor. If the user manually assigns the variable it does not get expanded. I've overridden the _setattr_() to expand cache_root_dir

Larsson Omberg
April 10, 2017, 8:52 PM

That is odd: the code specifically includes information to handle this:

also, the default cachdir includes the ~:

Ziming Dong
April 10, 2017, 7:20 PM

it appears the Python client is incorrectly resolving path shortcuts such as '~'.
After setting syn.cache.cache_root_dir='~/asdfasdfasdf', f.path was still pointing to the '/Users/zdong/.synapseCache/' folder.

I then deleted the cache directories and used an absolute path for the cache:
syn.cache.cache_root_dir='/Users/zdong/asdfasdfasdf'
f.path now gives the correct cache location and the R client no longer redownloaded the file.

Fixed

Assignee

Ziming Dong

Reporter

Larsson Omberg

Labels

None

Validator

Thomas Yu

Development Area

None

Release Version History

None

Slack Channel

None

Fix versions

Priority

Major