

def send_apply_message(self, socket, f, args=None, kwargs=None, subheader=None, track=False, ident=None):
    'construct and send an apply message via a socket.\n        \n        This is the principal method with which all engine execution is performed by views.\n        '
    assert (not self._closed), "cannot use me anymore, I'm closed!"
    args = (args if (args is not None) else [])
    kwargs = (kwargs if (kwargs is not None) else {
        
    })
    subheader = (subheader if (subheader is not None) else {
        
    })
    if (not isinstance(f, collections.Callable)):
        raise TypeError(('f must be callable, not %s' % type(f)))
    if (not isinstance(args, (tuple, list))):
        raise TypeError(('args must be tuple or list, not %s' % type(args)))
    if (not isinstance(kwargs, dict)):
        raise TypeError(('kwargs must be dict, not %s' % type(kwargs)))
    if (not isinstance(subheader, dict)):
        raise TypeError(('subheader must be dict, not %s' % type(subheader)))
    bufs = util.pack_apply_message(f, args, kwargs)
    msg = self.session.send(socket, 'apply_request', buffers=bufs, ident=ident, subheader=subheader, track=track)
    msg_id = msg['msg_id']
    self.outstanding.add(msg_id)
    if ident:
        if isinstance(ident, list):
            ident = ident[(- 1)]
        if (ident in list(self._engines.values())):
            self._outstanding_dict[ident].add(msg_id)
    self.history.append(msg_id)
    self.metadata[msg_id]['submitted'] = datetime.now()
    return socket

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client.send_apply_message/VarMisuse@354/540 `msg`->`socket`