diff --git a/CHANGELOG.md b/CHANGELOG.md index 5440788..27dfbee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,2 @@ - BUGFIXES - - Fix missing exit code - - Fix small role issues + - Remove multiprocessing due to bad implementation and resulting performance issues diff --git a/ansiblelater/__init__.py b/ansiblelater/__init__.py index da7a434..bf8ec61 100644 --- a/ansiblelater/__init__.py +++ b/ansiblelater/__init__.py @@ -2,7 +2,7 @@ __author__ = "Robert Kaussow" __project__ = "ansible-later" -__version__ = "0.2.2" +__version__ = "0.2.3" __license__ = "MIT" __maintainer__ = "Robert Kaussow" __email__ = "mail@geeklabor.de" diff --git a/ansiblelater/__main__.py b/ansiblelater/__main__.py index 9f7d41c..cfb7e3d 100755 --- a/ansiblelater/__main__.py +++ b/ansiblelater/__main__.py @@ -2,7 +2,6 @@ """Main program.""" import argparse -import multiprocessing from ansiblelater import LOG from ansiblelater import __version__ @@ -38,9 +37,7 @@ def main(): files = config["rules"]["files"] standards = base.get_standards(config["rules"]["standards"]) - workers = max(multiprocessing.cpu_count() - 2, 2) - p = multiprocessing.Pool(workers) - errors = [] + errors = 0 for filename in files: lines = None candidate = candidates.classify(filename, settings, standards) @@ -55,14 +52,11 @@ def main(): LOG.info("Reviewing %s lines %s" % (candidate, lines)) else: LOG.info("Reviewing all of %s" % candidate) - errors = errors + p.map(candidate.review, [(settings, lines)]) + errors = errors + candidate.review(settings, lines) else: LOG.info("Couldn't classify file %s" % filename) - p.close() - p.join() - - return 0 if sum(errors) == 0 else 1 + return errors if __name__ == "__main__": diff --git a/ansiblelater/command/candidates.py b/ansiblelater/command/candidates.py index 5956382..b3681da 100644 --- a/ansiblelater/command/candidates.py +++ b/ansiblelater/command/candidates.py @@ -102,8 +102,7 @@ class Candidate(object): return target_standards - def review(self, args): - (settings, lines) = args + def review(self, settings, lines=0): errors = 0 for standard in self.standards: