From 7f735fe2fa87acaa0c11000fdc1739773e752f51 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 28 Jun 2012 12:12:22 -0400 Subject: [PATCH] Log file cleanup + improvements -Don't show queue timeout as error -Show UTC time and current timezone on pypo startup --- python_apps/pypo/pypocli.py | 10 +++++++++- python_apps/pypo/pypofetch.py | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/python_apps/pypo/pypocli.py b/python_apps/pypo/pypocli.py index c2094003c..e11de3047 100644 --- a/python_apps/pypo/pypocli.py +++ b/python_apps/pypo/pypocli.py @@ -2,8 +2,10 @@ Python part of radio playout (pypo) """ -import time from optparse import OptionParser +from datetime import datetime + +import time import sys import signal import logging @@ -124,6 +126,12 @@ if __name__ == '__main__': logger.info('# Liquidsoap Scheduled Playout System #') logger.info('###########################################') + #Although all of our calculations are in UTC, it is useful to know what timezone + #the local machine is, so that we have a reference for what time the actual + #log entries were made + logger.info("Timezone: %s" % time.tzname) + logger.info("UTC time: %s" % datetime.utcnow()) + signal.signal(signal.SIGINT, keyboardInterruptHandler) # initialize diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index de76a4ca0..c62c6ca57 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -9,6 +9,8 @@ import telnetlib import copy from threading import Thread +from Queue import Empty + from api_clients import api_client from std_err_override import LogWriter @@ -493,6 +495,8 @@ class PypoFetch(Thread): message = self.fetch_queue.get(block=True, timeout=self.listener_timeout) self.handle_message(message) + except Empty, e: + self.logger.info("Queue timeout. Fetching schedule manually") except Exception, e: import traceback top = traceback.format_exc()