##// END OF EJS Templates
parallel.apps cleanup per review...
MinRK -
Show More
@@ -119,9 +119,13 b' class BaseParallelApplication(BaseIPythonApplication):'
119
119
120 cluster_id = Unicode('', config=True,
120 cluster_id = Unicode('', config=True,
121 help="""String id to add to runtime files, to prevent name collisions when
121 help="""String id to add to runtime files, to prevent name collisions when
122 using multiple clusters with a single profile.
122 using multiple clusters with a single profile simultaneously.
123
123
124 When set, files will be named like: 'ipcontroller-<cluster_id>-engine.json'
124 When set, files will be named like: 'ipcontroller-<cluster_id>-engine.json'
125
126 Since this is text inserted into filenames, typical recommendations apply:
127 Simple character strings are ideal, and spaces are not recommended (but should
128 generally work).
125 """
129 """
126 )
130 )
127 def _cluster_id_changed(self, name, old, new):
131 def _cluster_id_changed(self, name, old, new):
@@ -183,8 +183,8 b' class IPControllerApp(BaseParallelApplication):'
183
183
184 def _cluster_id_changed(self, name, old, new):
184 def _cluster_id_changed(self, name, old, new):
185 super(IPControllerApp, self)._cluster_id_changed(name, old, new)
185 super(IPControllerApp, self)._cluster_id_changed(name, old, new)
186 self.engine_json_file = "%s-engine.json"%self.name
186 self.engine_json_file = "%s-engine.json" % self.name
187 self.client_json_file = "%s-client.json"%self.name
187 self.client_json_file = "%s-client.json" % self.name
188
188
189
189
190 # internal
190 # internal
@@ -93,7 +93,7 b' class MPI(Configurable):'
93 help='How to enable MPI (mpi4py, pytrilinos, or empty string to disable).'
93 help='How to enable MPI (mpi4py, pytrilinos, or empty string to disable).'
94 )
94 )
95
95
96 def _on_use_changed(self, old, new):
96 def _use_changed(self, name, old, new):
97 # load default init script if it's not set
97 # load default init script if it's not set
98 if not self.init_script:
98 if not self.init_script:
99 self.init_script = self.default_inits.get(new, '')
99 self.init_script = self.default_inits.get(new, '')
@@ -162,10 +162,10 b' class IPEngineApp(BaseParallelApplication):'
162
162
163 def _cluster_id_changed(self, name, old, new):
163 def _cluster_id_changed(self, name, old, new):
164 if new:
164 if new:
165 base = 'ipcontroller-%s'%new
165 base = 'ipcontroller-%s' % new
166 else:
166 else:
167 base = 'ipcontroller'
167 base = 'ipcontroller'
168 self.url_file_name = "%s-engine.json"%base
168 self.url_file_name = "%s-engine.json" % base
169
169
170 log_url = Unicode('', config=True,
170 log_url = Unicode('', config=True,
171 help="""The URL for the iploggerapp instance, for forwarding
171 help="""The URL for the iploggerapp instance, for forwarding
@@ -232,14 +232,14 b' class ControllerMixin(ClusterAppMixin):'
232 controller_cmd = List(ipcontroller_cmd_argv, config=True,
232 controller_cmd = List(ipcontroller_cmd_argv, config=True,
233 help="""Popen command to launch ipcontroller.""")
233 help="""Popen command to launch ipcontroller.""")
234 # Command line arguments to ipcontroller.
234 # Command line arguments to ipcontroller.
235 controller_args = List(['--log-to-file','--log-level=%i'%logging.INFO], config=True,
235 controller_args = List(['--log-to-file','--log-level=%i' % logging.INFO], config=True,
236 help="""command-line args to pass to ipcontroller""")
236 help="""command-line args to pass to ipcontroller""")
237
237
238 class EngineMixin(ClusterAppMixin):
238 class EngineMixin(ClusterAppMixin):
239 engine_cmd = List(ipengine_cmd_argv, config=True,
239 engine_cmd = List(ipengine_cmd_argv, config=True,
240 help="""command to launch the Engine.""")
240 help="""command to launch the Engine.""")
241 # Command line arguments for ipengine.
241 # Command line arguments for ipengine.
242 engine_args = List(['--log-to-file','--log-level=%i'%logging.INFO], config=True,
242 engine_args = List(['--log-to-file','--log-level=%i' % logging.INFO], config=True,
243 help="command-line arguments to pass to ipengine"
243 help="command-line arguments to pass to ipengine"
244 )
244 )
245
245
@@ -807,12 +807,19 b' class WindowsHPCEngineSetLauncher(WindowsHPCLauncher, ClusterAppMixin):'
807 #-----------------------------------------------------------------------------
807 #-----------------------------------------------------------------------------
808
808
809 class BatchClusterAppMixin(ClusterAppMixin):
809 class BatchClusterAppMixin(ClusterAppMixin):
810 """ClusterApp mixin that updates context dict, rather than args"""
810 """ClusterApp mixin that updates the self.context dict, rather than cl-args."""
811 context = Dict({'profile_dir':'', 'cluster_id':''})
812 def _profile_dir_changed(self, name, old, new):
811 def _profile_dir_changed(self, name, old, new):
813 self.context[name] = new
812 self.context[name] = new
814 _cluster_id_changed = _profile_dir_changed
813 _cluster_id_changed = _profile_dir_changed
815
814
815 def _profile_dir_default(self):
816 self.context['profile_dir'] = ''
817 return ''
818 def _cluster_id_default(self):
819 self.context['cluster_id'] = ''
820 return ''
821
822
816 class BatchSystemLauncher(BaseLauncher):
823 class BatchSystemLauncher(BaseLauncher):
817 """Launch an external process using a batch system.
824 """Launch an external process using a batch system.
818
825
@@ -956,7 +963,7 b' class PBSLauncher(BatchSystemLauncher):'
956 queue_template = Unicode('#PBS -q {queue}')
963 queue_template = Unicode('#PBS -q {queue}')
957
964
958
965
959 class PBSControllerLauncher(BatchClusterAppMixin, PBSLauncher):
966 class PBSControllerLauncher(PBSLauncher, BatchClusterAppMixin):
960 """Launch a controller using PBS."""
967 """Launch a controller using PBS."""
961
968
962 batch_file_name = Unicode(u'pbs_controller', config=True,
969 batch_file_name = Unicode(u'pbs_controller', config=True,
@@ -974,7 +981,7 b' class PBSControllerLauncher(BatchClusterAppMixin, PBSLauncher):'
974 return super(PBSControllerLauncher, self).start(1)
981 return super(PBSControllerLauncher, self).start(1)
975
982
976
983
977 class PBSEngineSetLauncher(BatchClusterAppMixin, PBSLauncher):
984 class PBSEngineSetLauncher(PBSLauncher, BatchClusterAppMixin):
978 """Launch Engines using PBS"""
985 """Launch Engines using PBS"""
979 batch_file_name = Unicode(u'pbs_engines', config=True,
986 batch_file_name = Unicode(u'pbs_engines', config=True,
980 help="batch file name for the engine(s) job.")
987 help="batch file name for the engine(s) job.")
@@ -998,7 +1005,7 b' class SGELauncher(PBSLauncher):'
998 queue_regexp = Unicode('#\$\W+-q\W+\$?\w+')
1005 queue_regexp = Unicode('#\$\W+-q\W+\$?\w+')
999 queue_template = Unicode('#$ -q {queue}')
1006 queue_template = Unicode('#$ -q {queue}')
1000
1007
1001 class SGEControllerLauncher(BatchClusterAppMixin, SGELauncher):
1008 class SGEControllerLauncher(SGELauncher, BatchClusterAppMixin):
1002 """Launch a controller using SGE."""
1009 """Launch a controller using SGE."""
1003
1010
1004 batch_file_name = Unicode(u'sge_controller', config=True,
1011 batch_file_name = Unicode(u'sge_controller', config=True,
@@ -1014,7 +1021,7 b' class SGEControllerLauncher(BatchClusterAppMixin, SGELauncher):'
1014 self.log.info("Starting PBSControllerLauncher: %r" % self.args)
1021 self.log.info("Starting PBSControllerLauncher: %r" % self.args)
1015 return super(SGEControllerLauncher, self).start(1)
1022 return super(SGEControllerLauncher, self).start(1)
1016
1023
1017 class SGEEngineSetLauncher(BatchClusterAppMixin, SGELauncher):
1024 class SGEEngineSetLauncher(SGELauncher, BatchClusterAppMixin):
1018 """Launch Engines with SGE"""
1025 """Launch Engines with SGE"""
1019 batch_file_name = Unicode(u'sge_engines', config=True,
1026 batch_file_name = Unicode(u'sge_engines', config=True,
1020 help="batch file name for the engine(s) job.")
1027 help="batch file name for the engine(s) job.")
@@ -1066,7 +1073,7 b' class LSFLauncher(BatchSystemLauncher):'
1066 return job_id
1073 return job_id
1067
1074
1068
1075
1069 class LSFControllerLauncher(BatchClusterAppMixin, LSFLauncher):
1076 class LSFControllerLauncher(LSFLauncher, BatchClusterAppMixin):
1070 """Launch a controller using LSF."""
1077 """Launch a controller using LSF."""
1071
1078
1072 batch_file_name = Unicode(u'lsf_controller', config=True,
1079 batch_file_name = Unicode(u'lsf_controller', config=True,
@@ -1084,7 +1091,7 b' class LSFControllerLauncher(BatchClusterAppMixin, LSFLauncher):'
1084 return super(LSFControllerLauncher, self).start(1)
1091 return super(LSFControllerLauncher, self).start(1)
1085
1092
1086
1093
1087 class LSFEngineSetLauncher(BatchClusterAppMixin, LSFLauncher):
1094 class LSFEngineSetLauncher(LSFLauncher, BatchClusterAppMixin):
1088 """Launch Engines using LSF"""
1095 """Launch Engines using LSF"""
1089 batch_file_name = Unicode(u'lsf_engines', config=True,
1096 batch_file_name = Unicode(u'lsf_engines', config=True,
1090 help="batch file name for the engine(s) job.")
1097 help="batch file name for the engine(s) job.")
General Comments 0
You need to be logged in to leave comments. Login now