##// END OF EJS Templates
launcher updates for PBS
MinRK -
Show More
@@ -115,7 +115,11 b' c = get_config()'
115 115 # environment variables would be setup, etc. This string is interpolated using
116 116 # the Itpl module in IPython.external. Basically, you can use ${n} for the
117 117 # number of engine and ${cluster_dir} for the cluster_dir.
118 # c.PBSControllerLauncher.batch_template = """"""
118 # c.PBSControllerLauncher.batch_template = """
119 # #PBS -l nprocs=$n
120 #
121 # ipcontrollerz --cluster-dir $cluster_dir
122 # """
119 123
120 124 # The name of the instantiated batch script that will actually be used to
121 125 # submit the job. This will be written to the cluster directory.
@@ -135,7 +139,11 b' c = get_config()'
135 139 # environment variables would be setup, etc. This string is interpolated using
136 140 # the Itpl module in IPython.external. Basically, you can use ${n} for the
137 141 # number of engine and ${cluster_dir} for the cluster_dir.
138 # c.PBSEngineSetLauncher.batch_template = """"""
142 # c.PBSEngineSetLauncher.batch_template = """
143 # #PBS -l nprocs=$n
144 #
145 # ipenginez --cluster-dir $cluster_dir$s
146 # """
139 147
140 148 # The name of the instantiated batch script that will actually be used to
141 149 # submit the job. This will be written to the cluster directory.
@@ -123,7 +123,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
123 123 """List all available clusters, by cluster directory, that can
124 124 be found in the current working directly or in the ipython
125 125 directory. Cluster directories are named using the convention
126 'cluster_<profile>'."""
126 'clusterz_<profile>'."""
127 127 )
128 128
129 129 # The "create" subcommand parser
@@ -136,13 +136,13 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
136 136 """Create an ipython cluster directory by its profile name or
137 137 cluster directory path. Cluster directories contain
138 138 configuration, log and security related files and are named
139 using the convention 'cluster_<profile>'. By default they are
139 using the convention 'clusterz_<profile>'. By default they are
140 140 located in your ipython directory. Once created, you will
141 141 probably need to edit the configuration files in the cluster
142 142 directory to configure your cluster. Most users will create a
143 143 cluster directory by profile name,
144 144 'ipclusterz create -p mycluster', which will put the directory
145 in '<ipython_dir>/cluster_mycluster'.
145 in '<ipython_dir>/clusterz_mycluster'.
146 146 """
147 147 )
148 148 paa = parser_create.add_argument
@@ -162,7 +162,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
162 162 """Start an ipython cluster by its profile name or cluster
163 163 directory. Cluster directories contain configuration, log and
164 164 security related files and are named using the convention
165 'cluster_<profile>' and should be creating using the 'start'
165 'clusterz_<profile>' and should be creating using the 'start'
166 166 subcommand of 'ipcluster'. If your cluster directory is in
167 167 the cwd or the ipython directory, you can simply refer to it
168 168 using its profile name, 'ipclusterz start -n 4 -p <profile>`,
@@ -200,7 +200,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
200 200 description=
201 201 """Stop a running ipython cluster by its profile name or cluster
202 202 directory. Cluster directories are named using the convention
203 'cluster_<profile>'. If your cluster directory is in
203 'clusterz_<profile>'. If your cluster directory is in
204 204 the cwd or the ipython directory, you can simply refer to it
205 205 using its profile name, 'ipclusterz stop -p <profile>`, otherwise
206 206 use the '--cluster-dir' option.
@@ -223,7 +223,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
223 223 by profile name or cluster directory.
224 224 Cluster directories contain configuration, log and
225 225 security related files and are named using the convention
226 'cluster_<profile>' and should be creating using the 'start'
226 'clusterz_<profile>' and should be creating using the 'start'
227 227 subcommand of 'ipcluster'. If your cluster directory is in
228 228 the cwd or the ipython directory, you can simply refer to it
229 229 using its profile name, 'ipclusterz engines -n 4 -p <profile>`,
@@ -322,7 +322,7 b' class IPClusterApp(ApplicationWithClusterDir):'
322 322 files = os.listdir(path)
323 323 for f in files:
324 324 full_path = os.path.join(path, f)
325 if os.path.isdir(full_path) and f.startswith('cluster_'):
325 if os.path.isdir(full_path) and f.startswith('clusterz_'):
326 326 profile = full_path.split('_')[-1]
327 327 start_cmd = 'ipclusterz start -p %s -n 4' % profile
328 328 print start_cmd + " ==> " + full_path
@@ -57,7 +57,7 b' The IPython controller provides a gateway between the IPython engines and'
57 57 clients. The controller needs to be started before the engines and can be
58 58 configured using command line options or using a cluster directory. Cluster
59 59 directories contain config, log and security files and are usually located in
60 your ipython directory and named as "cluster_<profile>". See the --profile
60 your ipython directory and named as "clusterz_<profile>". See the --profile
61 61 and --cluster-dir options for details.
62 62 """
63 63
@@ -64,7 +64,7 b' IPython engines run in parallel and perform computations on behalf of a client'
64 64 and controller. A controller needs to be started before the engines. The
65 65 engine can be configured using command line options or using a cluster
66 66 directory. Cluster directories contain config, log and security files and are
67 usually located in your ipython directory and named as "cluster_<profile>".
67 usually located in your ipython directory and named as "clusterz_<profile>".
68 68 See the --profile and --cluster-dir options for details.
69 69 """
70 70
@@ -39,7 +39,7 b' IPython controllers and engines (and your own processes) can broadcast log messa'
39 39 by registering a `zmq.log.handlers.PUBHandler` with the `logging` module. The
40 40 logger can be configured using command line options or using a cluster
41 41 directory. Cluster directories contain config, log and security files and are
42 usually located in your ipython directory and named as "cluster_<profile>".
42 usually located in your ipython directory and named as "clusterz_<profile>".
43 43 See the --profile and --cluster-dir options for details.
44 44 """
45 45
@@ -44,7 +44,7 b' from zmq.eventloop import ioloop'
44 44
45 45 from IPython.external import Itpl
46 46 # from IPython.config.configurable import Configurable
47 from IPython.utils.traitlets import Str, Int, List, Unicode, Instance
47 from IPython.utils.traitlets import Str, Int, List, Unicode, Dict, Instance
48 48 from IPython.utils.path import get_ipython_module_path
49 49 from IPython.utils.process import find_cmd, pycmd2argv, FindCmdError
50 50
@@ -738,13 +738,18 b' class BatchSystemLauncher(BaseLauncher):'
738 738 batch_file_name = Unicode(u'batch_script', config=True)
739 739 # The full path to the instantiated batch script.
740 740 batch_file = Unicode(u'')
741 # the format dict used with batch_template:
742 context = Dict()
741 743
744
745 def find_args(self):
746 return [self.submit_command]
747
742 748 def __init__(self, work_dir=u'.', config=None, **kwargs):
743 749 super(BatchSystemLauncher, self).__init__(
744 750 work_dir=work_dir, config=config, **kwargs
745 751 )
746 752 self.batch_file = os.path.join(self.work_dir, self.batch_file_name)
747 self.context = {}
748 753
749 754 def parse_job_id(self, output):
750 755 """Take the output of the submit command and return the job id."""
@@ -766,8 +771,13 b' class BatchSystemLauncher(BaseLauncher):'
766 771 f.write(script_as_string)
767 772 f.close()
768 773
769 def start(self, n):
774 def start(self, n, cluster_dir):
770 775 """Start n copies of the process using a batch system."""
776 # Here we save profile and cluster_dir in the context so they
777 # can be used in the batch script template as ${profile} and
778 # ${cluster_dir}
779 self.context['cluster_dir'] = cluster_dir
780 self.cluster_dir = unicode(cluster_dir)
771 781 self.write_batch_script(n)
772 782 output = check_output([self.submit_command, self.batch_file], env=os.environ, stdout=STDOUT)
773 783 job_id = self.parse_job_id(output)
@@ -798,13 +808,8 b' class PBSControllerLauncher(PBSLauncher):'
798 808
799 809 def start(self, cluster_dir):
800 810 """Start the controller by profile or cluster_dir."""
801 # Here we save profile and cluster_dir in the context so they
802 # can be used in the batch script template as ${profile} and
803 # ${cluster_dir}
804 self.context['cluster_dir'] = cluster_dir
805 self.cluster_dir = unicode(cluster_dir)
806 811 self.log.info("Starting PBSControllerLauncher: %r" % self.args)
807 return super(PBSControllerLauncher, self).start(1)
812 return super(PBSControllerLauncher, self).start(1, cluster_dir)
808 813
809 814
810 815 class PBSEngineSetLauncher(PBSLauncher):
@@ -813,10 +818,8 b' class PBSEngineSetLauncher(PBSLauncher):'
813 818
814 819 def start(self, n, cluster_dir):
815 820 """Start n engines by profile or cluster_dir."""
816 self.program_args.extend(['--cluster-dir', cluster_dir])
817 self.cluster_dir = unicode(cluster_dir)
818 821 self.log.info('Starting PBSEngineSetLauncher: %r' % self.args)
819 return super(PBSEngineSetLauncher, self).start(n)
822 return super(PBSEngineSetLauncher, self).start(n, cluster_dir)
820 823
821 824
822 825 #-----------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now