def onConverted(result): if isinstance(result, Exception): future.set_exception(result) else: future.set_result( RemotePythonObject.DefinedRemotePythonObject( objectId, self))
def onExpanded(jsonResult): result = jsonResult if not isinstance(jsonResult, Exception): if jsonResult['isException']: result = Exceptions.ComputationError( self.objectRehydrator.convertJsonResultToPythonObject( jsonResult['result']), jsonResult['trace']) else: assert isinstance(jsonResult['dictOfProxies'], dict) result = { k: RemotePythonObject.ComputedRemotePythonObject( v, self, False) for k, v in jsonResult['dictOfProxies'].iteritems() } self._resolve_future(future, result)
def onExpanded(jsonResult): result = jsonResult if not isinstance(jsonResult, Exception): if jsonResult['isException']: result = Exceptions.ComputationError( self.objectRehydrator.convertJsonResultToPythonObject( jsonResult['result']), jsonResult['trace']) else: assert isinstance(jsonResult['tupleOfComputedValues'], tuple) result = tuple( RemotePythonObject.ComputedRemotePythonObject( val, self, False) for val in jsonResult['tupleOfComputedValues']) self._resolve_future(future, result)
def onExpanded(jsonResult): if isinstance(jsonResult, Exception): future.set_exception(jsonResult) return if jsonResult['isException']: result = self.objectRehydrator.convertJsonResultToPythonObject( jsonResult['result']) future.set_exception( Exceptions.ComputationError(result, jsonResult['trace'])) return assert isinstance(jsonResult['tupleOfComputedValues'], tuple) tupleOfProxies = \ tuple([ RemotePythonObject.ComputedRemotePythonObject(val, self) \ for val in jsonResult['tupleOfComputedValues'] ]) future.set_result(tupleOfProxies)
def onExpanded(jsonResult): if isinstance(jsonResult, Exception): future.set_exception(jsonResult) return if jsonResult['isException']: result = self.objectRehydrator.convertJsonResultToPythonObject( jsonResult['result']) future.set_exception( Exceptions.ComputationError(result, jsonResult['trace'])) return assert isinstance(jsonResult['dictOfProxies'], dict) dictOfProxies = {} for k, v in jsonResult['dictOfProxies'].iteritems(): dictOfProxies[ k] = RemotePythonObject.ComputedRemotePythonObject( v, self) future.set_result(dictOfProxies)
def _resolveFutureToComputedObject(self, future, jsonResult): self._resolve_future( future, RemotePythonObject.ComputedRemotePythonObject( future._computedValue, self, 'status' in jsonResult and jsonResult['status'] == "exception"))
def onConverted(result): if not isinstance(result, Exception): result = RemotePythonObject.DefinedRemotePythonObject( objectId, self) self._resolve_future(future, result)
def _resolveFutureToComputedObject(self, future): self._resolve_future( future, RemotePythonObject.ComputedRemotePythonObject(future._executorState, self) )
def _resolveFutureToComputedObject(self, future): future.set_result( RemotePythonObject.ComputedRemotePythonObject( future._executorState, self))