[yt-svn] commit/yt: xarthisius: Merged in ngoldbaum/yt (pull request #1727)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Sep 3 10:28:46 PDT 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/a7c319c1f87d/
Changeset: a7c319c1f87d
Branch: yt
User: xarthisius
Date: 2015-09-03 17:28:35+00:00
Summary: Merged in ngoldbaum/yt (pull request #1727)
Explicitly implement parallel loop for TimeSeriesData.piter()
Affected #: 1 file
diff -r 7d5ab03e0df9cb25e4b5deb94145e610270163f0 -r a7c319c1f87d4b749aa6feb737da504e43a7defb yt/data_objects/time_series.py
--- a/yt/data_objects/time_series.py
+++ b/yt/data_objects/time_series.py
@@ -156,7 +156,7 @@
def __iter__(self):
# We can make this fancier, but this works
for o in self._pre_outputs:
- if isinstance(o, str):
+ if isinstance(o, string_types):
ds = load(o, **self.kwargs)
self._setup_function(ds)
yield ds
@@ -170,7 +170,7 @@
# This will return a sliced up object!
return DatasetSeries(self._pre_outputs[key], self.parallel)
o = self._pre_outputs[key]
- if isinstance(o, str):
+ if isinstance(o, string_types):
o = load(o, **self.kwargs)
self._setup_function(o)
return o
@@ -248,13 +248,31 @@
"""
dynamic = False
- if self.parallel == False:
+ if self.parallel is False:
njobs = 1
else:
- if self.parallel == True: njobs = -1
- else: njobs = self.parallel
- return parallel_objects(self, njobs=njobs, storage=storage,
- dynamic=dynamic)
+ if self.parallel is True:
+ njobs = -1
+ else:
+ njobs = self.parallel
+
+ for output in parallel_objects(self._pre_outputs, njobs=njobs,
+ storage=storage, dynamic=dynamic):
+ if storage is not None:
+ sto, output = output
+
+ if isinstance(output, string_types):
+ ds = load(output, **self.kwargs)
+ self._setup_function(ds)
+ else:
+ ds = output
+
+ if storage is not None:
+ next_ret = (sto, ds)
+ else:
+ next_ret = ds
+
+ yield next_ret
def eval(self, tasks, obj=None):
tasks = ensure_list(tasks)
@@ -323,13 +341,13 @@
"""
- if isinstance(filenames, str):
+ if isinstance(filenames, string_types):
filenames = get_filenames_from_glob_pattern(filenames)
# This will crash with a less informative error if filenames is not
# iterable, but the plural keyword should give users a clue...
for fn in filenames:
- if not isinstance(fn, str):
+ if not isinstance(fn, string_types):
raise YTOutputNotIdentified("DataSeries accepts a list of "
"strings, but "
"received {0}".format(fn))
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