Permalink
Browse files

cleanup parallel traits

* eliminate use of CUnicode
* eliminate use of Str
* all remaining CStr will become CBytes
  • Loading branch information...
1 parent a618140 commit c29759da71f97e704cf16710547d7c8038ffaba4 @minrk committed May 24, 2011
@@ -36,7 +36,7 @@
get_ipython_dir,
expand_path
)
-from IPython.utils.traitlets import Unicode, Bool, CStr, Instance, Dict
+from IPython.utils.traitlets import Unicode, Bool, Instance, Dict
#-----------------------------------------------------------------------------
# Module errors
@@ -360,8 +360,8 @@ def _work_dir_changed(self, name, old, new):
clean_logs = Bool(False, shortname='--clean-logs', config=True,
help="whether to cleanup old logfiles before starting")
- log_url = CStr('', shortname='--log-url', config=True,
- help="The ZMQ URL of the iplooger to aggregate logging.")
+ log_url = Unicode('', shortname='--log-url', config=True,
+ help="The ZMQ URL of the iplogger to aggregate logging.")
config_file = Unicode(u'', config=True,
help="""Path to ipcontroller configuration file. The default is to use
@@ -29,7 +29,7 @@
from IPython.config.loader import Config
from IPython.core.newapplication import BaseIPythonApplication
from IPython.utils.importstring import import_item
-from IPython.utils.traitlets import Int, CStr, CUnicode, Str, Bool, CFloat, Dict, List
+from IPython.utils.traitlets import Int, Unicode, Bool, CFloat, Dict, List
from IPython.parallel.apps.clusterdir import (
ClusterApplication, ClusterDirError, ClusterDir,
@@ -285,7 +285,7 @@ def _classes_default(self):
n = Int(2, config=True,
help="The number of engines to start.")
- engine_launcher_class = Str('LocalEngineSetLauncher',
+ engine_launcher_class = Unicode('LocalEngineSetLauncher',
config=True,
help="The class for launching a set of Engines."
)
@@ -420,7 +420,7 @@ def _classes_default(self,):
delay = CFloat(1., config=True,
help="delay (in s) between starting the controller and the engines")
- controller_launcher_class = Str('LocalControllerLauncher',
+ controller_launcher_class = Unicode('LocalControllerLauncher',
config=True,
help="The class for launching a Controller."
)
@@ -43,7 +43,7 @@
# ClusterDirConfigLoader
)
from IPython.utils.importstring import import_item
-from IPython.utils.traitlets import Instance, Unicode, Bool, List, CStr, Dict
+from IPython.utils.traitlets import Instance, Unicode, Bool, List, Dict
# from IPython.parallel.controller.controller import ControllerFactory
from IPython.parallel.streamsession import StreamSession
@@ -139,7 +139,7 @@ class IPControllerApp(ClusterApplication):
# internal
children = List()
- mq_class = CStr('zmq.devices.ProcessMonitoredQueue')
+ mq_class = Unicode('zmq.devices.ProcessMonitoredQueue')
def _usethreads_changed(self, name, old, new):
self.mq_class = 'zmq.devices.%sMonitoredQueue'%('Thread' if new else 'Process')
@@ -37,7 +37,7 @@
from IPython.parallel.util import disambiguate_url
from IPython.utils.importstring import import_item
-from IPython.utils.traitlets import Str, Bool, Unicode, Dict, List, CStr
+from IPython.utils.traitlets import Bool, Unicode, Dict, List, CStr
#-----------------------------------------------------------------------------
@@ -78,7 +78,7 @@ class SimpleStruct:
class MPI(Configurable):
"""Configurable for MPI initialization"""
- use = Str('', config=True,
+ use = Unicode('', config=True,
help='How to enable MPI (mpi4py, pytrilinos, or empty string to disable).'
)
@@ -87,7 +87,7 @@ def _on_use_changed(self, old, new):
if not self.init_script:
self.init_script = self.default_inits.get(new, '')
- init_script = Str('', config=True,
+ init_script = Unicode('', config=True,
help="Initialization code for MPI")
default_inits = Dict({'mpi4py' : mpi4py_init, 'pytrilinos':pytrilinos_init},
@@ -111,7 +111,7 @@ class IPEngineApp(ClusterApplication):
startup_script = Unicode(u'', config=True,
help='specify a script to be run at startup')
- startup_command = Str('', config=True,
+ startup_command = Unicode('', config=True,
help='specify a command to be run at startup')
url_file = Unicode(u'', config=True,
@@ -51,7 +51,7 @@ def check_output(*args, **kwargs):
from IPython.external import Itpl
# from IPython.config.configurable import Configurable
-from IPython.utils.traitlets import Any, Str, Int, List, Unicode, Dict, Instance, CUnicode
+from IPython.utils.traitlets import Any, Int, List, Unicode, Dict, Instance
from IPython.utils.path import get_ipython_module_path
from IPython.utils.process import find_cmd, pycmd2argv, FindCmdError
@@ -534,11 +534,11 @@ class SSHLauncher(LocalProcessLauncher):
help="Program to launch via ssh")
program_args = List([], config=True,
help="args to pass to remote program")
- hostname = CUnicode('', config=True,
+ hostname = Unicode('', config=True,
help="hostname on which to launch the program")
- user = CUnicode('', config=True,
+ user = Unicode('', config=True,
help="username for ssh")
- location = CUnicode('', config=True,
+ location = Unicode('', config=True,
help="user@hostname location for ssh in one setting")
def _hostname_changed(self, name, old, new):
@@ -647,18 +647,18 @@ def find_job_cmd():
class WindowsHPCLauncher(BaseLauncher):
- job_id_regexp = Str(r'\d+', config=True,
+ job_id_regexp = Unicode(r'\d+', config=True,
help="""A regular expression used to get the job id from the output of the
submit_command. """
)
- job_file_name = CUnicode(u'ipython_job.xml', config=True,
+ job_file_name = Unicode(u'ipython_job.xml', config=True,
help="The filename of the instantiated job script.")
# The full path to the instantiated job script. This gets made dynamically
# by combining the work_dir with the job_file_name.
- job_file = CUnicode(u'')
- scheduler = CUnicode('', config=True,
+ job_file = Unicode(u'')
+ scheduler = Unicode('', config=True,
help="The hostname of the scheduler to submit the job to.")
- job_cmd = CUnicode(find_job_cmd(), config=True,
+ job_cmd = Unicode(find_job_cmd(), config=True,
help="The command for submitting jobs.")
def __init__(self, work_dir=u'.', config=None, **kwargs):
@@ -727,7 +727,7 @@ def stop(self):
class WindowsHPCControllerLauncher(WindowsHPCLauncher):
- job_file_name = CUnicode(u'ipcontroller_job.xml', config=True,
+ job_file_name = Unicode(u'ipcontroller_job.xml', config=True,
help="WinHPC xml job file.")
extra_args = List([], config=False,
help="extra args to pass to ipcontroller")
@@ -760,7 +760,7 @@ def start(self, cluster_dir):
class WindowsHPCEngineSetLauncher(WindowsHPCLauncher):
- job_file_name = CUnicode(u'ipengineset_job.xml', config=True,
+ job_file_name = Unicode(u'ipengineset_job.xml', config=True,
help="jobfile for ipengines job")
extra_args = List([], config=False,
help="extra args to pas to ipengine")
@@ -815,29 +815,29 @@ class BatchSystemLauncher(BaseLauncher):
help="The name of the command line program used to submit jobs.")
delete_command = List([''], config=True,
help="The name of the command line program used to delete jobs.")
- job_id_regexp = CUnicode('', config=True,
+ job_id_regexp = Unicode('', config=True,
help="""A regular expression used to get the job id from the output of the
submit_command.""")
- batch_template = CUnicode('', config=True,
+ batch_template = Unicode('', config=True,
help="The string that is the batch script template itself.")
- batch_template_file = CUnicode(u'', config=True,
+ batch_template_file = Unicode(u'', config=True,
help="The file that contains the batch template.")
- batch_file_name = CUnicode(u'batch_script', config=True,
+ batch_file_name = Unicode(u'batch_script', config=True,
help="The filename of the instantiated batch script.")
- queue = CUnicode(u'', config=True,
+ queue = Unicode(u'', config=True,
help="The PBS Queue.")
# not configurable, override in subclasses
# PBS Job Array regex
- job_array_regexp = CUnicode('')
- job_array_template = CUnicode('')
+ job_array_regexp = Unicode('')
+ job_array_template = Unicode('')
# PBS Queue regex
- queue_regexp = CUnicode('')
- queue_template = CUnicode('')
+ queue_regexp = Unicode('')
+ queue_template = Unicode('')
# The default batch template, override in subclasses
- default_template = CUnicode('')
+ default_template = Unicode('')
# The full path to the instantiated batch script.
- batch_file = CUnicode(u'')
+ batch_file = Unicode(u'')
# the format dict used with batch_template:
context = Dict()
@@ -924,22 +924,22 @@ class PBSLauncher(BatchSystemLauncher):
help="The PBS submit command ['qsub']")
delete_command = List(['qdel'], config=True,
help="The PBS delete command ['qsub']")
- job_id_regexp = CUnicode(r'\d+', config=True,
+ job_id_regexp = Unicode(r'\d+', config=True,
help="Regular expresion for identifying the job ID [r'\d+']")
- batch_file = CUnicode(u'')
- job_array_regexp = CUnicode('#PBS\W+-t\W+[\w\d\-\$]+')
- job_array_template = CUnicode('#PBS -t 1-$n')
- queue_regexp = CUnicode('#PBS\W+-q\W+\$?\w+')
- queue_template = CUnicode('#PBS -q $queue')
+ batch_file = Unicode(u'')
+ job_array_regexp = Unicode('#PBS\W+-t\W+[\w\d\-\$]+')
+ job_array_template = Unicode('#PBS -t 1-$n')
+ queue_regexp = Unicode('#PBS\W+-q\W+\$?\w+')
+ queue_template = Unicode('#PBS -q $queue')
class PBSControllerLauncher(PBSLauncher):
"""Launch a controller using PBS."""
- batch_file_name = CUnicode(u'pbs_controller', config=True,
+ batch_file_name = Unicode(u'pbs_controller', config=True,
help="batch file name for the controller job.")
- default_template= CUnicode("""#!/bin/sh
+ default_template= Unicode("""#!/bin/sh
#PBS -V
#PBS -N ipcontroller
%s --log-to-file cluster_dir $cluster_dir
@@ -953,9 +953,9 @@ def start(self, cluster_dir):
class PBSEngineSetLauncher(PBSLauncher):
"""Launch Engines using PBS"""
- batch_file_name = CUnicode(u'pbs_engines', config=True,
+ batch_file_name = Unicode(u'pbs_engines', config=True,
help="batch file name for the engine(s) job.")
- default_template= CUnicode(u"""#!/bin/sh
+ default_template= Unicode(u"""#!/bin/sh
#PBS -V
#PBS -N ipengine
%s cluster_dir $cluster_dir
@@ -970,17 +970,17 @@ def start(self, n, cluster_dir):
class SGELauncher(PBSLauncher):
"""Sun GridEngine is a PBS clone with slightly different syntax"""
- job_array_regexp = CUnicode('#$$\W+-t\W+[\w\d\-\$]+')
- job_array_template = CUnicode('#$$ -t 1-$n')
- queue_regexp = CUnicode('#$$\W+-q\W+\$?\w+')
- queue_template = CUnicode('#$$ -q $queue')
+ job_array_regexp = Unicode('#$$\W+-t\W+[\w\d\-\$]+')
+ job_array_template = Unicode('#$$ -t 1-$n')
+ queue_regexp = Unicode('#$$\W+-q\W+\$?\w+')
+ queue_template = Unicode('#$$ -q $queue')
class SGEControllerLauncher(SGELauncher):
"""Launch a controller using SGE."""
- batch_file_name = CUnicode(u'sge_controller', config=True,
+ batch_file_name = Unicode(u'sge_controller', config=True,
help="batch file name for the ipontroller job.")
- default_template= CUnicode(u"""#$$ -V
+ default_template= Unicode(u"""#$$ -V
#$$ -S /bin/sh
#$$ -N ipcontroller
%s --log-to-file cluster_dir=$cluster_dir
@@ -993,9 +993,9 @@ def start(self, cluster_dir):
class SGEEngineSetLauncher(SGELauncher):
"""Launch Engines with SGE"""
- batch_file_name = CUnicode(u'sge_engines', config=True,
+ batch_file_name = Unicode(u'sge_engines', config=True,
help="batch file name for the engine(s) job.")
- default_template = CUnicode("""#$$ -V
+ default_template = Unicode("""#$$ -V
#$$ -S /bin/sh
#$$ -N ipengine
%s cluster_dir=$cluster_dir
@@ -1020,7 +1020,7 @@ class IPClusterLauncher(LocalProcessLauncher):
ipcluster_args = List(
['--clean-logs', '--log-to-file', 'log_level=%i'%logging.INFO], config=True,
help="Command line arguments to pass to ipcluster.")
- ipcluster_subcommand = Str('start')
+ ipcluster_subcommand = Unicode('start')
ipcluster_n = Int(2)
def find_args(self):
@@ -19,7 +19,7 @@
import zmq
from zmq.eventloop import ioloop, zmqstream
-from IPython.utils.traitlets import Int, Str, Instance, List
+from IPython.utils.traitlets import Int, Unicode, Instance, List
from IPython.parallel.factory import LoggingFactory
@@ -36,7 +36,7 @@ class LogWatcher(LoggingFactory):
"""
# configurables
topics = List([''], config=True)
- url = Str('tcp://127.0.0.1:20202', config=True)
+ url = Unicode('tcp://127.0.0.1:20202', config=True)
# internals
context = Instance(zmq.Context, (), {})
Oops, something went wrong.

0 comments on commit c29759d

Please sign in to comment.