[yt-svn] commit/yt: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Sep 19 06:43:34 PDT 2017


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/6ae841143cb2/
Changeset:   6ae841143cb2
User:        ngoldbaum
Date:        2017-09-18 18:15:00+00:00
Summary:     cache dataset load args and kwargs in dataset cache keys
Affected #:  1 file

diff -r fccca1fb4d585d705867a553e7fd5ec94ac7181d -r 6ae841143cb22321e8811e1b4d5593b00966108d yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -24,6 +24,7 @@
 
 from collections import defaultdict
 from yt.extern.six import add_metaclass, string_types
+from six.moves import cPickle
 
 from yt.config import ytcfg
 from yt.fields.derived_field import \
@@ -252,14 +253,15 @@
                 obj.__init__(filename, *args, **kwargs)
             return obj
         apath = os.path.abspath(filename)
+        cache_key = (apath, cPickle.dumps(args), cPickle.dumps(kwargs))
         if ytcfg.getboolean("yt","skip_dataset_cache"):
             obj = object.__new__(cls)
-        elif apath not in _cached_datasets:
+        elif cache_key not in _cached_datasets:
             obj = object.__new__(cls)
             if obj._skip_cache is False:
-                _cached_datasets[apath] = obj
+                _cached_datasets[cache_key] = obj
         else:
-            obj = _cached_datasets[apath]
+            obj = _cached_datasets[cache_key]
         return obj
 
     def __init__(self, filename, dataset_type=None, file_style=None,


https://bitbucket.org/yt_analysis/yt/commits/0552159e1ffc/
Changeset:   0552159e1ffc
User:        xarthisius
Date:        2017-09-19 13:42:44+00:00
Summary:     Merge pull request #1560 from ngoldbaum/dataset-caching-improvement

cache dataset args and kwargs in dataset cache keys
Affected #:  1 file

diff -r fccca1fb4d585d705867a553e7fd5ec94ac7181d -r 0552159e1ffc1d2caa3d29e446aa3d78d5218e4f yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -24,6 +24,7 @@
 
 from collections import defaultdict
 from yt.extern.six import add_metaclass, string_types
+from six.moves import cPickle
 
 from yt.config import ytcfg
 from yt.fields.derived_field import \
@@ -252,14 +253,15 @@
                 obj.__init__(filename, *args, **kwargs)
             return obj
         apath = os.path.abspath(filename)
+        cache_key = (apath, cPickle.dumps(args), cPickle.dumps(kwargs))
         if ytcfg.getboolean("yt","skip_dataset_cache"):
             obj = object.__new__(cls)
-        elif apath not in _cached_datasets:
+        elif cache_key not in _cached_datasets:
             obj = object.__new__(cls)
             if obj._skip_cache is False:
-                _cached_datasets[apath] = obj
+                _cached_datasets[cache_key] = obj
         else:
-            obj = _cached_datasets[apath]
+            obj = _cached_datasets[cache_key]
         return obj
 
     def __init__(self, filename, dataset_type=None, file_style=None,

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list