##// END OF EJS Templates
use Popen instead of getstatusoutput to check for libedit....
use Popen instead of getstatusoutput to check for libedit. getstatusoutput uses os.popen, and is vulnerable to EINTR weirdness in environments such as gdb or PyQt. Exponential falloff is also used, to prevent waiting forever or firing requests too fast, though I haven't had it fire more than once after moving to Popen. closes gh-473

File last commit:

r3673:b9f54806
r3906:cf26ce8a
Show More
ipcluster_config.py
241 lines | 9.2 KiB | text/x-python | PythonLexer
Brian Granger
Adding files for the refactored kernel scripts.
r2304 import os
c = get_config()
Brian Granger
Work on default config files and docstrings....
r2310 #-----------------------------------------------------------------------------
# Select which launchers to use
#-----------------------------------------------------------------------------
# This allows you to control what method is used to start the controller
# and engines. The following methods are currently supported:
Brian Granger
More work on the launchers and Win HPC support.
r2333 # - Start as a regular process on localhost.
# - Start using mpiexec.
# - Start using the Windows HPC Server 2008 scheduler
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # - Start using PBS/SGE
# - Start using SSH
Brian Granger
More work on the launchers and Win HPC support.
r2333
Brian Granger
Work on default config files and docstrings....
r2310
# The selected launchers can be configured below.
Brian Granger
More work on the launchers and Win HPC support.
r2333 # Options are:
# - LocalControllerLauncher
# - MPIExecControllerLauncher
# - PBSControllerLauncher
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # - SGEControllerLauncher
Brian Granger
More work on the launchers and Win HPC support.
r2333 # - WindowsHPCControllerLauncher
MinRK
organize IPython.parallel into subpackages
r3673 # c.Global.controller_launcher = 'IPython.parallel.apps.launcher.LocalControllerLauncher'
# c.Global.controller_launcher = 'IPython.parallel.apps.launcher.PBSControllerLauncher'
Brian Granger
Adding files for the refactored kernel scripts.
r2304
Brian Granger
More work on the launchers and Win HPC support.
r2333 # Options are:
# - LocalEngineSetLauncher
# - MPIExecEngineSetLauncher
# - PBSEngineSetLauncher
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # - SGEEngineSetLauncher
Brian Granger
More work on the launchers and Win HPC support.
r2333 # - WindowsHPCEngineSetLauncher
MinRK
organize IPython.parallel into subpackages
r3673 # c.Global.engine_launcher = 'IPython.parallel.apps.launcher.LocalEngineSetLauncher'
Brian Granger
Adding files for the refactored kernel scripts.
r2304
Brian Granger
Work on default config files and docstrings....
r2310 #-----------------------------------------------------------------------------
# Global configuration
#-----------------------------------------------------------------------------
Brian Granger
More work on the launchers and Win HPC support.
r2333 # The default number of engines that will be started. This is overridden by
Brian Granger
Work on default config files and docstrings....
r2310 # the -n command line option: "ipcluster start -n 4"
Brian Granger
Adding files for the refactored kernel scripts.
r2304 # c.Global.n = 2
Brian Granger
Work on default config files and docstrings....
r2310 # Log to a file in cluster_dir/log, otherwise just log to sys.stdout.
# c.Global.log_to_file = False
Brian Granger
Adding files for the refactored kernel scripts.
r2304
Brian Granger
Work on default config files and docstrings....
r2310 # Remove old logs from cluster_dir/log before starting.
# c.Global.clean_logs = True
Brian Granger
Adding files for the refactored kernel scripts.
r2304
Brian Granger
The cluster applications now have a working directory option.....
r2330 # The working directory for the process. The application will use os.chdir
# to change to this directory before starting.
Brian Granger
Fixing how the working directory is handled in kernel....
r2336 # c.Global.work_dir = os.getcwd()
Brian Granger
The cluster applications now have a working directory option.....
r2330
Brian Granger
More work on the launchers and Win HPC support.
r2333
Brian Granger
Work on default config files and docstrings....
r2310 #-----------------------------------------------------------------------------
Brian Granger
More work on the launchers and Win HPC support.
r2333 # Local process launchers
Brian Granger
Work on default config files and docstrings....
r2310 #-----------------------------------------------------------------------------
Brian Granger
Adding files for the refactored kernel scripts.
r2304
Brian Granger
Work on default config files and docstrings....
r2310 # The command line arguments to call the controller with.
# c.LocalControllerLauncher.controller_args = \
# ['--log-to-file','--log-level', '40']
Brian Granger
More work on the launchers and Win HPC support.
r2333 # The working directory for the controller
Brian Granger
Fixing how the working directory is handled in kernel....
r2336 # c.LocalEngineSetLauncher.work_dir = u''
Brian Granger
More work on the launchers and Win HPC support.
r2333
# Command line argument passed to the engines.
# c.LocalEngineSetLauncher.engine_args = ['--log-to-file','--log-level', '40']
#-----------------------------------------------------------------------------
# MPIExec launchers
#-----------------------------------------------------------------------------
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # The mpiexec/mpirun command to use in both the controller and engines.
# c.MPIExecLauncher.mpi_cmd = ['mpiexec']
Brian Granger
Work on default config files and docstrings....
r2310
# Additional arguments to pass to the actual mpiexec command.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.MPIExecLauncher.mpi_args = []
# The mpiexec/mpirun command and args can be overridden if they should be different
# for controller and engines.
# c.MPIExecControllerLauncher.mpi_cmd = ['mpiexec']
Brian Granger
Adding files for the refactored kernel scripts.
r2304 # c.MPIExecControllerLauncher.mpi_args = []
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.MPIExecEngineSetLauncher.mpi_cmd = ['mpiexec']
# c.MPIExecEngineSetLauncher.mpi_args = []
Brian Granger
Adding files for the refactored kernel scripts.
r2304
Brian Granger
Work on default config files and docstrings....
r2310 # The command line argument to call the controller with.
# c.MPIExecControllerLauncher.controller_args = \
# ['--log-to-file','--log-level', '40']
Brian Granger
More work on the launchers and Win HPC support.
r2333 # Command line argument passed to the engines.
# c.MPIExecEngineSetLauncher.engine_args = ['--log-to-file','--log-level', '40']
# The default number of engines to start if not given elsewhere.
# c.MPIExecEngineSetLauncher.n = 1
#-----------------------------------------------------------------------------
# SSH launchers
#-----------------------------------------------------------------------------
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # ipclusterz can be used to launch controller and engines remotely via ssh.
# Note that currently ipclusterz does not do any file distribution, so if
# machines are not on a shared filesystem, config and json files must be
# distributed. For this reason, the reuse_files defaults to True on an
# ssh-launched Controller. This flag can be overridded by the program_args
# attribute of c.SSHControllerLauncher.
# set the ssh cmd for launching remote commands. The default is ['ssh']
# c.SSHLauncher.ssh_cmd = ['ssh']
# set the ssh cmd for launching remote commands. The default is ['ssh']
# c.SSHLauncher.ssh_args = ['tt']
# Set the user and hostname for the controller
# c.SSHControllerLauncher.hostname = 'controller.example.com'
# c.SSHControllerLauncher.user = os.environ.get('USER','username')
# Set the arguments to be passed to ipcontrollerz
# note that remotely launched ipcontrollerz will not get the contents of
# the local ipcontrollerz_config.py unless it resides on the *remote host*
# in the location specified by the --cluster_dir argument.
# c.SSHControllerLauncher.program_args = ['-r', '-ip', '0.0.0.0', '--cluster_dir', '/path/to/cd']
# Set the default args passed to ipenginez for SSH launched engines
# c.SSHEngineSetLauncher.engine_args = ['--mpi', 'mpi4py']
Brian Granger
More work on the launchers and Win HPC support.
r2333
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # SSH engines are launched as a dict of locations/n-engines.
# if a value is a tuple instead of an int, it is assumed to be of the form
# (n, [args]), setting the arguments to passed to ipenginez on `host`.
# otherwise, c.SSHEngineSetLauncher.engine_args will be used as the default.
# In this case, there will be 3 engines at my.example.com, and
# 2 at you@ipython.scipy.org with a special json connector location.
# c.SSHEngineSetLauncher.engines = {'my.example.com' : 3,
# 'you@ipython.scipy.org' : (2, ['-f', '/path/to/ipcontroller-engine.json']}
# }
Brian Granger
More work on the launchers and Win HPC support.
r2333
#-----------------------------------------------------------------------------
# Unix batch (PBS) schedulers launchers
#-----------------------------------------------------------------------------
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # SGE and PBS are very similar. All configurables in this section called 'PBS*'
# also exist as 'SGE*'.
Brian Granger
Work on default config files and docstrings....
r2310 # The command line program to use to submit a PBS job.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.PBSLauncher.submit_command = ['qsub']
Brian Granger
Work on default config files and docstrings....
r2310
# The command line program to use to delete a PBS job.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.PBSLauncher.delete_command = ['qdel']
# The PBS queue in which the job should run
# c.PBSLauncher.queue = 'myqueue'
Brian Granger
Work on default config files and docstrings....
r2310
# A regular expression that takes the output of qsub and find the job id.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.PBSLauncher.job_id_regexp = r'\d+'
# If for some reason the Controller and Engines have different options above, they
# can be set as c.PBSControllerLauncher.<option> etc.
# PBS and SGE have default templates, but you can specify your own, either as strings
# or from files, as described here:
Brian Granger
Work on default config files and docstrings....
r2310
# The batch submission script used to start the controller. This is where
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # environment variables would be setup, etc. This string is interpreted using
Brian Granger
Fixing how the working directory is handled in kernel....
r2336 # the Itpl module in IPython.external. Basically, you can use ${n} for the
# number of engine and ${cluster_dir} for the cluster_dir.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.PBSControllerLauncher.batch_template = """
# #PBS -N ipcontroller
# #PBS -q $queue
#
# ipcontrollerz --cluster-dir $cluster_dir
# """
# You can also load this template from a file
# c.PBSControllerLauncher.batch_template_file = u"/path/to/my/template.sh"
Brian Granger
Adding files for the refactored kernel scripts.
r2304
Brian Granger
Work on default config files and docstrings....
r2310 # The name of the instantiated batch script that will actually be used to
# submit the job. This will be written to the cluster directory.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.PBSControllerLauncher.batch_file_name = u'pbs_controller'
Brian Granger
Work on default config files and docstrings....
r2310
# The batch submission script used to start the engines. This is where
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # environment variables would be setup, etc. This string is interpreted using
Brian Granger
Work on default config files and docstrings....
r2310 # the Itpl module in IPython.external. Basically, you can use ${n} for the
Brian Granger
Fixing how the working directory is handled in kernel....
r2336 # number of engine and ${cluster_dir} for the cluster_dir.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.PBSEngineSetLauncher.batch_template = """
# #PBS -N ipcontroller
# #PBS -l nprocs=$n
#
# ipenginez --cluster-dir $cluster_dir$s
# """
# You can also load this template from a file
# c.PBSControllerLauncher.batch_template_file = u"/path/to/my/template.sh"
Brian Granger
Work on default config files and docstrings....
r2310
# The name of the instantiated batch script that will actually be used to
# submit the job. This will be written to the cluster directory.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # c.PBSEngineSetLauncher.batch_file_name = u'pbs_engines'
Brian Granger
Work on default config files and docstrings....
r2310
#-----------------------------------------------------------------------------
Brian Granger
More work on the launchers and Win HPC support.
r2333 # Windows HPC Server 2008 launcher configuration
Brian Granger
Work on default config files and docstrings....
r2310 #-----------------------------------------------------------------------------
Brian Granger
More work on the launchers and Win HPC support.
r2333 # c.IPControllerJob.job_name = 'IPController'
# c.IPControllerJob.is_exclusive = False
Brian Granger
Fixing minor bugs in IPython.kernel....
r2342 # c.IPControllerJob.username = r'USERDOMAIN\USERNAME'
Brian Granger
More work on the launchers and Win HPC support.
r2333 # c.IPControllerJob.priority = 'Highest'
# c.IPControllerJob.requested_nodes = ''
# c.IPControllerJob.project = 'MyProject'
# c.IPControllerTask.task_name = 'IPController'
# c.IPControllerTask.controller_cmd = [u'ipcontroller.exe']
# c.IPControllerTask.controller_args = ['--log-to-file', '--log-level', '40']
# c.IPControllerTask.environment_variables = {}
# c.WindowsHPCControllerLauncher.scheduler = 'HEADNODE'
# c.WindowsHPCControllerLauncher.job_file_name = u'ipcontroller_job.xml'
# c.IPEngineSetJob.job_name = 'IPEngineSet'
# c.IPEngineSetJob.is_exclusive = False
Brian Granger
Fixing minor bugs in IPython.kernel....
r2342 # c.IPEngineSetJob.username = r'USERDOMAIN\USERNAME'
Brian Granger
More work on the launchers and Win HPC support.
r2333 # c.IPEngineSetJob.priority = 'Highest'
# c.IPEngineSetJob.requested_nodes = ''
# c.IPEngineSetJob.project = 'MyProject'
# c.IPEngineTask.task_name = 'IPEngine'
# c.IPEngineTask.engine_cmd = [u'ipengine.exe']
# c.IPEngineTask.engine_args = ['--log-to-file', '--log-level', '40']
# c.IPEngineTask.environment_variables = {}
# c.WindowsHPCEngineSetLauncher.scheduler = 'HEADNODE'
# c.WindowsHPCEngineSetLauncher.job_file_name = u'ipengineset_job.xml'
Brian Granger
Work on default config files and docstrings....
r2310
Brian Granger
Adding files for the refactored kernel scripts.
r2304