Commit d46f496c authored by Vincent Pelletier's avatar Vincent Pelletier

Output formated timestamp in front of each message.

parent 2dfa0a97
...@@ -9,7 +9,7 @@ import socket ...@@ -9,7 +9,7 @@ import socket
import pprint import pprint
import traceback import traceback
from SlapOSControler import SlapOSControler from SlapOSControler import SlapOSControler
import time
class SubprocessError(EnvironmentError): class SubprocessError(EnvironmentError):
def __init__(self, status_dict): def __init__(self, status_dict):
...@@ -22,6 +22,10 @@ class SubprocessError(EnvironmentError): ...@@ -22,6 +22,10 @@ class SubprocessError(EnvironmentError):
from Updater import Updater from Updater import Updater
def log(message):
# Log to stdout, with a timestamp.
print time.strftime('%Y/%m/%d %H:%M:%S'), message
process_group_pid_set = set() process_group_pid_set = set()
process_pid_file_list = [] process_pid_file_list = []
process_command_list = [] process_command_list = []
...@@ -51,8 +55,10 @@ def safeRpcCall(function, *args): ...@@ -51,8 +55,10 @@ def safeRpcCall(function, *args):
try: try:
return function(*args) return function(*args)
except: except:
traceback.print_exc() log('Error in RPC call: %s\n%s' % (
pprint.pprint(args) traceback.format_exc(),
pprint.pformat(args),
))
time.sleep(retry) time.sleep(retry)
retry += retry >> 1 retry += retry >> 1
...@@ -175,7 +181,7 @@ branch = %(branch)s ...@@ -175,7 +181,7 @@ branch = %(branch)s
retry_software = False retry_software = False
previous_revision = revision previous_revision = revision
print config log(config)
portal_url = config['test_suite_master_url'] portal_url = config['test_suite_master_url']
test_result_path = None test_result_path = None
test_result = (test_result_path, revision) test_result = (test_result_path, revision)
...@@ -191,7 +197,7 @@ branch = %(branch)s ...@@ -191,7 +197,7 @@ branch = %(branch)s
config['test_suite'], revision, [], config['test_suite'], revision, [],
False, test_suite_title, False, test_suite_title,
config['test_node_title'], config['project_title']) config['test_node_title'], config['project_title'])
print "testnode, test_result : %r" % (test_result,) log("testnode, test_result : %r" % (test_result, ))
if test_result: if test_result:
test_result_path, test_revision = test_result test_result_path, test_revision = test_result
if revision != test_revision: if revision != test_revision:
...@@ -258,5 +264,5 @@ branch = %(branch)s ...@@ -258,5 +264,5 @@ branch = %(branch)s
# Nice way to kill *everything* generated by run process -- process # Nice way to kill *everything* generated by run process -- process
# groups working only in POSIX compilant systems # groups working only in POSIX compilant systems
# Exceptions are swallowed during cleanup phase # Exceptions are swallowed during cleanup phase
print "going to kill %r" % (process_group_pid_set,) log("going to kill %r" % (process_group_pid_set, ))
killPreviousRun(process_group_pid_set, supervisord_pid_file) killPreviousRun(process_group_pid_set, supervisord_pid_file)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment