Exemple #1
0
def main(logfile):
    co = kernelConfigManager.getConfigObj()
    if logfile:
        logfile = logfile + str(os.getpid()) + '.log'
        try:
            openLogFile = open(logfile, 'w')
        except:
            openLogFile = sys.stdout
    else:
        openLogFile = sys.stdout
    log.startLogging(openLogFile)

    # Execute any user defined import statements
    cis = co['controller']['controllerImportStatement']
    if cis:
        try:
            exec cis
        except:
            log.msg("Error running controllerImportStatement: %s" % cis)

    # Create and configure the core ControllerService
    cs = controllerservice.ControllerService()

    # Start listening for engines
    efac = kernelConfigManager._import(
        co['controller']['engineServerProtocolInterface'])(cs)
    reactor.listenTCP(
        port=co['controller']['listenForEnginesOn'].as_int('port'),
        factory=efac,
        interface=co['controller']['listenForEnginesOn']['ip'])

    for ciname, ci in co['controller']['controllerInterfaces'].iteritems():
        log.msg("Starting controller interface: " + ciname)
        adaptedController = kernelConfigManager._import(
            ci['controllerInterface'])(cs)
        for niname, ni in ci['networkInterfaces'].iteritems():
            log.msg("Starting controller network interface (%s): %s:%s:%i" %
                    (ciname, niname, ni['ip'], ni.as_int('port')))
            fac = kernelConfigManager._import(
                ni['interface'])(adaptedController)
            reactor.listenTCP(port=ni.as_int('port'),
                              factory=fac,
                              interface=ni['ip'])

    # Start the controller service and set things running
    cs.startService()
    reactor.run()
def main(n, logfile):
    kco = kernelConfigManager.get_config_obj()
    cco = coreConfigManager.get_config_obj()

    mpikey = kco['mpi']['default']
    mpiImportStatement = kco['mpi'].get(mpikey, None)
    if mpiImportStatement is not None:
        try:
            exec mpiImportStatement
        except:
            mpi = None
    else:
        mpi = None

    if logfile:
        logfile = logfile + str(os.getpid()) + '.log'
        try:
            openLogFile = open(logfile, 'w')
        except:
            openLogFile = sys.stdout
    else:
        openLogFile = sys.stdout
    log.startLogging(openLogFile)

    for i in range(n):
        shellClass = coreConfigManager._import(cco['shell']['shellClass'])
        service = EngineService(shellClass, mpi=mpi)
        fac = kernelConfigManager._import(
            kco['engine']['engineClientProtocolInterface'])(service)
        reactor.connectTCP(
            host=kco['engine']['connectToControllerOn']['ip'],
            port=kco['engine']['connectToControllerOn'].as_int('port'),
            factory=fac)
        service.startService()
        sis = cco['shell']['shellImportStatement']
        if sis:
            try:
                service.execute(sis)
            except:
                log.msg("Error running shellImportStatement: %s" % sis)

    reactor.run()
def AsynTaskClient(addr):
    """The default TaskClient class obtained from config information."""
    _task_controller = kernelConfigManager._import(
        co['client']['TaskControllerImplementation'])
    return _task_controller(addr)
#!/usr/bin/env python
# encoding: utf-8

from ipython1.kernel import codeutil
from ipython1.kernel.config import configManager as kernelConfigManager
from ipython1.kernel import multiengine as me
from ipython1.kernel.error import CompositeError

co = kernelConfigManager.get_config_obj()

SynchronousMultiEngine = kernelConfigManager._import(
    co['client']['MultiEngineImplementation'])
"""The default MultiEngineClient class obtained from config information."""


def AsynMultiEngineClient(addr):
    """The default Asynch. MultiEngineClient class."""
    smultiengine = SynchronousMultiEngine(addr)
    return smultiengine


default_address = (co['client']['connectToMultiEngineControllerOn']['ip'],
                   co['client']['connectToMultiEngineControllerOn']['port'])
"""The (ip,port) tuple of the default MultiEngineClient."""


def AsynTaskClient(addr):
    """The default TaskClient class obtained from config information."""
    _task_controller = kernelConfigManager._import(
        co['client']['TaskControllerImplementation'])
    return _task_controller(addr)
Exemple #5
0
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
#       Copyright (C) 2005  Fernando Perez <*****@*****.**>
#                           Brian E Granger <*****@*****.**>
#                           Benjamin Ragan-Kelley <*****@*****.**>
#
#  Distributed under the terms of the BSD License.  The full license is in
#  the file COPYING, distributed as part of this software.
#-------------------------------------------------------------------------------

from ipython1.kernel.config import configManager as kernelConfigManager
co = kernelConfigManager.getConfigObj()

import ipython1.kernel.magic

RemoteController = kernelConfigManager._import(
    co['client']['RemoteController'])
"""The default RemoteController class obtained from config information."""

defaultRemoteController = (co['client']['connectToRemoteControllerOn']['ip'],
                           co['client']['connectToRemoteControllerOn']['port'])
"""The (ip,port) tuple of the default controller."""

from ipython1.kernel.task import Task

TaskController = kernelConfigManager._import(co['client']['TaskController'])
"""The default TaskController class obtained from config information."""

defaultTaskController = (co['client']['connectToTaskControllerOn']['ip'],
                         co['client']['connectToTaskControllerOn']['port'])
"""The (ip,port) tuple of the default task controller."""