Skip to content
This repository has been archived by the owner on Mar 31, 2019. It is now read-only.

Commit

Permalink
fix nested updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed May 30, 2018
1 parent 894719c commit 33ded45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions oamap/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def action(self, *args, **kwargs):
for n, x in oamap.operations.actions.items():
setattr(Operable, n, oamap.util.MethodType(newaction(n, x), None, Operable))

def _nooperations(self):
return len(self._operations) == 0

def _notransformations(self):
return all(isinstance(x, Recasting) for x in self._operations)

Expand Down Expand Up @@ -195,7 +198,10 @@ def arrays(self):
return DataArrays(self._backends)

def transform(self, name, namespace, update):
if self._notransformations():
if self._nooperations():
return [SingleThreadExecutor.PseudoFuture(update(self))]

elif self._notransformations():
result = self()
for operation in self._operations:
result = operation.apply(result)
Expand Down Expand Up @@ -396,7 +402,10 @@ def arrays(self, partitionid):
return DatasetArrays(normid, startsrole, stopsrole, self._offsets[normid + 1] - self._offsets[normid], self._backends)

def transform(self, name, namespace, update):
if self._notransformations():
if self._nooperations():
return [SingleThreadExecutor.PseudoFuture(update(self))]

elif self._notransformations():
result = self.partition(0)
for operation in self._operations:
result = operation.apply(result)
Expand Down
2 changes: 1 addition & 1 deletion oamap/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ def {fill}({view}, {primitive}, {mask}{params}):
fcn=fcnname,
maskedvalue=oamap.generator.Masked.maskedvalue), env)
fill = oamap.util.trycompile(env[fillname], numba=numba)

primitive = numpy.empty(len(view), dtype=fieldtype.dtype)
mask = numpy.empty(len(view), dtype=oamap.generator.Masked.maskdtype)
fill(*((view, primitive, mask) + args))
Expand Down

0 comments on commit 33ded45

Please sign in to comment.