##// END OF EJS Templates
don't automatically add jobarray or queue lines to user template...
don't automatically add jobarray or queue lines to user template In parallel launchers, the queue and jobarray lines should not be added except in the default templates. user-templates must be fully specified. This prevents conflicts between PBS versions, which may not support jobarrays, etc. These lines are now only added to the *default* templates.

File last commit:

r3144:cd371626
r4183:965bc088
Show More
heartbeat.py
45 lines | 1.4 KiB | text/x-python | PythonLexer
"""The client and server for a basic ping-pong style heartbeat.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2010 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import sys
from threading import Thread
import zmq
from IPython.utils.localinterfaces import LOCALHOST
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
class Heartbeat(Thread):
"A simple ping-pong style heartbeat that runs in a thread."
def __init__(self, context, addr=(LOCALHOST, 0)):
Thread.__init__(self)
self.context = context
self.addr = addr
self.ip = addr[0]
self.port = addr[1]
self.daemon = True
def run(self):
self.socket = self.context.socket(zmq.REP)
if self.port == 0:
self.port = self.socket.bind_to_random_port('tcp://%s' % self.ip)
else:
self.socket.bind('tcp://%s:%i' % self.addr)
zmq.device(zmq.FORWARDER, self.socket, self.socket)