Ticket #3835 enhancement closed fixed

Opened 4 years ago

Last modified 2 years ago

The producer/consumer howto could really do with some examples

Reported by: itamar Owned by: thijs
Priority: normal Milestone:
Component: core Keywords: documentation
Cc: thijs, ruttbe Branch: branches/streaming-example-3835
Author: ruttbe, thijs Launchpad Bug:

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

1

  Changed 4 years ago by thijs

  • cc thijs added

2

  Changed 4 years ago by glyph

  • owner changed from glyph to thijs

3

  Changed 3 years ago by thijs

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

4

  Changed 3 years ago by thijs

  • branch set to branches/streaming-example-3835
  • branch_author set to thijs

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

5

  Changed 3 years ago by thijs

  • status changed from new to assigned
  • cc ruttbe added
  • branch_author changed from thijs to ruttbe, thijs

6

  Changed 3 years ago by thijs

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

7

  Changed 2 years ago by thijs

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

8

  Changed 2 years ago by thijs

  • owner thijs deleted
  • status changed from assigned to new
  • keywords documentation, review added; documentation removed

9

follow-up: ↓ 12   Changed 2 years ago by exarkun

  • owner set to thijs
  • keywords documentation added; documentation, review removed
  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!

10

  Changed 2 years ago by thijs

  • status changed from new to assigned

11

  Changed 2 years ago by thijs

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

12

in reply to: ↑ 9   Changed 2 years ago by thijs

  • keywords documentation, review added; documentation removed
  • owner thijs deleted
  • status changed from assigned to new

Up for 500 points.. :)

13

  Changed 2 years ago by mithrandi

  • owner set to thijs
  • keywords documentation added; documentation, review removed

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.

14

  Changed 2 years ago by thijs

  • status changed from new to assigned

15

  Changed 2 years ago by thijs

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

16

  Changed 2 years ago by thijs

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

17

  Changed 2 years ago by thijs

  • status changed from assigned to closed
  • resolution set to fixed

(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.