asyncclient.py
42 lines
| 1.5 KiB
| text/x-python
|
PythonLexer
Brian Granger
|
r2306 | #!/usr/bin/env python | ||
Brian E Granger
|
r1234 | # encoding: utf-8 | ||
"""Asynchronous clients for the IPython controller. | ||||
This module has clients for using the various interfaces of the controller | ||||
in a fully asynchronous manner. This means that you will need to run the | ||||
Twisted reactor yourself and that all methods of the client classes return | ||||
deferreds to the result. | ||||
The main methods are are `get_*_client` and `get_client`. | ||||
""" | ||||
Brian Granger
|
r2306 | #----------------------------------------------------------------------------- | ||
# Copyright (C) 2008-2009 The IPython Development Team | ||||
Brian E Granger
|
r1234 | # | ||
# Distributed under the terms of the BSD License. The full license is in | ||||
# the file COPYING, distributed as part of this software. | ||||
Brian Granger
|
r2306 | #----------------------------------------------------------------------------- | ||
Brian E Granger
|
r1234 | |||
Brian Granger
|
r2306 | #----------------------------------------------------------------------------- | ||
Brian E Granger
|
r1234 | # Imports | ||
Brian Granger
|
r2306 | #----------------------------------------------------------------------------- | ||
Brian E Granger
|
r1234 | |||
from IPython.kernel import codeutil | ||||
Brian Granger
|
r2306 | from IPython.kernel.clientconnector import ( | ||
AsyncClientConnector, | ||||
AsyncCluster | ||||
) | ||||
Brian E Granger
|
r1234 | |||
# Other things that the user will need | ||||
Brian E Granger
|
r1395 | from IPython.kernel.task import MapTask, StringTask | ||
Brian E Granger
|
r1234 | from IPython.kernel.error import CompositeError | ||
Brian Granger
|
r2306 | #----------------------------------------------------------------------------- | ||
Brian E Granger
|
r1234 | # Code | ||
Brian Granger
|
r2306 | #----------------------------------------------------------------------------- | ||
Brian E Granger
|
r1234 | |||
Brian Granger
|
r2306 | _client_tub = AsyncClientConnector() | ||
Brian E Granger
|
r1234 | get_multiengine_client = _client_tub.get_multiengine_client | ||
get_task_client = _client_tub.get_task_client | ||||
get_client = _client_tub.get_client | ||||