def listen_for_halt(): name = 'Halt_Listener' setproctitle(name) connection.client_setname(name) pubsub = connection.pubsub() pubsub.subscribe('control') for message in pubsub.listen(): if message['type'] == 'message': message_lookup[message['data']]()
def listen_for_halt(): name = 'Halt_Listener' setproctitle(name) connection.client_setname(name) pubsub = connection.pubsub() pubsub.subscribe('control') for message in pubsub.listen(): if message['type'] == 'message': message_lookup[message['data']]()
import json from pprint import pprint from tasa.store import connection pubsub = connection.pubsub() pubsub.subscribe('logging') try: for message in pubsub.listen(): print message if message['type'] == 'message': pprint(json.loads(message['data'])) except KeyboardInterrupt: pass