Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use KernelApp.exec_lines/files in IPEngineApp #2214

Merged
merged 1 commit into from Jul 29, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 13 additions & 6 deletions IPython/parallel/apps/ipengineapp.py
Expand Up @@ -316,15 +316,22 @@ def init_engine(self):


try:
exec_lines = config.Kernel.exec_lines
exec_lines = config.IPKernelApp.exec_lines
except AttributeError:
config.Kernel.exec_lines = []
exec_lines = config.Kernel.exec_lines
try:
exec_lines = config.InteractiveShellApp.exec_lines
except AttributeError:
exec_lines = config.IPKernelApp.exec_lines = []
try:
exec_files = config.IPKernelApp.exec_files
except AttributeError:
try:
exec_files = config.InteractiveShellApp.exec_files
except AttributeError:
exec_files = config.IPKernelApp.exec_files = []

if self.startup_script:
enc = sys.getfilesystemencoding() or 'utf8'
cmd="execfile(%r)" % self.startup_script.encode(enc)
exec_lines.append(cmd)
exec_files.append(self.startup_script)
if self.startup_command:
exec_lines.append(self.startup_command)

Expand Down
11 changes: 8 additions & 3 deletions IPython/parallel/engine/engine.py
Expand Up @@ -34,7 +34,7 @@
from IPython.parallel.util import disambiguate_url

from IPython.zmq.session import Message
from IPython.zmq.ipkernel import Kernel
from IPython.zmq.ipkernel import Kernel, IPKernelApp

class EngineFactory(RegistrationFactory):
"""IPython engine"""
Expand Down Expand Up @@ -198,10 +198,15 @@ def url(key):
self.kernel = Kernel(config=self.config, int_id=self.id, ident=self.ident, session=self.session,
control_stream=control_stream, shell_streams=shell_streams, iopub_socket=iopub_socket,
loop=loop, user_ns=self.user_ns, log=self.log)

self.kernel.shell.display_pub.topic = cast_bytes('engine.%i.displaypub' % self.id)

# FIXME: This is a hack until IPKernelApp and IPEngineApp can be fully merged
app = IPKernelApp(config=self.config, shell=self.kernel.shell, kernel=self.kernel, log=self.log)
app.init_profile_dir()
app.init_code()

self.kernel.start()


else:
self.log.fatal("Registration Failed: %s"%msg)
raise Exception("Registration Failed: %s"%msg)
Expand Down