From: Ondrej Mosnacek <omosnace@redhat.com>
To: selinux@vger.kernel.org
Subject: [PATCH userspace v2] sepolicy: generate man pages in parallel
Date: Fri, 18 Oct 2019 11:20:05 +0200 [thread overview]
Message-ID: <20191018092005.3198-1-omosnace@redhat.com> (raw)
Generating man pages takes a lot of time. Do it in parallel to speed up
the process.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
python/sepolicy/sepolicy.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
Changes in v2:
- use multiprocessing.Pool, which reacts better to interruption
diff --git a/python/sepolicy/sepolicy.py b/python/sepolicy/sepolicy.py
index 1934cd86..7b223065 100755
--- a/python/sepolicy/sepolicy.py
+++ b/python/sepolicy/sepolicy.py
@@ -25,6 +25,7 @@ import os
import sys
import selinux
import sepolicy
+from multiprocessing import Pool
from sepolicy import get_os_version, get_conditionals, get_conditionals_format_text
import argparse
PROGNAME = "policycoreutils"
@@ -326,8 +327,13 @@ def gen_gui_args(parser):
gui.set_defaults(func=gui_run)
+def manpage_work(domain, path, root, source_files, web):
+ from sepolicy.manpage import ManPage
+ m = ManPage(domain, path, root, source_files, web)
+ print(m.get_man_page_path())
+
def manpage(args):
- from sepolicy.manpage import ManPage, HTMLManPages, manpage_domains, manpage_roles, gen_domains
+ from sepolicy.manpage import HTMLManPages, manpage_domains, manpage_roles, gen_domains
path = args.path
if not args.policy and args.root != "/":
@@ -340,9 +346,11 @@ def manpage(args):
else:
test_domains = args.domain
+ p = Pool()
for domain in test_domains:
- m = ManPage(domain, path, args.root, args.source_files, args.web)
- print(m.get_man_page_path())
+ p.apply_async(manpage_work, [domain, path, args.root, args.source_files, args.web])
+ p.close()
+ p.join()
if args.web:
HTMLManPages(manpage_roles, manpage_domains, path, args.os)
--
2.21.0
next reply other threads:[~2019-10-18 9:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 9:20 Ondrej Mosnacek [this message]
2019-10-22 12:25 ` [PATCH userspace v2] sepolicy: generate man pages in parallel Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191018092005.3198-1-omosnace@redhat.com \
--to=omosnace@redhat.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).