From: A. Jesse Jiryu Davis Date: Wed, 15 Apr 2015 01:29:23 +0000 (-0400) Subject: Remove redundant description of web-spider demo. X-Git-Tag: v4.2.0b1~29^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aed1fc456787070c1445da11a649d66ba460c240;p=thirdparty%2Ftornado.git Remove redundant description of web-spider demo. --- diff --git a/demos/webspider/webspider.py b/demos/webspider/webspider.py index 97cdd62dd..34fbdb504 100644 --- a/demos/webspider/webspider.py +++ b/demos/webspider/webspider.py @@ -1,16 +1,3 @@ -"""A trivial web-spider that crawls all the pages in http://tornadoweb.org. - -``spider()`` downloads the page at `base_url` and any pages it links to, -recursively. It ignores pages that are not beneath `base_url` hierarchically. - -This function demonstrates `queues.Queue`, especially its methods -`~queues.Queue.join` and `~queues.Queue.task_done`. -The queue begins containing only -`base_url`, and each discovered URL is added to it. We wait for -`~queues.Queue.join` to complete before exiting. This ensures that -the function as a whole ends when all URLs have been downloaded. -""" - # start-file import HTMLParser import time diff --git a/docs/guide/queues.rst b/docs/guide/queues.rst index a4bf97c5e..12726f486 100644 --- a/docs/guide/queues.rst +++ b/docs/guide/queues.rst @@ -14,12 +14,13 @@ until there is room for another item. A `~Queue` maintains a count of unfinished tasks, which begins at zero. `~Queue.put` increments the count; `~Queue.task_done` decrements it. -In the web-spider example here, when a worker fetches a page it parses the -links and puts new ones in the queue, then calls `~Queue.task_done` to -decrement the counter once. Eventually, a worker fetches a page whose URLs have -all been seen before, and there is also no work left in the queue. Thus that -worker's call to `~Queue.task_done` decrements the counter to zero. The main -coroutine, which is waiting for `~Queue.join`, is unpaused and finishes. +In the web-spider example here, the queue begins containing only base_url. When +a worker fetches a page it parses the links and puts new ones in the queue, +then calls `~Queue.task_done` to decrement the counter once. Eventually, a +worker fetches a page whose URLs have all been seen before, and there is also +no work left in the queue. Thus that worker's call to `~Queue.task_done` +decrements the counter to zero. The main coroutine, which is waiting for +`~Queue.join`, is unpaused and finishes. .. literalinclude:: ../../demos/webspider/webspider.py :start-after: # start-file