summaryrefslogtreecommitdiff
path: root/crocoite/cli.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-09-25 16:37:21 +0200
committerLars-Dominik Braun <lars@6xq.net>2018-09-25 17:01:26 +0200
commitdcf48e1eb4f61fde83e525ddfe0850efbf1d79bd (patch)
tree207c47dbd9d09c97b254411723ee12fc4c4a1680 /crocoite/cli.py
parent2ef2ed8202bd5249cda78f135d64f5add9a461ea (diff)
downloadcrocoite-dcf48e1eb4f61fde83e525ddfe0850efbf1d79bd.tar.gz
crocoite-dcf48e1eb4f61fde83e525ddfe0850efbf1d79bd.tar.bz2
crocoite-dcf48e1eb4f61fde83e525ddfe0850efbf1d79bd.zip
Parallelize recursive grabs
❤️ asyncio.
Diffstat (limited to 'crocoite/cli.py')
-rw-r--r--crocoite/cli.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/crocoite/cli.py b/crocoite/cli.py
index 6167249..3f5904c 100644
--- a/crocoite/cli.py
+++ b/crocoite/cli.py
@@ -85,6 +85,7 @@ def recursive ():
parser.add_argument('--policy', help='Recursion policy', metavar='POLICY')
parser.add_argument('--tempdir', help='Directory for temporary files', metavar='DIR')
parser.add_argument('--prefix', help='Output filename prefix, supports templates {host} and {date}', metavar='FILENAME', default='{host}-{date}-')
+ parser.add_argument('--concurrency', '-j', help='Run at most N jobs', metavar='N', default=1, type=int)
parser.add_argument('url', help='Seed URL', metavar='URL')
parser.add_argument('output', help='Output directory', metavar='DIR')
parser.add_argument('command', help='Fetch command, supports templates {url} and {dest}', metavar='CMD', nargs='*', default=['crocoite-grab', '{url}', '{dest}'])
@@ -99,7 +100,8 @@ def recursive ():
controller = RecursiveController (url=args.url, output=args.output,
command=args.command, logger=logger, policy=policy,
- tempdir=args.tempdir, prefix=args.prefix)
+ tempdir=args.tempdir, prefix=args.prefix,
+ concurrency=args.concurrency)
loop = asyncio.get_event_loop()
loop.run_until_complete(controller.run ())