Skip to content

Commit

Permalink
move IPython.zmq.parallel to IPython.parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Apr 8, 2011
1 parent b5b9a12 commit a6a0636
Show file tree
Hide file tree
Showing 78 changed files with 535 additions and 237 deletions.
6 changes: 3 additions & 3 deletions IPython/config/default/ipclusterz_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
# - PBSControllerLauncher
# - SGEControllerLauncher
# - WindowsHPCControllerLauncher
# c.Global.controller_launcher = 'IPython.zmq.parallel.launcher.LocalControllerLauncher'
c.Global.controller_launcher = 'IPython.zmq.parallel.launcher.PBSControllerLauncher'
# c.Global.controller_launcher = 'IPython.parallel.launcher.LocalControllerLauncher'
c.Global.controller_launcher = 'IPython.parallel.launcher.PBSControllerLauncher'

# Options are:
# - LocalEngineSetLauncher
# - MPIExecEngineSetLauncher
# - PBSEngineSetLauncher
# - SGEEngineSetLauncher
# - WindowsHPCEngineSetLauncher
# c.Global.engine_launcher = 'IPython.zmq.parallel.launcher.LocalEngineSetLauncher'
# c.Global.engine_launcher = 'IPython.parallel.launcher.LocalEngineSetLauncher'

#-----------------------------------------------------------------------------
# Global configuration
Expand Down
8 changes: 4 additions & 4 deletions IPython/config/default/ipcontrollerz_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
# Which class to use for the db backend. Currently supported are DictDB (the
# default), and MongoDB. Uncomment this line to enable MongoDB, which will
# slow-down the Hub's responsiveness, but also reduce its memory footprint.
# c.HubFactory.db_class = 'IPython.zmq.parallel.mongodb.MongoDB'
# c.HubFactory.db_class = 'IPython.parallel.mongodb.MongoDB'

# The heartbeat ping frequency. This is the frequency (in ms) at which the
# Hub pings engines for heartbeats. This determines how quickly the Hub
Expand Down Expand Up @@ -144,11 +144,11 @@

# ----- in-memory configuration --------
# this line restores the default behavior: in-memory storage of all results.
# c.HubFactory.db_class = 'IPython.zmq.parallel.dictdb.DictDB'
# c.HubFactory.db_class = 'IPython.parallel.dictdb.DictDB'

# ----- sqlite configuration --------
# use this line to activate sqlite:
# c.HubFactory.db_class = 'IPython.zmq.parallel.sqlitedb.SQLiteDB'
# c.HubFactory.db_class = 'IPython.parallel.sqlitedb.SQLiteDB'

# You can specify the name of the db-file. By default, this will be located
# in the active cluster_dir, e.g. ~/.ipython/clusterz_default/tasks.db
Expand All @@ -165,7 +165,7 @@

# ----- mongodb configuration --------
# use this line to activate mongodb:
# c.HubFactory.db_class = 'IPython.zmq.parallel.mongodb.MongoDB'
# c.HubFactory.db_class = 'IPython.parallel.mongodb.MongoDB'

# You can specify the args and kwargs pymongo will use when creating the Connection.
# For more information on what these options might be, see pymongo documentation.
Expand Down
2 changes: 1 addition & 1 deletion IPython/external/ssh/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
except ImportError:
pexpect = None

from IPython.zmq.parallel.entry_point import select_random_ports
from IPython.parallel.entry_point import select_random_ports

#-----------------------------------------------------------------------------
# Code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
import zmq

if zmq.__version__ < '2.1.3':
raise ImportError("IPython.zmq.parallel requires pyzmq/0MQ >= 2.1.3, you appear to have %s"%zmq.__version__)
raise ImportError("IPython.parallel requires pyzmq/0MQ >= 2.1.3, you appear to have %s"%zmq.__version__)

from .asyncresult import *
from .client import Client
from .dependency import *
from .remotefunction import *
from .view import *
from IPython.utils.pickleutil import Reference


File renamed without changes.
21 changes: 3 additions & 18 deletions IPython/zmq/parallel/client.py → IPython/parallel/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# from zmq.eventloop import ioloop, zmqstream

from IPython.utils.path import get_ipython_dir
from IPython.utils.pickleutil import Reference
from IPython.utils.traitlets import (HasTraits, Int, Instance, CUnicode,
Dict, List, Bool, Str, Set)
from IPython.external.decorator import decorator
Expand All @@ -33,10 +32,8 @@
from . import error
from . import util
from . import streamsession as ss
from .asyncresult import AsyncResult, AsyncMapResult, AsyncHubResult
from .asyncresult import AsyncResult, AsyncHubResult
from .clusterdir import ClusterDir, ClusterDirError
from .dependency import Dependency, depend, require, dependent
from .remotefunction import remote, parallel, ParallelFunction, RemoteFunction
from .view import DirectView, LoadBalancedView

#--------------------------------------------------------------------------
Expand Down Expand Up @@ -985,7 +982,7 @@ def load_balanced_view(self, targets=None):
targets: list,slice,int,etc. [default: use all engines]
The subset of engines across which to load-balance
"""
if targets is None:
if targets is not None:
targets = self._build_targets(targets)[1]
return LoadBalancedView(client=self, socket=self._task_socket, targets=targets)

Expand Down Expand Up @@ -1278,16 +1275,4 @@ def purge_results(self, jobs=[], targets=[]):
raise self._unwrap_exception(content)


__all__ = [ 'Client',
'depend',
'require',
'remote',
'parallel',
'RemoteFunction',
'ParallelFunction',
'DirectView',
'LoadBalancedView',
'AsyncResult',
'AsyncMapResult',
'Reference'
]
__all__ = [ 'Client' ]
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __name__(self):
@interactive
def _require(*names):
"""Helper for @require decorator."""
from IPython.zmq.parallel.error import UnmetDependency
from IPython.parallel.error import UnmetDependency
user_ns = globals()
for name in names:
if name in user_ns:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from IPython.utils.importstring import import_item
from IPython.utils.traitlets import Str,Int,Instance, CUnicode, CStr

import IPython.zmq.parallel.streamsession as ss
from IPython.zmq.parallel.entry_point import select_random_ports
import IPython.parallel.streamsession as ss
from IPython.parallel.entry_point import select_random_ports

#-----------------------------------------------------------------------------
# Classes
Expand All @@ -37,7 +37,7 @@ def _logname_changed(self, name, old, new):


class SessionFactory(LoggingFactory):
"""The Base factory from which every factory in IPython.zmq.parallel inherits"""
"""The Base factory from which every factory in IPython.parallel inherits"""

packer = Str('',config=True)
unpacker = Str('',config=True)
Expand All @@ -48,7 +48,7 @@ def _ident_default(self):
exec_key = CUnicode('',config=True)
# not configurable:
context = Instance('zmq.Context', (), {})
session = Instance('IPython.zmq.parallel.streamsession.StreamSession')
session = Instance('IPython.parallel.streamsession.StreamSession')
loop = Instance('zmq.eventloop.ioloop.IOLoop', allow_none=False)
def _loop_default(self):
return IOLoop.instance()
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions IPython/zmq/parallel/hub.py → IPython/parallel/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ def _notifier_port_default(self):

monitor_url = CStr('')

db_class = CStr('IPython.zmq.parallel.dictdb.DictDB', config=True)
db_class = CStr('IPython.parallel.dictdb.DictDB', config=True)

# not configurable
db = Instance('IPython.zmq.parallel.dictdb.BaseDB')
heartmonitor = Instance('IPython.zmq.parallel.heartmonitor.HeartMonitor')
db = Instance('IPython.parallel.dictdb.BaseDB')
heartmonitor = Instance('IPython.parallel.heartmonitor.HeartMonitor')
subconstructors = List()
_constructed = Bool(False)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def strip_args(flags, args=sys.argv[1:]):

def launch_process(mod, args):
"""Launch a controller or engine in a subprocess."""
code = "from IPython.zmq.parallel.%s import launch_new_instance;launch_new_instance()"%mod
code = "from IPython.parallel.%s import launch_new_instance;launch_new_instance()"%mod
arguments = [ sys.executable, '-c', code ] + args
blackholew = file(os.devnull, 'w')
blackholer = file(os.devnull, 'r')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from IPython.external.argparse import ArgumentParser, SUPPRESS
from IPython.utils.importstring import import_item
from IPython.zmq.parallel.clusterdir import (
from IPython.parallel.clusterdir import (
ApplicationWithClusterDir, ClusterDirConfigLoader,
ClusterDirError, PIDFileError
)
Expand Down Expand Up @@ -260,9 +260,9 @@ class IPClusterApp(ApplicationWithClusterDir):
def create_default_config(self):
super(IPClusterApp, self).create_default_config()
self.default_config.Global.controller_launcher = \
'IPython.zmq.parallel.launcher.LocalControllerLauncher'
'IPython.parallel.launcher.LocalControllerLauncher'
self.default_config.Global.engine_launcher = \
'IPython.zmq.parallel.launcher.LocalEngineSetLauncher'
'IPython.parallel.launcher.LocalEngineSetLauncher'
self.default_config.Global.n = 2
self.default_config.Global.delay = 2
self.default_config.Global.reset_config = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
from zmq.utils import jsonapi as json

from IPython.config.loader import Config
from IPython.zmq.parallel import factory
from IPython.zmq.parallel.controller import ControllerFactory
from IPython.zmq.parallel.clusterdir import (
from IPython.parallel import factory
from IPython.parallel.controller import ControllerFactory
from IPython.parallel.clusterdir import (
ApplicationWithClusterDir,
ClusterDirConfigLoader
)
from IPython.zmq.parallel.util import disambiguate_ip_address, split_url
from IPython.parallel.util import disambiguate_ip_address, split_url
# from IPython.kernel.fcutil import FCServiceFactory, FURLError
from IPython.utils.traitlets import Instance, Unicode

Expand Down Expand Up @@ -117,11 +117,11 @@ def _add_arguments(self):
## Hub Config:
paa('--mongodb',
dest='HubFactory.db_class', action='store_const',
const='IPython.zmq.parallel.mongodb.MongoDB',
const='IPython.parallel.mongodb.MongoDB',
help='Use MongoDB for task storage [default: in-memory]')
paa('--sqlite',
dest='HubFactory.db_class', action='store_const',
const='IPython.zmq.parallel.sqlitedb.SQLiteDB',
const='IPython.parallel.sqlitedb.SQLiteDB',
help='Use SQLite3 for DB task storage [default: in-memory]')
paa('--hb',
type=int, dest='HubFactory.hb', nargs=2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
import zmq
from zmq.eventloop import ioloop

from IPython.zmq.parallel.clusterdir import (
from IPython.parallel.clusterdir import (
ApplicationWithClusterDir,
ClusterDirConfigLoader
)
from IPython.zmq.log import EnginePUBHandler

from IPython.zmq.parallel import factory
from IPython.zmq.parallel.engine import EngineFactory
from IPython.zmq.parallel.streamkernel import Kernel
from IPython.zmq.parallel.util import disambiguate_url
from IPython.parallel import factory
from IPython.parallel.engine import EngineFactory
from IPython.parallel.streamkernel import Kernel
from IPython.parallel.util import disambiguate_url
from IPython.utils.importstring import import_item


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import zmq

from IPython.zmq.parallel.clusterdir import (
from IPython.parallel.clusterdir import (
ApplicationWithClusterDir,
ClusterDirConfigLoader
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def check_output(*args, **kwargs):


ipclusterz_cmd_argv = pycmd2argv(get_ipython_module_path(
'IPython.zmq.parallel.ipclusterapp'
'IPython.parallel.ipclusterapp'
))

ipenginez_cmd_argv = pycmd2argv(get_ipython_module_path(
'IPython.zmq.parallel.ipengineapp'
'IPython.parallel.ipengineapp'
))

ipcontrollerz_cmd_argv = pycmd2argv(get_ipython_module_path(
'IPython.zmq.parallel.ipcontrollerapp'
'IPython.parallel.ipcontrollerapp'
))

#-----------------------------------------------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
#-----------------------------------------------------------------------------


from IPython.zmq.parallel.ipclusterapp import launch_new_instance
from IPython.parallel.ipclusterapp import launch_new_instance

launch_new_instance()
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
#-----------------------------------------------------------------------------


from IPython.zmq.parallel.ipcontrollerapp import launch_new_instance
from IPython.parallel.ipcontrollerapp import launch_new_instance

launch_new_instance()
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#-----------------------------------------------------------------------------


from IPython.zmq.parallel.ipengineapp import launch_new_instance
from IPython.parallel.ipengineapp import launch_new_instance

launch_new_instance()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#-----------------------------------------------------------------------------


from IPython.zmq.parallel.iploggerapp import launch_new_instance
from IPython.parallel.iploggerapp import launch_new_instance

launch_new_instance()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def _init_db(self):
sqlite3.register_converter('bufs', _convert_bufs)
# connect to the db
dbfile = os.path.join(self.location, self.filename)
self._db = sqlite3.connect(dbfile, detect_types=sqlite3.PARSE_DECLTYPES)
self._db = sqlite3.connect(dbfile, detect_types=sqlite3.PARSE_DECLTYPES, cached_statements=16)
# print dir(self._db)

self._db.execute("""CREATE TABLE IF NOT EXISTS %s
(msg_id text PRIMARY KEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Kernel(SessionFactory):
control_stream = Instance(zmqstream.ZMQStream)
task_stream = Instance(zmqstream.ZMQStream)
iopub_stream = Instance(zmqstream.ZMQStream)
client = Instance('IPython.zmq.parallel.client.Client')
client = Instance('IPython.parallel.client.Client')

# internals
shell_streams = List()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import zmq
from zmq.core.poll import _poll as poll
from zmq.devices import ThreadDevice
from IPython.zmq.parallel import streamsession as ss
from IPython.parallel import streamsession as ss


class QueueStream(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import time
from subprocess import Popen, PIPE, STDOUT

from IPython.zmq.parallel import client
from IPython.parallel import client

processes = []
blackhole = tempfile.TemporaryFile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

from IPython.external.decorator import decorator

from IPython.zmq.parallel import error
from IPython.zmq.parallel.client import Client
from IPython.zmq.parallel.ipcluster import launch_process
from IPython.zmq.parallel.entry_point import select_random_ports
from IPython.zmq.parallel.tests import processes,add_engines
from IPython.parallel import error
from IPython.parallel.client import Client
from IPython.parallel.ipcluster import launch_process
from IPython.parallel.entry_point import select_random_ports
from IPython.parallel.tests import processes,add_engines

# simple tasks for use in apply tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#-------------------------------------------------------------------------------


from IPython.zmq.parallel.error import TimeoutError
from IPython.parallel.error import TimeoutError

from IPython.zmq.parallel.tests import add_engines
from IPython.parallel.tests import add_engines
from .clienttest import ClusterTestCase

def setup():
Expand Down
Loading

0 comments on commit a6a0636

Please sign in to comment.