[Yt-svn] yt-commit r1161 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Tue Feb 3 15:20:44 PST 2009


Author: mturk
Date: Tue Feb  3 15:20:43 2009
New Revision: 1161
URL: http://yt.spacepope.org/changeset/1161

Log:
getting dependencies for fields, if the fields may or may not be derived rather
than in the files, was confusing the preloader.  Now we not only check before
the read operation to see if the fields are there, but we also catch the errors
from the reader.  We should have been catching these errors anyway, because if
the preloader fails it is *non-fatal* but *hard to debug*.



Modified:
   trunk/yt/lagos/DataReadingFuncs.py

Modified: trunk/yt/lagos/DataReadingFuncs.py
==============================================================================
--- trunk/yt/lagos/DataReadingFuncs.py	(original)
+++ trunk/yt/lagos/DataReadingFuncs.py	Tue Feb  3 15:20:43 2009
@@ -246,15 +246,23 @@
     def preload(self, grids, sets):
         # We need to deal with files first
         files_keys = defaultdict(lambda: [])
-        sets = list(sets)
+        pf_field_list = grids[0].pf.h.field_list
+        sets = [dset for dset in list(sets) if dset in pf_field_list]
         for g in grids: files_keys[g.filename].append(g)
+        exc = getExceptionHDF5()
         for file in files_keys:
             mylog.debug("Starting read %s (%s)", file, sets)
             nodes = [g.id for g in files_keys[file]]
             nodes.sort()
-            data = HDF5LightReader.ReadMultipleGrids(file, nodes, sets)
-            mylog.debug("Read %s items from %s", len(data), os.path.basename(file))
-            for gid in data: self.queue[gid].update(data[gid])
+            # We want to pass on any error we might expect -- the preload
+            # phase should be non-fatal in all cases, and instead dump back to
+            # the grids.
+            try:
+                data = HDF5LightReader.ReadMultipleGrids(file, nodes, sets)
+                mylog.debug("Read %s items from %s", len(data), os.path.basename(file))
+                for gid in data: self.queue[gid].update(data[gid])
+            except exc:
+                pass
         mylog.debug("Finished read of %s", sets)
 
 class DataQueueInMemory(BaseDataQueue):



More information about the yt-svn mailing list