29
29
30
30
from subprocess import Popen , PIPE , STDOUT
31
31
32
- try :
33
- from subprocess import check_output
34
- except ImportError :
35
- # pre-2.7, define check_output with Popen
36
- def check_output (* args , ** kwargs ):
37
- kwargs .update (dict (stdout = PIPE ))
38
- p = Popen (* args , ** kwargs )
39
- out , err = p .communicate ()
40
- return out
32
+ from subprocess import check_output
41
33
42
34
43
35
from traitlets import import_item
@@ -51,7 +43,6 @@ def check_output(*args, **kwargs):
51
43
Unicode ,
52
44
Dict ,
53
45
Instance ,
54
- HasTraits ,
55
46
CRegExp ,
56
47
observe ,
57
48
)
@@ -220,7 +211,7 @@ def signal(self, sig):
220
211
raise NotImplementedError ('signal must be implemented in a subclass' )
221
212
222
213
223
- class ClusterAppMixin (HasTraits ):
214
+ class ClusterAppMixin (LoggingConfigurable ):
224
215
"""MixIn for cluster args as traits"""
225
216
226
217
profile_dir = Unicode ('' )
@@ -231,7 +222,7 @@ def cluster_args(self):
231
222
return ['--profile-dir' , self .profile_dir , '--cluster-id' , self .cluster_id ]
232
223
233
224
234
- class ControllerMixin (ClusterAppMixin ):
225
+ class ControllerLauncher (ClusterAppMixin ):
235
226
controller_cmd = List (
236
227
ipcontroller_cmd_argv ,
237
228
config = True ,
@@ -245,7 +236,7 @@ class ControllerMixin(ClusterAppMixin):
245
236
)
246
237
247
238
248
- class EngineMixin (ClusterAppMixin ):
239
+ class EngineLauncher (ClusterAppMixin ):
249
240
engine_cmd = List (
250
241
ipengine_cmd_argv , config = True , help = """command to launch the Engine."""
251
242
)
@@ -370,7 +361,7 @@ def poll(self):
370
361
return status
371
362
372
363
373
- class LocalControllerLauncher (LocalProcessLauncher , ControllerMixin ):
364
+ class LocalControllerLauncher (LocalProcessLauncher , ControllerLauncher ):
374
365
"""Launch a controller as a regular external process."""
375
366
376
367
def find_args (self ):
@@ -381,7 +372,7 @@ def start(self):
381
372
return super (LocalControllerLauncher , self ).start ()
382
373
383
374
384
- class LocalEngineLauncher (LocalProcessLauncher , EngineMixin ):
375
+ class LocalEngineLauncher (LocalProcessLauncher , EngineLauncher ):
385
376
"""Launch a single engine as a regular external process."""
386
377
387
378
def find_args (self ):
@@ -521,7 +512,7 @@ def start(self, n):
521
512
return super (MPILauncher , self ).start ()
522
513
523
514
524
- class MPIControllerLauncher (MPILauncher , ControllerMixin ):
515
+ class MPIControllerLauncher (MPILauncher , ControllerLauncher ):
525
516
"""Launch a controller using mpiexec."""
526
517
527
518
# alias back to *non-configurable* program[_args] for use in find_args()
@@ -540,7 +531,7 @@ def start(self):
540
531
return super (MPIControllerLauncher , self ).start (1 )
541
532
542
533
543
- class MPIEngineSetLauncher (MPILauncher , EngineMixin ):
534
+ class MPIEngineSetLauncher (MPILauncher , EngineLauncher ):
544
535
"""Launch engines using mpiexec"""
545
536
546
537
# alias back to *non-configurable* program[_args] for use in find_args()
@@ -762,7 +753,7 @@ def cluster_args(self):
762
753
return ['--profile-dir' , self .remote_profile_dir ]
763
754
764
755
765
- class SSHControllerLauncher (SSHClusterLauncher , ControllerMixin ):
756
+ class SSHControllerLauncher (SSHClusterLauncher , ControllerLauncher ):
766
757
767
758
# alias back to *non-configurable* program[_args] for use in find_args()
768
759
# this way all Controller/EngineSetLaunchers have the same form, rather
@@ -789,7 +780,7 @@ def _to_fetch_default(self):
789
780
]
790
781
791
782
792
- class SSHEngineLauncher (SSHClusterLauncher , EngineMixin ):
783
+ class SSHEngineLauncher (SSHClusterLauncher , EngineLauncher ):
793
784
794
785
# alias back to *non-configurable* program[_args] for use in find_args()
795
786
# this way all Controller/EngineSetLaunchers have the same form, rather
0 commit comments