From 7f88e0cc5c4b70149b70341e7e998cbc1e4fedf8 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Fri, 4 Nov 2022 20:04:10 +0100 Subject: [PATCH] Run in the same process if there is only package Debugging is much easier without Process Pool --- git-importer.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/git-importer.py b/git-importer.py index 2948efb..6394d4f 100755 --- a/git-importer.py +++ b/git-importer.py @@ -113,14 +113,17 @@ def main(): importer = Importer(URL_OBS, "openSUSE:Factory", args.packages) importer.import_into_db() - with concurrent.futures.ProcessPoolExecutor(max_workers=8) as executor: - fs = [ - executor.submit( - export_package, package, args.repodir, args.cachedir, args.gc - ) - for package in args.packages - ] - concurrent.futures.wait(fs) + if len(args.packages) != 1: + with concurrent.futures.ProcessPoolExecutor(max_workers=8) as executor: + fs = [ + executor.submit( + export_package, package, args.repodir, args.cachedir, args.gc + ) + for package in args.packages + ] + concurrent.futures.wait(fs) + else: + export_package(args.packages[0], args.repodir, args.cachedir, args.gc) if __name__ == "__main__":