|
From: <ah...@us...> - 2011-11-18 15:34:44
|
Revision: 704
http://pyphant.svn.sourceforge.net/pyphant/?rev=704&view=rev
Author: aheld84
Date: 2011-11-18 15:34:32 +0000 (Fri, 18 Nov 2011)
Log Message:
-----------
Merge branch 'master' into svn-trunk
* master:
Fix: PyTablesPersister: Annotations of Recipes
Modified Paths:
--------------
trunk/src/pyphant/pyphant/core/PyTablesPersister.py
trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py
Modified: trunk/src/pyphant/pyphant/core/PyTablesPersister.py
===================================================================
--- trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2011-11-18 15:01:02 UTC (rev 703)
+++ trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2011-11-18 15:34:32 UTC (rev 704)
@@ -109,6 +109,7 @@
def saveRecipe(h5, recipe, saveResults=True):
recipeGroup = h5.createGroup("/", "recipe")
h5.createGroup("/", "results")
+ h5.setNodeAttr(recipeGroup, "Annotations", recipe._annotations)
workers = recipe.getWorkers()
for worker in workers:
saveWorker(h5, recipeGroup, worker, saveResults)
@@ -257,7 +258,11 @@
def loadRecipe(h5):
recipeGroup = h5.root.recipe
- recipe = CompositeWorker.CompositeWorker()
+ try:
+ annotations = recipeGroup._v_attrs.Annotations
+ except AttributeError:
+ annotations = {}
+ recipe = CompositeWorker.CompositeWorker(annotations=annotations)
workers = {}
createWorkerGraph(recipeGroup, workers, recipe)
restoreResultsToWorkers(recipeGroup, workers, h5)
Modified: trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py
===================================================================
--- trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py 2011-11-18 15:01:02 UTC (rev 703)
+++ trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py 2011-11-18 15:34:32 UTC (rev 704)
@@ -244,7 +244,7 @@
from pyphant.core.CompositeWorker import CompositeWorker
from pyphant.core.WorkerRegistry import WorkerRegistry
from itertools import chain
- recipe = CompositeWorker()
+ recipe = CompositeWorker(annotations={'foo':42.0, 'bar':u'Hääh?'})
wreg = WorkerRegistry.getInstance()
workerInfos = [t.workerInfos for t in wreg.getToolBoxInfoList()]
for wInfo in chain(*workerInfos):
@@ -261,6 +261,7 @@
loadedWorkerNames = [w.name for w in loadedWorkers]
for name in loadedWorkerNames:
self.assertTrue(name in workerNames)
+ self.assertEqual(recipe._annotations, loadedRecipe._annotations)
if __name__ == "__main__":
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|