Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

use KernelApp.exec_lines/files in IPEngineApp #2214

Merged
merged 1 commit into from

2 participants

@minrk
Owner

This change means that all your startup/exec_lines config is inherited by engines.

should be backported for 0.13.1, because engine startup code is impossible to configure in 0.13.

The real long-term fix for this is to make IPEngineApp a subclass of IPKernelApp, but this should be an adequate band-aid until then.

closes #2213

@minrk minrk use KernelApp.exec_lines/files in IPEngineApp
should be backported to 0.13.1, because engine startup code was impossible to configure.
14f71f0
@ellisonbg
Owner

I am fine with this as a temporary solution. The code looks good.

@minrk
Owner

Test results for commit 14f71f0 merged into master
Platform: darwin

  • python2.6: OK (libraries not available: cython matplotlib oct2py pygments pymongo qt rpy2 tornado wx wx.aui)
  • python2.7: OK (libraries not available: oct2py rpy2 wx wx.aui)
  • python3.2: OK (libraries not available: cython matplotlib oct2py pygments pymongo qt rpy2 wx wx.aui)

Not available for testing:

@minrk minrk merged commit 2ff8a90 into ipython:master
@minrk minrk referenced this pull request from a commit
@minrk minrk Backport PR #2214: use KernelApp.exec_lines/files in IPEngineApp
This change means that all your startup/exec_lines config is inherited by engines.

should be backported for 0.13.1, because engine startup code is impossible to configure in 0.13.

The real long-term fix for this is to make IPEngineApp a subclass of IPKernelApp, but this should be an adequate band-aid until then.

closes #2213
b1241d5
@minrk minrk deleted the minrk:engine_startup branch
@yarikoptic yarikoptic referenced this pull request from a commit in yarikoptic/ipython
@yarikoptic yarikoptic Merge commit 'rel-0.13-33-gcfc5692' into debian-01X
* commit 'rel-0.13-33-gcfc5692': (33 commits)
  Backport PR #2347: adjust division error message checking to account for Python 3
  Backport PR #2305: RemoteError._render_traceback_ calls self.render_traceback
  Backport PR #2280: fix SSH passwordless check for OpenSSH
  Backport PR #2270: SSHLauncher tweaks
  Backport PR #2261: Fix: longest_substr([]) -> ''
  Backport PR #2250: fix html in notebook example
  Backport PR #2235: remove spurious print statement from setupbase.py
  fixup
  Backport PR #2223: Custom tracebacks
  Backport PR #2214: use KernelApp.exec_lines/files in IPEngineApp
  Backport PR #2212: catch errors in markdown javascript
  Backport PR #2194: clean nan/inf in json_clean
  Backport PR #2177: remove numpy install from travis/tox scripts
  Backport PR #2169: ipdb: pdef, pdoc, pinfo magics all broken
  Backport PR #2186: removed references to h5py dependence in octave magic documentation
  Backport PR #2185: added test for %store, fixed storemagic
  Backport PR #2170: Fix tab completion with IPython.embed_kernel().
  Backport PR #2163: fix 'remote_profie_dir' typo in SSH launchers
  Backport PR #2117: use explicit url in notebook example
  Backport PR #2126: ipcluster broken with any batch (PBS/LSF/SGE)
  ...
fc7c7f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 27, 2012
  1. @minrk

    use KernelApp.exec_lines/files in IPEngineApp

    minrk authored
    should be backported to 0.13.1, because engine startup code was impossible to configure.
This page is out of date. Refresh to see the latest.
View
19 IPython/parallel/apps/ipengineapp.py
@@ -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)
View
11 IPython/parallel/engine/engine.py
@@ -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"""
@@ -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)
Something went wrong with that request. Please try again.