Show More
The requested changes are too big and content was truncated. Show full diff
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,23 | |||
|
1 | #!/usr/bin/env python | |
|
2 | # encoding: utf-8 | |
|
3 | ||
|
4 | # A super simple example showing how to use all of this in a fully | |
|
5 | # asynchronous manner. The TaskClient also works in this mode. | |
|
6 | ||
|
7 | from twisted.internet import reactor, defer | |
|
8 | from ipython1.kernel import asyncclient | |
|
9 | ||
|
10 | def printer(r): | |
|
11 | print r | |
|
12 | return r | |
|
13 | ||
|
14 | def submit(client): | |
|
15 | d = client.push(dict(a=5, b='asdf', c=[1,2,3]),targets=0,block=True) | |
|
16 | d.addCallback(lambda _: client.pull(('a','b','c'),targets=0,block=True)) | |
|
17 | d.addBoth(printer) | |
|
18 | d.addCallback(lambda _: reactor.stop()) | |
|
19 | ||
|
20 | d = asyncclient.get_multiengine_client() | |
|
21 | d.addCallback(submit) | |
|
22 | ||
|
23 | reactor.run() No newline at end of file |
@@ -0,0 +1,31 | |||
|
1 | #!/usr/bin/env python | |
|
2 | # encoding: utf-8 | |
|
3 | ||
|
4 | # This example shows how the AsynTaskClient can be used | |
|
5 | ||
|
6 | from twisted.internet import reactor, defer | |
|
7 | from ipython1.kernel import asynclient | |
|
8 | ||
|
9 | mec = asynclient.AsynMultiEngineClient(('localhost', 10105)) | |
|
10 | tc = asynclient.AsynTaskClient(('localhost',10113)) | |
|
11 | ||
|
12 | cmd1 = """\ | |
|
13 | a = 5 | |
|
14 | b = 10*d | |
|
15 | c = a*b*d | |
|
16 | """ | |
|
17 | ||
|
18 | t1 = asynclient.Task(cmd1, clear_before=False, clear_after=True, pull=['a','b','c']) | |
|
19 | ||
|
20 | d = mec.push(dict(d=30)) | |
|
21 | ||
|
22 | def raise_and_print(tr): | |
|
23 | tr.raiseException() | |
|
24 | print "a, b: ", tr.ns.a, tr.ns.b | |
|
25 | return tr | |
|
26 | ||
|
27 | d.addCallback(lambda _: tc.run(t1)) | |
|
28 | d.addCallback(lambda tid: tc.get_task_result(tid,block=True)) | |
|
29 | d.addCallback(raise_and_print) | |
|
30 | d.addCallback(lambda _: reactor.stop()) | |
|
31 | reactor.run() |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: new file 100644 | |
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now