##// END OF EJS Templates
cleanup parallel traits...
MinRK -
Show More
@@ -36,7 +36,7 b' from IPython.utils.path import ('
36 36 get_ipython_dir,
37 37 expand_path
38 38 )
39 from IPython.utils.traitlets import Unicode, Bool, CStr, Instance, Dict
39 from IPython.utils.traitlets import Unicode, Bool, Instance, Dict
40 40
41 41 #-----------------------------------------------------------------------------
42 42 # Module errors
@@ -360,8 +360,8 b' class ClusterApplication(BaseIPythonApplication):'
360 360 clean_logs = Bool(False, shortname='--clean-logs', config=True,
361 361 help="whether to cleanup old logfiles before starting")
362 362
363 log_url = CStr('', shortname='--log-url', config=True,
364 help="The ZMQ URL of the iplooger to aggregate logging.")
363 log_url = Unicode('', shortname='--log-url', config=True,
364 help="The ZMQ URL of the iplogger to aggregate logging.")
365 365
366 366 config_file = Unicode(u'', config=True,
367 367 help="""Path to ipcontroller configuration file. The default is to use
@@ -29,7 +29,7 b' from IPython.config.application import Application, boolean_flag'
29 29 from IPython.config.loader import Config
30 30 from IPython.core.newapplication import BaseIPythonApplication
31 31 from IPython.utils.importstring import import_item
32 from IPython.utils.traitlets import Int, CStr, CUnicode, Str, Bool, CFloat, Dict, List
32 from IPython.utils.traitlets import Int, Unicode, Bool, CFloat, Dict, List
33 33
34 34 from IPython.parallel.apps.clusterdir import (
35 35 ClusterApplication, ClusterDirError, ClusterDir,
@@ -285,7 +285,7 b' class IPClusterEngines(ClusterApplication):'
285 285 n = Int(2, config=True,
286 286 help="The number of engines to start.")
287 287
288 engine_launcher_class = Str('LocalEngineSetLauncher',
288 engine_launcher_class = Unicode('LocalEngineSetLauncher',
289 289 config=True,
290 290 help="The class for launching a set of Engines."
291 291 )
@@ -420,7 +420,7 b' class IPClusterStart(IPClusterEngines):'
420 420 delay = CFloat(1., config=True,
421 421 help="delay (in s) between starting the controller and the engines")
422 422
423 controller_launcher_class = Str('LocalControllerLauncher',
423 controller_launcher_class = Unicode('LocalControllerLauncher',
424 424 config=True,
425 425 help="The class for launching a Controller."
426 426 )
@@ -43,7 +43,7 b' from IPython.parallel.apps.clusterdir import ('
43 43 # ClusterDirConfigLoader
44 44 )
45 45 from IPython.utils.importstring import import_item
46 from IPython.utils.traitlets import Instance, Unicode, Bool, List, CStr, Dict
46 from IPython.utils.traitlets import Instance, Unicode, Bool, List, Dict
47 47
48 48 # from IPython.parallel.controller.controller import ControllerFactory
49 49 from IPython.parallel.streamsession import StreamSession
@@ -139,7 +139,7 b' class IPControllerApp(ClusterApplication):'
139 139
140 140 # internal
141 141 children = List()
142 mq_class = CStr('zmq.devices.ProcessMonitoredQueue')
142 mq_class = Unicode('zmq.devices.ProcessMonitoredQueue')
143 143
144 144 def _usethreads_changed(self, name, old, new):
145 145 self.mq_class = 'zmq.devices.%sMonitoredQueue'%('Thread' if new else 'Process')
@@ -37,7 +37,7 b' from IPython.parallel.engine.streamkernel import Kernel'
37 37 from IPython.parallel.util import disambiguate_url
38 38
39 39 from IPython.utils.importstring import import_item
40 from IPython.utils.traitlets import Str, Bool, Unicode, Dict, List, CStr
40 from IPython.utils.traitlets import Bool, Unicode, Dict, List, CStr
41 41
42 42
43 43 #-----------------------------------------------------------------------------
@@ -78,7 +78,7 b' mpi.size = 0'
78 78
79 79 class MPI(Configurable):
80 80 """Configurable for MPI initialization"""
81 use = Str('', config=True,
81 use = Unicode('', config=True,
82 82 help='How to enable MPI (mpi4py, pytrilinos, or empty string to disable).'
83 83 )
84 84
@@ -87,7 +87,7 b' class MPI(Configurable):'
87 87 if not self.init_script:
88 88 self.init_script = self.default_inits.get(new, '')
89 89
90 init_script = Str('', config=True,
90 init_script = Unicode('', config=True,
91 91 help="Initialization code for MPI")
92 92
93 93 default_inits = Dict({'mpi4py' : mpi4py_init, 'pytrilinos':pytrilinos_init},
@@ -111,7 +111,7 b' class IPEngineApp(ClusterApplication):'
111 111
112 112 startup_script = Unicode(u'', config=True,
113 113 help='specify a script to be run at startup')
114 startup_command = Str('', config=True,
114 startup_command = Unicode('', config=True,
115 115 help='specify a command to be run at startup')
116 116
117 117 url_file = Unicode(u'', config=True,
@@ -51,7 +51,7 b' from zmq.eventloop import ioloop'
51 51
52 52 from IPython.external import Itpl
53 53 # from IPython.config.configurable import Configurable
54 from IPython.utils.traitlets import Any, Str, Int, List, Unicode, Dict, Instance, CUnicode
54 from IPython.utils.traitlets import Any, Int, List, Unicode, Dict, Instance
55 55 from IPython.utils.path import get_ipython_module_path
56 56 from IPython.utils.process import find_cmd, pycmd2argv, FindCmdError
57 57
@@ -534,11 +534,11 b' class SSHLauncher(LocalProcessLauncher):'
534 534 help="Program to launch via ssh")
535 535 program_args = List([], config=True,
536 536 help="args to pass to remote program")
537 hostname = CUnicode('', config=True,
537 hostname = Unicode('', config=True,
538 538 help="hostname on which to launch the program")
539 user = CUnicode('', config=True,
539 user = Unicode('', config=True,
540 540 help="username for ssh")
541 location = CUnicode('', config=True,
541 location = Unicode('', config=True,
542 542 help="user@hostname location for ssh in one setting")
543 543
544 544 def _hostname_changed(self, name, old, new):
@@ -647,18 +647,18 b' def find_job_cmd():'
647 647
648 648 class WindowsHPCLauncher(BaseLauncher):
649 649
650 job_id_regexp = Str(r'\d+', config=True,
650 job_id_regexp = Unicode(r'\d+', config=True,
651 651 help="""A regular expression used to get the job id from the output of the
652 652 submit_command. """
653 653 )
654 job_file_name = CUnicode(u'ipython_job.xml', config=True,
654 job_file_name = Unicode(u'ipython_job.xml', config=True,
655 655 help="The filename of the instantiated job script.")
656 656 # The full path to the instantiated job script. This gets made dynamically
657 657 # by combining the work_dir with the job_file_name.
658 job_file = CUnicode(u'')
659 scheduler = CUnicode('', config=True,
658 job_file = Unicode(u'')
659 scheduler = Unicode('', config=True,
660 660 help="The hostname of the scheduler to submit the job to.")
661 job_cmd = CUnicode(find_job_cmd(), config=True,
661 job_cmd = Unicode(find_job_cmd(), config=True,
662 662 help="The command for submitting jobs.")
663 663
664 664 def __init__(self, work_dir=u'.', config=None, **kwargs):
@@ -727,7 +727,7 b' class WindowsHPCLauncher(BaseLauncher):'
727 727
728 728 class WindowsHPCControllerLauncher(WindowsHPCLauncher):
729 729
730 job_file_name = CUnicode(u'ipcontroller_job.xml', config=True,
730 job_file_name = Unicode(u'ipcontroller_job.xml', config=True,
731 731 help="WinHPC xml job file.")
732 732 extra_args = List([], config=False,
733 733 help="extra args to pass to ipcontroller")
@@ -760,7 +760,7 b' class WindowsHPCControllerLauncher(WindowsHPCLauncher):'
760 760
761 761 class WindowsHPCEngineSetLauncher(WindowsHPCLauncher):
762 762
763 job_file_name = CUnicode(u'ipengineset_job.xml', config=True,
763 job_file_name = Unicode(u'ipengineset_job.xml', config=True,
764 764 help="jobfile for ipengines job")
765 765 extra_args = List([], config=False,
766 766 help="extra args to pas to ipengine")
@@ -815,29 +815,29 b' class BatchSystemLauncher(BaseLauncher):'
815 815 help="The name of the command line program used to submit jobs.")
816 816 delete_command = List([''], config=True,
817 817 help="The name of the command line program used to delete jobs.")
818 job_id_regexp = CUnicode('', config=True,
818 job_id_regexp = Unicode('', config=True,
819 819 help="""A regular expression used to get the job id from the output of the
820 820 submit_command.""")
821 batch_template = CUnicode('', config=True,
821 batch_template = Unicode('', config=True,
822 822 help="The string that is the batch script template itself.")
823 batch_template_file = CUnicode(u'', config=True,
823 batch_template_file = Unicode(u'', config=True,
824 824 help="The file that contains the batch template.")
825 batch_file_name = CUnicode(u'batch_script', config=True,
825 batch_file_name = Unicode(u'batch_script', config=True,
826 826 help="The filename of the instantiated batch script.")
827 queue = CUnicode(u'', config=True,
827 queue = Unicode(u'', config=True,
828 828 help="The PBS Queue.")
829 829
830 830 # not configurable, override in subclasses
831 831 # PBS Job Array regex
832 job_array_regexp = CUnicode('')
833 job_array_template = CUnicode('')
832 job_array_regexp = Unicode('')
833 job_array_template = Unicode('')
834 834 # PBS Queue regex
835 queue_regexp = CUnicode('')
836 queue_template = CUnicode('')
835 queue_regexp = Unicode('')
836 queue_template = Unicode('')
837 837 # The default batch template, override in subclasses
838 default_template = CUnicode('')
838 default_template = Unicode('')
839 839 # The full path to the instantiated batch script.
840 batch_file = CUnicode(u'')
840 batch_file = Unicode(u'')
841 841 # the format dict used with batch_template:
842 842 context = Dict()
843 843
@@ -924,22 +924,22 b' class PBSLauncher(BatchSystemLauncher):'
924 924 help="The PBS submit command ['qsub']")
925 925 delete_command = List(['qdel'], config=True,
926 926 help="The PBS delete command ['qsub']")
927 job_id_regexp = CUnicode(r'\d+', config=True,
927 job_id_regexp = Unicode(r'\d+', config=True,
928 928 help="Regular expresion for identifying the job ID [r'\d+']")
929 929
930 batch_file = CUnicode(u'')
931 job_array_regexp = CUnicode('#PBS\W+-t\W+[\w\d\-\$]+')
932 job_array_template = CUnicode('#PBS -t 1-$n')
933 queue_regexp = CUnicode('#PBS\W+-q\W+\$?\w+')
934 queue_template = CUnicode('#PBS -q $queue')
930 batch_file = Unicode(u'')
931 job_array_regexp = Unicode('#PBS\W+-t\W+[\w\d\-\$]+')
932 job_array_template = Unicode('#PBS -t 1-$n')
933 queue_regexp = Unicode('#PBS\W+-q\W+\$?\w+')
934 queue_template = Unicode('#PBS -q $queue')
935 935
936 936
937 937 class PBSControllerLauncher(PBSLauncher):
938 938 """Launch a controller using PBS."""
939 939
940 batch_file_name = CUnicode(u'pbs_controller', config=True,
940 batch_file_name = Unicode(u'pbs_controller', config=True,
941 941 help="batch file name for the controller job.")
942 default_template= CUnicode("""#!/bin/sh
942 default_template= Unicode("""#!/bin/sh
943 943 #PBS -V
944 944 #PBS -N ipcontroller
945 945 %s --log-to-file cluster_dir $cluster_dir
@@ -953,9 +953,9 b' class PBSControllerLauncher(PBSLauncher):'
953 953
954 954 class PBSEngineSetLauncher(PBSLauncher):
955 955 """Launch Engines using PBS"""
956 batch_file_name = CUnicode(u'pbs_engines', config=True,
956 batch_file_name = Unicode(u'pbs_engines', config=True,
957 957 help="batch file name for the engine(s) job.")
958 default_template= CUnicode(u"""#!/bin/sh
958 default_template= Unicode(u"""#!/bin/sh
959 959 #PBS -V
960 960 #PBS -N ipengine
961 961 %s cluster_dir $cluster_dir
@@ -970,17 +970,17 b' class PBSEngineSetLauncher(PBSLauncher):'
970 970
971 971 class SGELauncher(PBSLauncher):
972 972 """Sun GridEngine is a PBS clone with slightly different syntax"""
973 job_array_regexp = CUnicode('#$$\W+-t\W+[\w\d\-\$]+')
974 job_array_template = CUnicode('#$$ -t 1-$n')
975 queue_regexp = CUnicode('#$$\W+-q\W+\$?\w+')
976 queue_template = CUnicode('#$$ -q $queue')
973 job_array_regexp = Unicode('#$$\W+-t\W+[\w\d\-\$]+')
974 job_array_template = Unicode('#$$ -t 1-$n')
975 queue_regexp = Unicode('#$$\W+-q\W+\$?\w+')
976 queue_template = Unicode('#$$ -q $queue')
977 977
978 978 class SGEControllerLauncher(SGELauncher):
979 979 """Launch a controller using SGE."""
980 980
981 batch_file_name = CUnicode(u'sge_controller', config=True,
981 batch_file_name = Unicode(u'sge_controller', config=True,
982 982 help="batch file name for the ipontroller job.")
983 default_template= CUnicode(u"""#$$ -V
983 default_template= Unicode(u"""#$$ -V
984 984 #$$ -S /bin/sh
985 985 #$$ -N ipcontroller
986 986 %s --log-to-file cluster_dir=$cluster_dir
@@ -993,9 +993,9 b' class SGEControllerLauncher(SGELauncher):'
993 993
994 994 class SGEEngineSetLauncher(SGELauncher):
995 995 """Launch Engines with SGE"""
996 batch_file_name = CUnicode(u'sge_engines', config=True,
996 batch_file_name = Unicode(u'sge_engines', config=True,
997 997 help="batch file name for the engine(s) job.")
998 default_template = CUnicode("""#$$ -V
998 default_template = Unicode("""#$$ -V
999 999 #$$ -S /bin/sh
1000 1000 #$$ -N ipengine
1001 1001 %s cluster_dir=$cluster_dir
@@ -1020,7 +1020,7 b' class IPClusterLauncher(LocalProcessLauncher):'
1020 1020 ipcluster_args = List(
1021 1021 ['--clean-logs', '--log-to-file', 'log_level=%i'%logging.INFO], config=True,
1022 1022 help="Command line arguments to pass to ipcluster.")
1023 ipcluster_subcommand = Str('start')
1023 ipcluster_subcommand = Unicode('start')
1024 1024 ipcluster_n = Int(2)
1025 1025
1026 1026 def find_args(self):
@@ -19,7 +19,7 b' import sys'
19 19 import zmq
20 20 from zmq.eventloop import ioloop, zmqstream
21 21
22 from IPython.utils.traitlets import Int, Str, Instance, List
22 from IPython.utils.traitlets import Int, Unicode, Instance, List
23 23
24 24 from IPython.parallel.factory import LoggingFactory
25 25
@@ -36,7 +36,7 b' class LogWatcher(LoggingFactory):'
36 36 """
37 37 # configurables
38 38 topics = List([''], config=True)
39 url = Str('tcp://127.0.0.1:20202', config=True)
39 url = Unicode('tcp://127.0.0.1:20202', config=True)
40 40
41 41 # internals
42 42 context = Instance(zmq.Context, (), {})
@@ -24,8 +24,8 b' from xml.etree import ElementTree as ET'
24 24
25 25 from IPython.config.configurable import Configurable
26 26 from IPython.utils.traitlets import (
27 Str, Int, List, Instance,
28 Enum, Bool, CStr
27 Unicode, Int, List, Instance,
28 Enum, Bool
29 29 )
30 30
31 31 #-----------------------------------------------------------------------------
@@ -74,27 +74,27 b' def find_username():'
74 74
75 75 class WinHPCJob(Configurable):
76 76
77 job_id = Str('')
78 job_name = Str('MyJob', config=True)
77 job_id = Unicode('')
78 job_name = Unicode('MyJob', config=True)
79 79 min_cores = Int(1, config=True)
80 80 max_cores = Int(1, config=True)
81 81 min_sockets = Int(1, config=True)
82 82 max_sockets = Int(1, config=True)
83 83 min_nodes = Int(1, config=True)
84 84 max_nodes = Int(1, config=True)
85 unit_type = Str("Core", config=True)
85 unit_type = Unicode("Core", config=True)
86 86 auto_calculate_min = Bool(True, config=True)
87 87 auto_calculate_max = Bool(True, config=True)
88 88 run_until_canceled = Bool(False, config=True)
89 89 is_exclusive = Bool(False, config=True)
90 username = Str(find_username(), config=True)
91 job_type = Str('Batch', config=True)
90 username = Unicode(find_username(), config=True)
91 job_type = Unicode('Batch', config=True)
92 92 priority = Enum(('Lowest','BelowNormal','Normal','AboveNormal','Highest'),
93 93 default_value='Highest', config=True)
94 requested_nodes = Str('', config=True)
95 project = Str('IPython', config=True)
96 xmlns = Str('http://schemas.microsoft.com/HPCS2008/scheduler/')
97 version = Str("2.000")
94 requested_nodes = Unicode('', config=True)
95 project = Unicode('IPython', config=True)
96 xmlns = Unicode('http://schemas.microsoft.com/HPCS2008/scheduler/')
97 version = Unicode("2.000")
98 98 tasks = List([])
99 99
100 100 @property
@@ -165,21 +165,21 b' class WinHPCJob(Configurable):'
165 165
166 166 class WinHPCTask(Configurable):
167 167
168 task_id = Str('')
169 task_name = Str('')
170 version = Str("2.000")
168 task_id = Unicode('')
169 task_name = Unicode('')
170 version = Unicode("2.000")
171 171 min_cores = Int(1, config=True)
172 172 max_cores = Int(1, config=True)
173 173 min_sockets = Int(1, config=True)
174 174 max_sockets = Int(1, config=True)
175 175 min_nodes = Int(1, config=True)
176 176 max_nodes = Int(1, config=True)
177 unit_type = Str("Core", config=True)
178 command_line = CStr('', config=True)
179 work_directory = CStr('', config=True)
177 unit_type = Unicode("Core", config=True)
178 command_line = Unicode('', config=True)
179 work_directory = Unicode('', config=True)
180 180 is_rerunnaable = Bool(True, config=True)
181 std_out_file_path = CStr('', config=True)
182 std_err_file_path = CStr('', config=True)
181 std_out_file_path = Unicode('', config=True)
182 std_err_file_path = Unicode('', config=True)
183 183 is_parametric = Bool(False, config=True)
184 184 environment_variables = Instance(dict, args=(), config=True)
185 185
@@ -223,41 +223,41 b' class WinHPCTask(Configurable):'
223 223 # By declaring these, we can configure the controller and engine separately!
224 224
225 225 class IPControllerJob(WinHPCJob):
226 job_name = Str('IPController', config=False)
226 job_name = Unicode('IPController', config=False)
227 227 is_exclusive = Bool(False, config=True)
228 username = Str(find_username(), config=True)
228 username = Unicode(find_username(), config=True)
229 229 priority = Enum(('Lowest','BelowNormal','Normal','AboveNormal','Highest'),
230 230 default_value='Highest', config=True)
231 requested_nodes = Str('', config=True)
232 project = Str('IPython', config=True)
231 requested_nodes = Unicode('', config=True)
232 project = Unicode('IPython', config=True)
233 233
234 234
235 235 class IPEngineSetJob(WinHPCJob):
236 job_name = Str('IPEngineSet', config=False)
236 job_name = Unicode('IPEngineSet', config=False)
237 237 is_exclusive = Bool(False, config=True)
238 username = Str(find_username(), config=True)
238 username = Unicode(find_username(), config=True)
239 239 priority = Enum(('Lowest','BelowNormal','Normal','AboveNormal','Highest'),
240 240 default_value='Highest', config=True)
241 requested_nodes = Str('', config=True)
242 project = Str('IPython', config=True)
241 requested_nodes = Unicode('', config=True)
242 project = Unicode('IPython', config=True)
243 243
244 244
245 245 class IPControllerTask(WinHPCTask):
246 246
247 task_name = Str('IPController', config=True)
247 task_name = Unicode('IPController', config=True)
248 248 controller_cmd = List(['ipcontroller.exe'], config=True)
249 249 controller_args = List(['--log-to-file', '--log-level', '40'], config=True)
250 250 # I don't want these to be configurable
251 std_out_file_path = CStr('', config=False)
252 std_err_file_path = CStr('', config=False)
251 std_out_file_path = Unicode('', config=False)
252 std_err_file_path = Unicode('', config=False)
253 253 min_cores = Int(1, config=False)
254 254 max_cores = Int(1, config=False)
255 255 min_sockets = Int(1, config=False)
256 256 max_sockets = Int(1, config=False)
257 257 min_nodes = Int(1, config=False)
258 258 max_nodes = Int(1, config=False)
259 unit_type = Str("Core", config=False)
260 work_directory = CStr('', config=False)
259 unit_type = Unicode("Core", config=False)
260 work_directory = Unicode('', config=False)
261 261
262 262 def __init__(self, config=None):
263 263 super(IPControllerTask, self).__init__(config=config)
@@ -272,20 +272,20 b' class IPControllerTask(WinHPCTask):'
272 272
273 273 class IPEngineTask(WinHPCTask):
274 274
275 task_name = Str('IPEngine', config=True)
275 task_name = Unicode('IPEngine', config=True)
276 276 engine_cmd = List(['ipengine.exe'], config=True)
277 277 engine_args = List(['--log-to-file', '--log-level', '40'], config=True)
278 278 # I don't want these to be configurable
279 std_out_file_path = CStr('', config=False)
280 std_err_file_path = CStr('', config=False)
279 std_out_file_path = Unicode('', config=False)
280 std_err_file_path = Unicode('', config=False)
281 281 min_cores = Int(1, config=False)
282 282 max_cores = Int(1, config=False)
283 283 min_sockets = Int(1, config=False)
284 284 max_sockets = Int(1, config=False)
285 285 min_nodes = Int(1, config=False)
286 286 max_nodes = Int(1, config=False)
287 unit_type = Str("Core", config=False)
288 work_directory = CStr('', config=False)
287 unit_type = Unicode("Core", config=False)
288 work_directory = Unicode('', config=False)
289 289
290 290 def __init__(self, config=None):
291 291 super(IPEngineTask,self).__init__(config=config)
@@ -24,8 +24,8 b' import zmq'
24 24 # from zmq.eventloop import ioloop, zmqstream
25 25
26 26 from IPython.utils.path import get_ipython_dir
27 from IPython.utils.traitlets import (HasTraits, Int, Instance, CUnicode,
28 Dict, List, Bool, Str, Set)
27 from IPython.utils.traitlets import (HasTraits, Int, Instance, Unicode,
28 Dict, List, Bool, Set)
29 29 from IPython.external.decorator import decorator
30 30 from IPython.external.ssh import tunnel
31 31
@@ -213,7 +213,7 b' class Client(HasTraits):'
213 213 metadata = Instance('collections.defaultdict', (Metadata,))
214 214 history = List()
215 215 debug = Bool(False)
216 profile=CUnicode('default')
216 profile=Unicode('default')
217 217
218 218 _outstanding_dict = Instance('collections.defaultdict', (set,))
219 219 _ids = List()
@@ -229,7 +229,7 b' class Client(HasTraits):'
229 229 _notification_socket=Instance('zmq.Socket')
230 230 _mux_socket=Instance('zmq.Socket')
231 231 _task_socket=Instance('zmq.Socket')
232 _task_scheme=Str()
232 _task_scheme=Unicode()
233 233 _closed = False
234 234 _ignored_control_replies=Int(0)
235 235 _ignored_hub_replies=Int(0)
@@ -46,7 +46,7 b' from datetime import datetime'
46 46
47 47 from IPython.config.configurable import Configurable
48 48
49 from IPython.utils.traitlets import Dict, CUnicode
49 from IPython.utils.traitlets import Dict, Unicode
50 50
51 51 filters = {
52 52 '$lt' : lambda a,b: a < b,
@@ -82,7 +82,7 b' class CompositeFilter(object):'
82 82 class BaseDB(Configurable):
83 83 """Empty Parent class so traitlets work on DB."""
84 84 # base configurable traits:
85 session = CUnicode("")
85 session = Unicode("")
86 86
87 87 class DictDB(BaseDB):
88 88 """Basic in-memory dict-based object for saving Task Records.
@@ -15,10 +15,10 b' import time'
15 15 import uuid
16 16
17 17 import zmq
18 from zmq.devices import ProcessDevice, ThreadDevice
18 from zmq.devices import ThreadDevice
19 19 from zmq.eventloop import ioloop, zmqstream
20 20
21 from IPython.utils.traitlets import Set, Instance, CFloat, Bool, CStr
21 from IPython.utils.traitlets import Set, Instance, CFloat
22 22 from IPython.parallel.factory import LoggingFactory
23 23
24 24 class Heart(object):
@@ -26,7 +26,7 b' from zmq.eventloop.zmqstream import ZMQStream'
26 26 # internal:
27 27 from IPython.utils.importstring import import_item
28 28 from IPython.utils.traitlets import (
29 HasTraits, Instance, Int, CStr, Str, Dict, Set, List, Bool, Tuple
29 HasTraits, Instance, Int, Unicode, Dict, Set, Tuple, CStr
30 30 )
31 31
32 32 from IPython.parallel import error, util
@@ -105,10 +105,10 b' class EngineConnector(HasTraits):'
105 105 heartbeat (str): identity of heartbeat XREQ socket
106 106 """
107 107 id=Int(0)
108 queue=Str()
109 control=Str()
110 registration=Str()
111 heartbeat=Str()
108 queue=CStr()
109 control=CStr()
110 registration=CStr()
111 heartbeat=CStr()
112 112 pending=Set()
113 113
114 114 class HubFactory(RegistrationFactory):
@@ -156,24 +156,24 b' class HubFactory(RegistrationFactory):'
156 156 def _notifier_port_default(self):
157 157 return util.select_random_ports(1)[0]
158 158
159 engine_ip = CStr('127.0.0.1', config=True,
159 engine_ip = Unicode('127.0.0.1', config=True,
160 160 help="IP on which to listen for engine connections. [default: loopback]")
161 engine_transport = CStr('tcp', config=True,
161 engine_transport = Unicode('tcp', config=True,
162 162 help="0MQ transport for engine connections. [default: tcp]")
163 163
164 client_ip = CStr('127.0.0.1', config=True,
164 client_ip = Unicode('127.0.0.1', config=True,
165 165 help="IP on which to listen for client connections. [default: loopback]")
166 client_transport = CStr('tcp', config=True,
166 client_transport = Unicode('tcp', config=True,
167 167 help="0MQ transport for client connections. [default : tcp]")
168 168
169 monitor_ip = CStr('127.0.0.1', config=True,
169 monitor_ip = Unicode('127.0.0.1', config=True,
170 170 help="IP on which to listen for monitor messages. [default: loopback]")
171 monitor_transport = CStr('tcp', config=True,
171 monitor_transport = Unicode('tcp', config=True,
172 172 help="0MQ transport for monitor messages. [default : tcp]")
173 173
174 monitor_url = CStr('')
174 monitor_url = Unicode('')
175 175
176 db_class = CStr('IPython.parallel.controller.dictdb.DictDB', config=True,
176 db_class = Unicode('IPython.parallel.controller.dictdb.DictDB', config=True,
177 177 help="""The class to use for the DB backend""")
178 178
179 179 # not configurable
@@ -253,7 +253,7 b' class HubFactory(RegistrationFactory):'
253 253 # connect the db
254 254 self.log.info('Hub using DB backend: %r'%(self.db_class.split()[-1]))
255 255 # cdir = self.config.Global.cluster_dir
256 self.db = import_item(self.db_class)(session=self.session.session, config=self.config)
256 self.db = import_item(str(self.db_class))(session=self.session.session, config=self.config)
257 257 time.sleep(.25)
258 258 try:
259 259 scheme = self.config.TaskScheduler.scheme_name
@@ -9,7 +9,7 b''
9 9 from pymongo import Connection
10 10 from pymongo.binary import Binary
11 11
12 from IPython.utils.traitlets import Dict, List, CUnicode, CStr, Instance
12 from IPython.utils.traitlets import Dict, List, Unicode, Instance
13 13
14 14 from .dictdb import BaseDB
15 15
@@ -29,7 +29,7 b' class MongoDB(BaseDB):'
29 29 necessary if the default mongodb configuration does not point to your
30 30 mongod instance."""
31 31 )
32 database = CUnicode(config=True,
32 database = Unicode(config=True,
33 33 help="""The MongoDB database name to use for storing tasks for this session. If unspecified,
34 34 a new database will be created with the Hub's IDENT. Specifying the database will result
35 35 in tasks from previous sessions being available via Clients' db_query and
@@ -15,7 +15,7 b' import sqlite3'
15 15
16 16 from zmq.eventloop import ioloop
17 17
18 from IPython.utils.traitlets import CUnicode, CStr, Instance, List
18 from IPython.utils.traitlets import Unicode, Instance, List
19 19 from .dictdb import BaseDB
20 20 from IPython.parallel.util import ISO8601
21 21
@@ -83,12 +83,12 b' def _convert_bufs(bs):'
83 83 class SQLiteDB(BaseDB):
84 84 """SQLite3 TaskRecord backend."""
85 85
86 filename = CUnicode('tasks.db', config=True,
86 filename = Unicode('tasks.db', config=True,
87 87 help="""The filename of the sqlite task database. [default: 'tasks.db']""")
88 location = CUnicode('', config=True,
88 location = Unicode('', config=True,
89 89 help="""The directory containing the sqlite task database. The default
90 90 is to use the cluster_dir location.""")
91 table = CUnicode("", config=True,
91 table = Unicode("", config=True,
92 92 help="""The SQLite Table to use for storing tasks for this session. If unspecified,
93 93 a new table will be created with the Hub's IDENT. Specifying the table will result
94 94 in tasks from previous sessions being available via Clients' db_query and
@@ -19,7 +19,7 b' import zmq'
19 19 from zmq.eventloop import ioloop, zmqstream
20 20
21 21 # internal
22 from IPython.utils.traitlets import Instance, Str, Dict, Int, Type, CFloat
22 from IPython.utils.traitlets import Instance, Dict, Int, Type, CFloat, Unicode
23 23 # from IPython.utils.localinterfaces import LOCALHOST
24 24
25 25 from IPython.parallel.controller.heartmonitor import Heart
@@ -39,7 +39,7 b' class EngineFactory(RegistrationFactory):'
39 39 display_hook_factory=Type('IPython.zmq.displayhook.DisplayHook', config=True,
40 40 help="""The class for handling displayhook.
41 41 Typically 'IPython.zmq.displayhook.DisplayHook'""")
42 location=Str(config=True,
42 location=Unicode(config=True,
43 43 help="""The location (an IP address) of the controller. This is
44 44 used for disambiguating URLs, to determine whether
45 45 loopback should be used to connect or the public address.""")
@@ -28,7 +28,7 b' import zmq'
28 28 from zmq.eventloop import ioloop, zmqstream
29 29
30 30 # Local imports.
31 from IPython.utils.traitlets import Instance, List, Int, Dict, Set, Str, CStr
31 from IPython.utils.traitlets import Instance, List, Int, Dict, Set, Unicode
32 32 from IPython.zmq.completer import KernelCompleter
33 33
34 34 from IPython.parallel.error import wrap_exception
@@ -64,7 +64,7 b' class Kernel(SessionFactory):'
64 64 #---------------------------------------------------------------------------
65 65
66 66 # kwargs:
67 exec_lines = List(CStr, config=True,
67 exec_lines = List(Unicode, config=True,
68 68 help="List of lines to execute")
69 69
70 70 int_id = Int(-1)
@@ -18,7 +18,7 b' import os'
18 18 from zmq.eventloop.ioloop import IOLoop
19 19
20 20 from IPython.config.configurable import Configurable
21 from IPython.utils.traitlets import Str,Int,Instance, CUnicode, CStr
21 from IPython.utils.traitlets import Int, Instance, Unicode
22 22
23 23 import IPython.parallel.streamsession as ss
24 24 from IPython.parallel.util import select_random_ports
@@ -29,7 +29,7 b' from IPython.parallel.util import select_random_ports'
29 29 class LoggingFactory(Configurable):
30 30 """A most basic class, that has a `log` (type:`Logger`) attribute, set via a `logname` Trait."""
31 31 log = Instance('logging.Logger', ('ZMQ', logging.WARN))
32 logname = CUnicode('ZMQ')
32 logname = Unicode('ZMQ')
33 33 def _logname_changed(self, name, old, new):
34 34 self.log = logging.getLogger(new)
35 35
@@ -55,14 +55,14 b' class SessionFactory(LoggingFactory):'
55 55 class RegistrationFactory(SessionFactory):
56 56 """The Base Configurable for objects that involve registration."""
57 57
58 url = Str('', config=True,
58 url = Unicode('', config=True,
59 59 help="""The 0MQ url used for registration. This sets transport, ip, and port
60 60 in one variable. For example: url='tcp://127.0.0.1:12345' or
61 61 url='epgm://*:90210'""") # url takes precedence over ip,regport,transport
62 transport = Str('tcp', config=True,
62 transport = Unicode('tcp', config=True,
63 63 help="""The 0MQ transport for communications. This will likely be
64 64 the default of 'tcp', but other values include 'ipc', 'epgm', 'inproc'.""")
65 ip = Str('127.0.0.1', config=True,
65 ip = Unicode('127.0.0.1', config=True,
66 66 help="""The IP address for registration. This is generally either
67 67 '127.0.0.1' for loopback only or '*' for all interfaces.
68 68 [default: '127.0.0.1']""")
@@ -27,7 +27,7 b' from zmq.eventloop.zmqstream import ZMQStream'
27 27
28 28 from IPython.config.configurable import Configurable
29 29 from IPython.utils.importstring import import_item
30 from IPython.utils.traitlets import Str, CStr, CUnicode, Bool, Any
30 from IPython.utils.traitlets import CStr, Unicode, Bool, Any
31 31
32 32 from .util import ISO8601
33 33
@@ -121,7 +121,7 b' def extract_header(msg_or_header):'
121 121 class StreamSession(Configurable):
122 122 """tweaked version of IPython.zmq.session.Session, for development in Parallel"""
123 123 debug=Bool(False, config=True, help="""Debug output in the StreamSession""")
124 packer = Str('json',config=True,
124 packer = Unicode('json',config=True,
125 125 help="""The name of the packer for serializing messages.
126 126 Should be one of 'json', 'pickle', or an import name
127 127 for a custom serializer.""")
@@ -135,7 +135,7 b' class StreamSession(Configurable):'
135 135 else:
136 136 self.pack = import_item(new)
137 137
138 unpacker = Str('json',config=True,
138 unpacker = Unicode('json',config=True,
139 139 help="""The name of the unpacker for unserializing messages.
140 140 Only used with custom functions for `packer`.""")
141 141 def _unpacker_changed(self, name, old, new):
@@ -151,13 +151,13 b' class StreamSession(Configurable):'
151 151 session = CStr('',config=True,
152 152 help="""The UUID identifying this session.""")
153 153 def _session_default(self):
154 return str(uuid.uuid4())
155 username = CUnicode(os.environ.get('USER','username'),config=True,
154 return bytes(uuid.uuid4())
155 username = Unicode(os.environ.get('USER','username'),config=True,
156 156 help="""Username for the Session. Default is your system username.""")
157 157 key = CStr('', config=True,
158 158 help="""execution key, for extra authentication.""")
159 159
160 keyfile = CUnicode('', config=True,
160 keyfile = Unicode('', config=True,
161 161 help="""path to file containing execution key.""")
162 162 def _keyfile_changed(self, name, old, new):
163 163 with open(new, 'rb') as f:
General Comments 0
You need to be logged in to leave comments. Login now