[Yt-svn] yt-commit r992 - trunk/yt

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Tue Dec 9 13:24:35 PST 2008


Author: mturk
Date: Tue Dec  9 13:24:34 2008
New Revision: 992
URL: http://yt.spacepope.org/changeset/992

Log:


Added a new decorator, @rootonly -- but it discards retval.



Modified:
   trunk/yt/funcs.py

Modified: trunk/yt/funcs.py
==============================================================================
--- trunk/yt/funcs.py	(original)
+++ trunk/yt/funcs.py	Tue Dec  9 13:24:34 2008
@@ -155,6 +155,14 @@
 except ImportError:
     defaultdict = __defaultdict
 
+def rootonly(func):
+    def donothing(*args, **kwargs):
+        return
+    def dosomething(*args, **kwargs):
+        func(*args, **kwargs)
+    if ytcfg.getint("yt","__parallel_rank") > 0: dosomething
+    return dosomething
+
 def only_on_root(func, *args, **kwargs):
     from yt.config import ytcfg
     if not ytcfg.getboolean("yt","__parallel"):



More information about the yt-svn mailing list