From b3c5591d70c1c354d14267e804ab64872af97b40 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Tue, 29 Jan 2008 16:19:30 -0500 Subject: All exceptions, async or otherwise, now come back as easily detectable signatures. Use utils.is_error(result) to determine if something is an error or isn't. Example scripts as well as func-inventory have been updated. See async_test.py for examples. --- func/utils.py | 58 ++++++++++++++++++++-------------------------------------- 1 file changed, 20 insertions(+), 38 deletions(-) (limited to 'func/utils.py') diff --git a/func/utils.py b/func/utils.py index c2fbb9f..1a4abb7 100755 --- a/func/utils.py +++ b/func/utils.py @@ -16,17 +16,13 @@ import sys import traceback import xmlrpclib -REMOTE_CANARY = "***REMOTE_ERROR***" +REMOTE_ERROR = "REMOTE_ERROR" -# this is kind of handy, so keep it around for now -# but we really need to fix out server side logging and error -# reporting so we don't need it def trace_me(): x = traceback.extract_stack() bar = string.join(traceback.format_list(x)) return bar - def daemonize(pidfile=None): """ Daemonize this process with the UNIX double-fork trick. @@ -41,41 +37,27 @@ def daemonize(pidfile=None): os.umask(0) pid = os.fork() - if pid > 0: if pidfile is not None: open(pidfile, "w").write(str(pid)) sys.exit(0) -def remove_exceptions(results): - """ - Used by forkbomb/jobthing to avoid storing exceptions in database - because you know those don't serialize so well :) - # FIXME: this needs cleanup - """ - - if results is None: - return REMOTE_CANARY - - if str(results).startswith("