diff --git a/docs/index.rst b/docs/index.rst index 8e50605..e569670 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,7 +8,6 @@ and it allows to build a static gallery of images with the following features: * process directories recursively, * generate HTML pages using jinja2 templates, * relative links for a portable output, -* parallel processing, * MIT licensed. The idea behind Sigal is to ease the use of the javascript librairies like @@ -118,9 +117,6 @@ Optional arguments: ``-t THEME, --theme THEME`` Specify a theme directory, or a theme name for the themes included with Sigal -``-n NCPU, --ncpu NCPU`` - Number of cpu for parallel execution (default: 1) - Configuration ------------- diff --git a/sigal/__init__.py b/sigal/__init__.py index 72bb32f..ab91197 100644 --- a/sigal/__init__.py +++ b/sigal/__init__.py @@ -86,9 +86,8 @@ def init(): "the current working directory)") @arg('-t', '--theme', help="Specify a theme directory, or a theme name for " "the themes included with Sigal") -@arg('-n', '--ncpu', help="Number of cpu for parallel execution (default: 1)") def build(input_dir, output_dir, debug=False, verbose=False, force=False, - config=None, theme=None, ncpu=1): + config=None, theme=None): """Run sigal to process a directory. """ level = (debug and logging.DEBUG) or (verbose and logging.INFO) \ @@ -112,8 +111,7 @@ def build(input_dir, output_dir, debug=False, verbose=False, force=False, sys.exit(1) settings = read_settings(settings_file) - gal = Gallery(settings, input_dir, output_dir, force=force, theme=theme, - ncpu=ncpu) + gal = Gallery(settings, input_dir, output_dir, force=force, theme=theme) gal.build() diff --git a/sigal/gallery.py b/sigal/gallery.py index 2c8da59..842cd3e 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -30,7 +30,6 @@ import shutil import sys from clint.textui import progress, colored -from multiprocessing import Pool from os.path import join from PIL import Image as PILImage @@ -144,10 +143,9 @@ class Gallery(object): "Prepare images" def __init__(self, settings, input_dir, output_dir, force=False, - theme=None, ncpu=1): + theme=None): self.settings = settings self.force = force - self.ncpu = ncpu self.input_dir = os.path.abspath(input_dir) self.output_dir = os.path.abspath(output_dir) self.logger = logging.getLogger(__name__) @@ -205,8 +203,6 @@ class Gallery(object): self.logger.info(":: Processing '%s' [%i images]", colored.green(dirname), len(imglist)) - pool = Pool(processes=self.ncpu) - try: # loop on images for f in img_iterator: @@ -217,23 +213,12 @@ class Gallery(object): self.logger.info("%s exists - skipping", filename) else: self.logger.info(filename) - pool.apply_async(worker_image, - (f, outpath, self.settings)).get(9999) + process_image(f, outpath, self.settings) - pool.close() - pool.join() except KeyboardInterrupt: - pool.terminate() sys.exit('Interrupted') -def worker_image(*args): - try: - return process_image(*args) - except KeyboardInterrupt: - return 'KeyboardException' - - def process_image(filepath, outpath, settings): """Process one image: resize, create thumbnail."""