def sendFuture(self, future):
        """Send a Future to be executed remotely."""
        future = copy.copy(future)
        future.greenlet = None
        future.children = {}

        try:
            if shared.getConst(hash(future.callable), timeout=0):
                # Enforce name reference passing if already shared
                future.callable = SharedElementEncapsulation(hash(future.callable))
            self.socket.send_multipart([
                TASK,
                pickle.dumps(future.id, pickle.HIGHEST_PROTOCOL),
                pickle.dumps(future, pickle.HIGHEST_PROTOCOL),
            ])
        except (pickle.PicklingError, TypeError) as e:
            # If element not picklable, pickle its name
            # TODO: use its fully qualified name
            scoop.logger.warn("Pickling Error: {0}".format(e))
            future.callable = hash(future.callable)
            self.socket.send_multipart([
                TASK,
                pickle.dumps(future.id, pickle.HIGHEST_PROTOCOL),
                pickle.dumps(future, pickle.HIGHEST_PROTOCOL),
            ])
def sendFuture ( self , future ) : future = copy . copy ( future ) future . greenlet = None future . children = { } try : if shared . getConst ( hash ( future . callable ) , timeout = 0 ) : future . callable = SharedElementEncapsulation ( hash ( future . callable ) ) self . socket . send_multipart ( [ TASK , pickle . dumps ( future . id , pickle . HIGHEST_PROTOCOL ) , pickle . dumps ( future , pickle . HIGHEST_PROTOCOL ) , ] ) except ( pickle . PicklingError , TypeError ) as e : scoop . logger . warn ( "Pickling Error: {0}" . format ( e ) ) future . callable = hash ( future . callable ) self . socket . send_multipart ( [ TASK , pickle . dumps ( future . id , pickle . HIGHEST_PROTOCOL ) , pickle . dumps ( future , pickle . HIGHEST_PROTOCOL ) , ] )
Send a Future to be executed remotely.