def compute(self, value, sync=False): """Get the actual value If not using dask then this returns the value directly since it already is computed If using dask and sync=True then this waits and resturns the actual wait. If using dask and sync=False then this returns a future, on which you will need to call .result() :param value: :return: """ if self._using_dask: start = time.time() if self.client is None: return value.compute() else: future = self.client.compute(value, sync=sync) wait(future) if self._verbose: duration = time.time() - start log.debug( "arlexecute.compute: Execution using Dask took %.3f seconds" % duration) print( "arlexecute.compute: Execution using Dask took %.3f seconds" % duration) return future elif self._using_dlg: kwargs = {'client': self._client} if self._client else {} return dlg_compute(value, **kwargs) else: return value
def compute(self, val): return dlg_compute(val)