Exemple #1
0
 def onConverted(result):
     if isinstance(result, Exception):
         future.set_exception(result)
     else:
         future.set_result(
             RemotePythonObject.DefinedRemotePythonObject(
                 objectId, self))
Exemple #2
0
 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)
Exemple #3
0
        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)
Exemple #4
0
        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)
Exemple #5
0
        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)
Exemple #6
0
 def _resolveFutureToComputedObject(self, future, jsonResult):
     self._resolve_future(
         future,
         RemotePythonObject.ComputedRemotePythonObject(
             future._computedValue, self, 'status' in jsonResult
             and jsonResult['status'] == "exception"))
Exemple #7
0
 def onConverted(result):
     if not isinstance(result, Exception):
         result = RemotePythonObject.DefinedRemotePythonObject(
             objectId, self)
     self._resolve_future(future, result)
Exemple #8
0
 def _resolveFutureToComputedObject(self, future):
     self._resolve_future(
         future,
         RemotePythonObject.ComputedRemotePythonObject(future._executorState,
                                                       self)
         )
Exemple #9
0
 def _resolveFutureToComputedObject(self, future):
     future.set_result(
         RemotePythonObject.ComputedRemotePythonObject(
             future._executorState, self))