##// END OF EJS Templates
Add stdout flushing statements to example....
Fernando Perez -
Show More
@@ -1,44 +1,50 b''
1 1 #!/usr/bin/env python
2 2 # encoding: utf-8
3 3
4 4 from IPython.kernel import client
5 5 import time
6 import sys
7 flush = sys.stdout.flush
6 8
7 9 tc = client.TaskClient()
8 10 mec = client.MultiEngineClient()
9 11
10 12 mec.execute('import time')
11 13
12 14 for i in range(24):
13 15 tc.run(client.StringTask('time.sleep(1)'))
14 16
15 17 for i in range(6):
16 18 time.sleep(1.0)
17 19 print "Queue status (vebose=False)"
18 20 print tc.queue_status()
21 flush()
19 22
20 23 for i in range(24):
21 24 tc.run(client.StringTask('time.sleep(1)'))
22 25
23 26 for i in range(6):
24 27 time.sleep(1.0)
25 28 print "Queue status (vebose=True)"
26 29 print tc.queue_status(True)
30 flush()
27 31
28 32 for i in range(12):
29 33 tc.run(client.StringTask('time.sleep(2)'))
30 34
31 35 print "Queue status (vebose=True)"
32 36 print tc.queue_status(True)
37 flush()
33 38
34 39 qs = tc.queue_status(True)
35 40 sched = qs['scheduled']
36 41
37 42 for tid in sched[-4:]:
38 43 tc.abort(tid)
39 44
40 45 for i in range(6):
41 46 time.sleep(1.0)
42 47 print "Queue status (vebose=True)"
43 48 print tc.queue_status(True)
49 flush()
44 50
General Comments 0
You need to be logged in to leave comments. Login now