[lorax][PATCH] Run compressions in multiple threads

Chris Lumens clumens at redhat.com
Wed Nov 13 15:26:11 UTC 2013


> diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py
> index 94dda5a..608607a 100644
> --- a/src/pylorax/imgutils.py
> +++ b/src/pylorax/imgutils.py
> @@ -25,6 +25,7 @@ from os.path import join, dirname
>  from subprocess import CalledProcessError
>  import sys
>  import traceback
> +import multiprocessing
>  from time import sleep
>  
>  from pylorax.sysutils import cpfile
> @@ -44,6 +45,13 @@ def mkcpio(rootdir, outfile, compression="xz", compressargs=["-9"]):
>      if compression is None:
>          compression = "cat" # this is a little silly
>          compressargs = []
> +
> +    # make compression run with multiple threads if possible
> +    if compression in ("xz", "lzma"):
> +        compressargs.insert(0, "-T%d" % multiprocessing.cpu_count())
> +    if compression == "gzip":

Besides making this an "elif", ACK.

- Chris


More information about the anaconda-patches mailing list