Opened 8 years ago

Closed 6 years ago

#3835 enhancement closed fixed (fixed)

The producer/consumer howto could really do with some examples

Reported by: Itamar Turner-Trauring Owned by: Thijs Triemstra
Priority: normal Milestone:
Component: core Keywords: documentation
Cc: Thijs Triemstra, ruttbe Branch: branches/streaming-example-3835
branch-diff, diff-cov, branch-cov, buildbot
Author: ruttbe, thijs

Description

The current version of the producer/consumer howto is more of a reference. Some examples involving transports would make it easier to assimilate. It's a bit problematic though since transports are both most common consumers and most common source of data for producers, which might be confusing. But the examples should at least show some transport integration.

Change History (17)

comment:1 Changed 8 years ago by Thijs Triemstra

Cc: Thijs Triemstra added

comment:2 Changed 8 years ago by Glyph

Owner: changed from Glyph to Thijs Triemstra

comment:3 Changed 8 years ago by Thijs Triemstra

#4171 was a duplicate of this and contains an example.

comment:4 Changed 8 years ago by Thijs Triemstra

Author: thijs
Branch: branches/streaming-example-3835

(In [28001]) Branching to 'streaming-example-3835'

comment:5 Changed 8 years ago by Thijs Triemstra

Author: thijsruttbe, thijs
Cc: ruttbe added
Status: newassigned

comment:6 Changed 8 years ago by Thijs Triemstra

(In [28002]) Add streaming.py example, refs #3835, #4171

comment:7 Changed 7 years ago by Thijs Triemstra

(In [30518]) apply coding standard, add to examples listing and news file. refs #3835

comment:8 Changed 7 years ago by Thijs Triemstra

Keywords: review added
Owner: Thijs Triemstra deleted
Status: assignednew

comment:9 Changed 7 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Thijs Triemstra
  1. cnt is a silly variable name. Please switch to count.
  2. There's lots of extra parenthesis where print is used.
  3. The example doesn't actually require Python 2.6, it works fine on 2.4. The last sentence of the docstring can probably just go.
  4. random.randrange is preferred over random.randint
  5. ServeRandom should use sendLine instead of transport.write in connectionMade
  6. The pauseProducing docstring is nice. How about some for the other methods?
  7. stopProducing should cause the resumeProducing loop to stop, too.
  8. The vertical whitespace needs some cleanup.
  9. The producer/consumer howto should link to this example.

Thanks!

comment:10 Changed 7 years ago by Thijs Triemstra

Status: newassigned

comment:11 Changed 7 years ago by Thijs Triemstra

(In [30760]) address review comments, refs #3835

comment:12 in reply to:  9 Changed 7 years ago by Thijs Triemstra

Keywords: review added
Owner: Thijs Triemstra deleted
Status: assignednew

Up for 500 points.. :)

comment:13 Changed 7 years ago by Tristan Seligmann

Keywords: review removed
Owner: set to Thijs Triemstra

This example only implements a push producer, which is somewhat different from a pull producer. I think the various references to "example of a producer" (or similar wording) should explicitly mention that this is a push producer, to avoid confusion.

Aside from that, everything else looks good; please go ahead and merge once that issue is dealt with.

comment:14 Changed 6 years ago by Thijs Triemstra

Status: newassigned

comment:15 Changed 6 years ago by Thijs Triemstra

(In [31631]) add references to push producer, refs #3835

comment:16 Changed 6 years ago by Thijs Triemstra

(In [31632]) reference push producer, refs #3835

comment:17 Changed 6 years ago by Thijs Triemstra

Resolution: fixed
Status: assignedclosed

(In [31633]) Added sample implementation of a Twisted push producer/consumer system.

Author: ruttbe, thijs Reviewer: exarkun, mithrandi Fixes: #3835

Note: See TracTickets for help on using tickets.