summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO19
-rw-r--r--PKGBUILD32
-rw-r--r--host.patch132
3 files changed, 183 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..7ea2fa805888
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = python-remote_ikernel
+ pkgdesc = Remote kernel setup for Jupyter
+ pkgver = 0.4.6
+ pkgrel = 1
+ url = https://bitbucket.org/tdaff/remote_ikernel
+ arch = any
+ license = BSD
+ checkdepends = python-pytest-runner
+ checkdepends = python-scripttest
+ makedepends = python-setuptools
+ depends = python-pexpect
+ depends = jupyter-notebook
+ source = https://files.pythonhosted.org/packages/source/r/remote_ikernel/remote_ikernel-0.4.6.tar.gz
+ source = host.patch
+ sha256sums = 740b80a57fa1af40cadef541c5a4eb293675b504092ecf00c57dd2f0011bd840
+ sha256sums = bf209f55f6dea633e09a7f809ae9e1aa7c0d9fdfd0d026d8cf900b7a6d8cf6af
+
+pkgname = python-remote_ikernel
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..b8b88c89d79e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Otakar Jasek <jasek dot ota at gmail dot com>
+
+pkgname=python-remote_ikernel
+_name=${pkgname#python-}
+pkgver=0.4.6
+pkgrel=1
+pkgdesc="Remote kernel setup for Jupyter"
+arch=(any)
+url="https://bitbucket.org/tdaff/remote_ikernel"
+license=('BSD')
+depends=('python-pexpect' 'jupyter-notebook')
+makedepends=('python-setuptools')
+checkdepends=('python-pytest-runner' 'python-scripttest')
+source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz
+'host.patch')
+sha256sums=('740b80a57fa1af40cadef541c5a4eb293675b504092ecf00c57dd2f0011bd840'
+ 'bf209f55f6dea633e09a7f809ae9e1aa7c0d9fdfd0d026d8cf900b7a6d8cf6af')
+
+prepare() {
+ cd "$srcdir/$_name-$pkgver"
+ patch -Np1 < ../host.patch
+}
+
+build() {
+ cd "$srcdir/$_name-$pkgver"
+ python setup.py build
+}
+
+package() {
+ cd "$srcdir/$_name-$pkgver"
+ python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
+}
diff --git a/host.patch b/host.patch
new file mode 100644
index 000000000000..99da42c32a74
--- /dev/null
+++ b/host.patch
@@ -0,0 +1,132 @@
+# HG changeset patch
+# User Bitbucket <noreply@bitbucket.org>
+# Date 0 0
+# Node ID f1c61b7dab8a078193cb611920a14b65c5c9c6a8
+# Parent 69fe424722f50cf74b9c1b5db1095f0430e22181
+# Parent c41d418c286245cf6161eefc9a5bff5ba9ba2404
+
+diff -r 69fe424722f5 -r f1c61b7dab8a remote_ikernel/kernel.py
+--- a/remote_ikernel/kernel.py
++++ b/remote_ikernel/kernel.py
+@@ -18,6 +18,7 @@
+ import uuid
+
+ import pexpect
++import warnings
+
+ from tornado.log import LogFormatter
+
+@@ -173,6 +174,20 @@
+
+ """
+
++ @property
++ def host(self):
++ return self._host
++
++ @host.setter
++ def host(self, new):
++ if isinstance(new, bytes):
++ warnings.warn('Automatically Decoding self.host assignment to bytes. Did you forget a `.decode()` ? ')
++ self._host = new.decode()
++ elif isinstance(new, str):
++ self._host = new
++ else:
++ raise TypeError('self.host can only be assigned `str` or `bytes`, not `{}`'.format(type(new)))
++
+ def __init__(self, connection_info=None, interface='sge', cpus=1, pe='smp',
+ kernel_cmd='ipython kernel', workdir=None, tunnel=True,
+ host=None, precmd=None, launch_args=None, verbose=False,
+@@ -196,7 +211,12 @@
+ self.cpus = cpus
+ self.pe = pe
+ self.kernel_cmd = kernel_cmd
+- self.host = host # Name of node to be changed once connection is ready.
++ self._host = ''
++ if not host :
++ self.host = ''
++ else:
++ self.host = host
++
+ self.tunnel_hosts = tunnel_hosts
+ self.connection = None # will usually be a spawned pexpect
+ self.workdir = workdir
+@@ -331,10 +351,10 @@
+ # hostnames whould be alphanumeric with . and - permitted
+ # This way we also ignore the echoed echo command
+ qsub_i.expect('Running on ([\w.-]+)')
+- node = qsub_i.match.groups()[0]
++ node = qsub_i.match.groups()[0] or b''
+
+ self.log.info("Established session on node: {0}.".format(node))
+- self.host = node
++ self.host = node.decode()
+
+ def launch_sge(self, qlogin='qlogin'):
+ """
+@@ -361,9 +381,9 @@
+ # Hopefully this text is universal?
+ qlogin.expect('Establishing .* session to host (.*) ...')
+
+- node = qlogin.match.groups()[0]
++ node = qlogin.match.groups()[0] or b''
+ self.log.info("Established session on node: {0}.".format(node))
+- self.host = node
++ self.host = node.decode()
+
+ def launch_slurm(self):
+ """
+@@ -390,9 +410,9 @@
+ # Hopefully this text is universal?
+ srun.expect('srun: Node (.*), .* tasks started')
+
+- node = srun.match.groups()[0]
++ node = srun.match.groups()[0] or b''
+ self.log.info("Established session on node: {0}.".format(node))
+- self.host = node
++ self.host = node.decode()
+
+ def launch_lsf(self):
+ """
+@@ -418,9 +438,9 @@
+ # Hopefully this text is universal?
+ bsub.expect('<<Starting on (.*)>>')
+
+- node = bsub.match.groups()[0]
++ node = bsub.match.groups()[0] or b''
+ self.log.info("Established session on node: {0}.".format(node))
+- self.host = node
++ self.host = node.decode()
+
+ def start_kernel(self):
+ """
+@@ -597,10 +617,6 @@
+ @property
+ def tunnel_cmd(self):
+ """Return a tunnelling command that just needs a port."""
+- # zmq needs str in Python 3, but pexpect gives bytes
+- if hasattr(self.host, 'decode'):
+- self.host = self.host.decode('utf-8')
+-
+ # One connection can tunnel all the ports
+ ports_str = " ".join(["-L 127.0.0.1:{{{port}}}:127.0.0.1:{{{port}}}"
+ "".format(port=port) for port in PORT_NAMES])
+diff -r 69fe424722f5 -r f1c61b7dab8a setup.py
+--- a/setup.py
++++ b/setup.py
+@@ -7,10 +7,13 @@
+ from distutils.core import setup
+ scripts = ['bin/remote_ikernel']
+
++with open('README.rst') as f:
++ long_desc = f.read()
++
+ setup(name='remote_ikernel',
+ version='0.4.6',
+ description='Running IPython kernels through batch queues',
+- long_description=open('README.rst').read(),
++ long_description=long_desc,
+ author='Tom Daff',
+ author_email='tdd20@cam.ac.uk',
+ license='BSD',
+