From: Mark Hymers Date: Mon, 28 Mar 2011 18:33:46 +0000 (+0100) Subject: Bugfixes for usage of DakProcessPool API X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d1714245f6df36ec2c7f2d7154b23e331f150a5;p=dak Bugfixes for usage of DakProcessPool API Signed-off-by: Mark Hymers --- diff --git a/dak/generate_filelist.py b/dak/generate_filelist.py index 360a1682..98d239c5 100755 --- a/dak/generate_filelist.py +++ b/dak/generate_filelist.py @@ -78,7 +78,7 @@ def writeSourceList(suite_id, component_id, incremental_mode): file.write(filename + '\n') session.rollback() file.close() - return message + return (PROC_STATUS_SUCCESS, message) def writeAllList(suite_id, component_id, architecture_id, type, incremental_mode): session = DBConn().session() @@ -95,7 +95,7 @@ def writeAllList(suite_id, component_id, architecture_id, type, incremental_mode file.write(filename + '\n') session.rollback() file.close() - return message + return (PROC_STATUS_SUCCESS, message) def writeBinaryList(suite_id, component_id, architecture_id, type, incremental_mode): session = DBConn().session() @@ -112,7 +112,7 @@ def writeBinaryList(suite_id, component_id, architecture_id, type, incremental_m file.write(filename + '\n') session.rollback() file.close() - return message + return (PROC_STATUS_SUCCESS, message) def usage(): print """Usage: dak generate_filelist [OPTIONS] diff --git a/dak/generate_packages_sources2.py b/dak/generate_packages_sources2.py index 286ce45a..2b792f3c 100755 --- a/dak/generate_packages_sources2.py +++ b/dak/generate_packages_sources2.py @@ -119,7 +119,7 @@ def generate_sources(suite_id, component_id): message = ["generate sources", suite.suite_name, component.component_name] session.rollback() - return message + return (PROC_STATUS_SUCCESS, message) ############################################################################# @@ -223,7 +223,7 @@ def generate_packages(suite_id, component_id, architecture_id, type_name): message = ["generate-packages", suite.suite_name, component.component_name, architecture.arch_string] session.rollback() - return message + return (PROC_STATUS_SUCCESS, message) ############################################################################# @@ -291,7 +291,7 @@ def main(): logger.close() - sys.exit(pool.output_status()) + sys.exit(pool.overall_status()) if __name__ == '__main__': main() diff --git a/dak/show_new.py b/dak/show_new.py index 7396d3cc..3b052c18 100755 --- a/dak/show_new.py +++ b/dak/show_new.py @@ -169,7 +169,7 @@ def do_pkg(changes_file): if os.path.exists(htmlfile) and \ os.stat(htmlfile).st_mtime > os.stat(origchanges).st_mtime: session.close() - return + return (PROC_STATUS_SUCCESS, '%s already up-to-date' % htmlfile) for deb_filename, f in files.items(): if deb_filename.endswith(".udeb") or deb_filename.endswith(".deb"): @@ -205,6 +205,8 @@ def do_pkg(changes_file): outfile.close() session.close() + return (PROC_STATUS_SUCCESS, '%s already updated' % htmlfile) + ################################################################################ def usage (exit_code=0): diff --git a/daklib/dakmultiprocessing.py b/daklib/dakmultiprocessing.py index 57152bf8..86fa74d5 100644 --- a/daklib/dakmultiprocessing.py +++ b/daklib/dakmultiprocessing.py @@ -26,7 +26,7 @@ multiprocessing for DAK ############################################################################### from multiprocessing.pool import Pool -from signal import signal, SIGHUP, SIGTERM, SIGPIPE, SIGCHLD, SIGALRM +from signal import signal, SIGHUP, SIGTERM, SIGPIPE, SIGALRM import sqlalchemy.orm.session @@ -57,7 +57,6 @@ def _func_wrapper(func, *args, **kwds): signal(SIGHUP, signal_handler) signal(SIGTERM, signal_handler) signal(SIGPIPE, signal_handler) - signal(SIGCHLD, signal_handler) signal(SIGALRM, signal_handler) # We expect our callback function to return: diff --git a/tests/test_multiprocessing.py b/tests/test_multiprocessing.py index c67e51fb..2d93e8aa 100755 --- a/tests/test_multiprocessing.py +++ b/tests/test_multiprocessing.py @@ -11,7 +11,7 @@ def test_function(num, num2): from os import kill, getpid if num == 1: - sigs = [signal.SIGTERM, signal.SIGCHLD, signal.SIGALRM, signal.SIGHUP] + sigs = [signal.SIGTERM, signal.SIGPIPE, signal.SIGALRM, signal.SIGHUP] kill(getpid(), sigs[num2]) if num2 == 3: @@ -47,7 +47,7 @@ class DakProcessPoolTestCase(DakTestCase): (PROC_STATUS_SUCCESS, 'blah, 0, 2'), (PROC_STATUS_EXCEPTION, 'Test uncaught exception handling'), (PROC_STATUS_SIGNALRAISED, 15), - (PROC_STATUS_SIGNALRAISED, 17), + (PROC_STATUS_SIGNALRAISED, 13), (PROC_STATUS_SIGNALRAISED, 14), (PROC_STATUS_SIGNALRAISED, 1), (PROC_STATUS_SUCCESS, 'blah, 2, 0'),