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