##// END OF EJS Templates
launcher updates for PBS
MinRK -
Show More
@@ -115,7 +115,11 b' c = get_config()'
115 # environment variables would be setup, etc. This string is interpolated using
115 # environment variables would be setup, etc. This string is interpolated using
116 # the Itpl module in IPython.external. Basically, you can use ${n} for the
116 # the Itpl module in IPython.external. Basically, you can use ${n} for the
117 # number of engine and ${cluster_dir} for the cluster_dir.
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 # The name of the instantiated batch script that will actually be used to
124 # The name of the instantiated batch script that will actually be used to
121 # submit the job. This will be written to the cluster directory.
125 # submit the job. This will be written to the cluster directory.
@@ -135,7 +139,11 b' c = get_config()'
135 # environment variables would be setup, etc. This string is interpolated using
139 # environment variables would be setup, etc. This string is interpolated using
136 # the Itpl module in IPython.external. Basically, you can use ${n} for the
140 # the Itpl module in IPython.external. Basically, you can use ${n} for the
137 # number of engine and ${cluster_dir} for the cluster_dir.
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 # The name of the instantiated batch script that will actually be used to
148 # The name of the instantiated batch script that will actually be used to
141 # submit the job. This will be written to the cluster directory.
149 # submit the job. This will be written to the cluster directory.
@@ -123,7 +123,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
123 """List all available clusters, by cluster directory, that can
123 """List all available clusters, by cluster directory, that can
124 be found in the current working directly or in the ipython
124 be found in the current working directly or in the ipython
125 directory. Cluster directories are named using the convention
125 directory. Cluster directories are named using the convention
126 'cluster_<profile>'."""
126 'clusterz_<profile>'."""
127 )
127 )
128
128
129 # The "create" subcommand parser
129 # The "create" subcommand parser
@@ -136,13 +136,13 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
136 """Create an ipython cluster directory by its profile name or
136 """Create an ipython cluster directory by its profile name or
137 cluster directory path. Cluster directories contain
137 cluster directory path. Cluster directories contain
138 configuration, log and security related files and are named
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 located in your ipython directory. Once created, you will
140 located in your ipython directory. Once created, you will
141 probably need to edit the configuration files in the cluster
141 probably need to edit the configuration files in the cluster
142 directory to configure your cluster. Most users will create a
142 directory to configure your cluster. Most users will create a
143 cluster directory by profile name,
143 cluster directory by profile name,
144 'ipclusterz create -p mycluster', which will put the directory
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 paa = parser_create.add_argument
148 paa = parser_create.add_argument
@@ -162,7 +162,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
162 """Start an ipython cluster by its profile name or cluster
162 """Start an ipython cluster by its profile name or cluster
163 directory. Cluster directories contain configuration, log and
163 directory. Cluster directories contain configuration, log and
164 security related files and are named using the convention
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 subcommand of 'ipcluster'. If your cluster directory is in
166 subcommand of 'ipcluster'. If your cluster directory is in
167 the cwd or the ipython directory, you can simply refer to it
167 the cwd or the ipython directory, you can simply refer to it
168 using its profile name, 'ipclusterz start -n 4 -p <profile>`,
168 using its profile name, 'ipclusterz start -n 4 -p <profile>`,
@@ -200,7 +200,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
200 description=
200 description=
201 """Stop a running ipython cluster by its profile name or cluster
201 """Stop a running ipython cluster by its profile name or cluster
202 directory. Cluster directories are named using the convention
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 the cwd or the ipython directory, you can simply refer to it
204 the cwd or the ipython directory, you can simply refer to it
205 using its profile name, 'ipclusterz stop -p <profile>`, otherwise
205 using its profile name, 'ipclusterz stop -p <profile>`, otherwise
206 use the '--cluster-dir' option.
206 use the '--cluster-dir' option.
@@ -223,7 +223,7 b' class IPClusterAppConfigLoader(ClusterDirConfigLoader):'
223 by profile name or cluster directory.
223 by profile name or cluster directory.
224 Cluster directories contain configuration, log and
224 Cluster directories contain configuration, log and
225 security related files and are named using the convention
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 subcommand of 'ipcluster'. If your cluster directory is in
227 subcommand of 'ipcluster'. If your cluster directory is in
228 the cwd or the ipython directory, you can simply refer to it
228 the cwd or the ipython directory, you can simply refer to it
229 using its profile name, 'ipclusterz engines -n 4 -p <profile>`,
229 using its profile name, 'ipclusterz engines -n 4 -p <profile>`,
@@ -322,7 +322,7 b' class IPClusterApp(ApplicationWithClusterDir):'
322 files = os.listdir(path)
322 files = os.listdir(path)
323 for f in files:
323 for f in files:
324 full_path = os.path.join(path, f)
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 profile = full_path.split('_')[-1]
326 profile = full_path.split('_')[-1]
327 start_cmd = 'ipclusterz start -p %s -n 4' % profile
327 start_cmd = 'ipclusterz start -p %s -n 4' % profile
328 print start_cmd + " ==> " + full_path
328 print start_cmd + " ==> " + full_path
@@ -57,7 +57,7 b' The IPython controller provides a gateway between the IPython engines and'
57 clients. The controller needs to be started before the engines and can be
57 clients. The controller needs to be started before the engines and can be
58 configured using command line options or using a cluster directory. Cluster
58 configured using command line options or using a cluster directory. Cluster
59 directories contain config, log and security files and are usually located in
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 and --cluster-dir options for details.
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 and controller. A controller needs to be started before the engines. The
64 and controller. A controller needs to be started before the engines. The
65 engine can be configured using command line options or using a cluster
65 engine can be configured using command line options or using a cluster
66 directory. Cluster directories contain config, log and security files and are
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 See the --profile and --cluster-dir options for details.
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 by registering a `zmq.log.handlers.PUBHandler` with the `logging` module. The
39 by registering a `zmq.log.handlers.PUBHandler` with the `logging` module. The
40 logger can be configured using command line options or using a cluster
40 logger can be configured using command line options or using a cluster
41 directory. Cluster directories contain config, log and security files and are
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 See the --profile and --cluster-dir options for details.
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 from IPython.external import Itpl
45 from IPython.external import Itpl
46 # from IPython.config.configurable import Configurable
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 from IPython.utils.path import get_ipython_module_path
48 from IPython.utils.path import get_ipython_module_path
49 from IPython.utils.process import find_cmd, pycmd2argv, FindCmdError
49 from IPython.utils.process import find_cmd, pycmd2argv, FindCmdError
50
50
@@ -738,13 +738,18 b' class BatchSystemLauncher(BaseLauncher):'
738 batch_file_name = Unicode(u'batch_script', config=True)
738 batch_file_name = Unicode(u'batch_script', config=True)
739 # The full path to the instantiated batch script.
739 # The full path to the instantiated batch script.
740 batch_file = Unicode(u'')
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 def __init__(self, work_dir=u'.', config=None, **kwargs):
748 def __init__(self, work_dir=u'.', config=None, **kwargs):
743 super(BatchSystemLauncher, self).__init__(
749 super(BatchSystemLauncher, self).__init__(
744 work_dir=work_dir, config=config, **kwargs
750 work_dir=work_dir, config=config, **kwargs
745 )
751 )
746 self.batch_file = os.path.join(self.work_dir, self.batch_file_name)
752 self.batch_file = os.path.join(self.work_dir, self.batch_file_name)
747 self.context = {}
748
753
749 def parse_job_id(self, output):
754 def parse_job_id(self, output):
750 """Take the output of the submit command and return the job id."""
755 """Take the output of the submit command and return the job id."""
@@ -766,8 +771,13 b' class BatchSystemLauncher(BaseLauncher):'
766 f.write(script_as_string)
771 f.write(script_as_string)
767 f.close()
772 f.close()
768
773
769 def start(self, n):
774 def start(self, n, cluster_dir):
770 """Start n copies of the process using a batch system."""
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 self.write_batch_script(n)
781 self.write_batch_script(n)
772 output = check_output([self.submit_command, self.batch_file], env=os.environ, stdout=STDOUT)
782 output = check_output([self.submit_command, self.batch_file], env=os.environ, stdout=STDOUT)
773 job_id = self.parse_job_id(output)
783 job_id = self.parse_job_id(output)
@@ -798,13 +808,8 b' class PBSControllerLauncher(PBSLauncher):'
798
808
799 def start(self, cluster_dir):
809 def start(self, cluster_dir):
800 """Start the controller by profile or cluster_dir."""
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 self.log.info("Starting PBSControllerLauncher: %r" % self.args)
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 class PBSEngineSetLauncher(PBSLauncher):
815 class PBSEngineSetLauncher(PBSLauncher):
@@ -813,10 +818,8 b' class PBSEngineSetLauncher(PBSLauncher):'
813
818
814 def start(self, n, cluster_dir):
819 def start(self, n, cluster_dir):
815 """Start n engines by profile or cluster_dir."""
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 self.log.info('Starting PBSEngineSetLauncher: %r' % self.args)
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