##// END OF EJS Templates
json/jsonapi cleanup...
MinRK -
Show More
@@ -23,6 +23,7 b' Authors:'
23
23
24 from __future__ import with_statement
24 from __future__ import with_statement
25
25
26 import json
26 import os
27 import os
27 import socket
28 import socket
28 import stat
29 import stat
@@ -34,11 +35,6 b' import zmq'
34 from zmq.devices import ProcessMonitoredQueue
35 from zmq.devices import ProcessMonitoredQueue
35 from zmq.log.handlers import PUBHandler
36 from zmq.log.handlers import PUBHandler
36
37
37 # Note: use our own import to work around jsonlib api mismatch. When these
38 # changes propagate to zmq, revert back to the following line instead:
39 #from zmq.utils import jsonapi as json
40 from IPython.zmq import jsonapi as json
41
42 from IPython.core.profiledir import ProfileDir
38 from IPython.core.profiledir import ProfileDir
43
39
44 from IPython.parallel.apps.baseapp import (
40 from IPython.parallel.apps.baseapp import (
@@ -214,7 +210,7 b' class IPControllerApp(BaseParallelApplication):'
214 location = '127.0.0.1'
210 location = '127.0.0.1'
215 cdict['location'] = location
211 cdict['location'] = location
216 fname = os.path.join(self.profile_dir.security_dir, fname)
212 fname = os.path.join(self.profile_dir.security_dir, fname)
217 with open(fname, 'wb') as f:
213 with open(fname, 'w') as f:
218 f.write(json.dumps(cdict, indent=2))
214 f.write(json.dumps(cdict, indent=2))
219 os.chmod(fname, stat.S_IRUSR|stat.S_IWUSR)
215 os.chmod(fname, stat.S_IRUSR|stat.S_IWUSR)
220
216
@@ -359,7 +359,9 b' class TaskScheduler(SessionFactory):'
359 # turn timeouts into datetime objects:
359 # turn timeouts into datetime objects:
360 timeout = header.get('timeout', None)
360 timeout = header.get('timeout', None)
361 if timeout:
361 if timeout:
362 timeout = datetime.now() + timedelta(0,timeout,0)
362 # cast to float, because jsonlib returns floats as decimal.Decimal,
363 # which timedelta does not accept
364 timeout = datetime.now() + timedelta(0,float(timeout),0)
363
365
364 args = [raw_msg, targets, after, follow, timeout]
366 args = [raw_msg, targets, after, follow, timeout]
365
367
@@ -4,6 +4,7 b' launchers.'
4
4
5 # Standard library imports.
5 # Standard library imports.
6 import atexit
6 import atexit
7 import json
7 import os
8 import os
8 import socket
9 import socket
9 from subprocess import Popen, PIPE
10 from subprocess import Popen, PIPE
@@ -12,11 +13,6 b' import tempfile'
12
13
13 # System library imports
14 # System library imports
14
15
15 # Note: use our own import to work around jsonlib api mismatch. When these
16 # changes propagate to zmq, revert back to the following line instead:
17 #from zmq.utils import jsonapi as json
18 from IPython.zmq import jsonapi as json
19
20 # IPython imports
16 # IPython imports
21 from IPython.utils.localinterfaces import LOCALHOST
17 from IPython.utils.localinterfaces import LOCALHOST
22 from IPython.utils.py3compat import bytes_to_str
18 from IPython.utils.py3compat import bytes_to_str
@@ -86,7 +82,7 b' def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, '
86 cfg['ip'] = ip
82 cfg['ip'] = ip
87 cfg['key'] = bytes_to_str(key)
83 cfg['key'] = bytes_to_str(key)
88
84
89 with open(fname, 'wb') as f:
85 with open(fname, 'w') as f:
90 f.write(json.dumps(cfg, indent=2))
86 f.write(json.dumps(cfg, indent=2))
91
87
92 return fname, cfg
88 return fname, cfg
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now