Ticket #1922 enhancement closed fixed

Opened 7 years ago

Last modified 7 years ago

make twistd pluggable, nerf mktap

Reported by: tjs Owned by:
Priority: highest Milestone:
Component: core Keywords:
Cc: jerub, spiv, itamarst, exarkun, ralphm, jml Branch:
Author: Launchpad Bug:

Description (last modified by radix) (diff)

twistd <subcommand> should work, and use <subcommand> in a way very similar to how mktap uses it, the difference being that twistd will run the service immediately instead of saving it to a file.

Suggested usage:

$ twistd -n web --path .
<startup messages>
$ twistd web --path .
# forks and daemonizes.

Change History

1

Changed 7 years ago by spiv

  • cc spiv added

2

Changed 7 years ago by itamarst

  • cc itamarst added

Writing out .tac files is perhaps worth doing, but I don't think it should be a suggested deployment mechanism. See #1490 for my proposal.

3

Changed 7 years ago by exarkun

  • cc exarkun added

minus one trillion to writing out tac files.

4

Changed 7 years ago by radix

  • owner changed from tjs to radix
  • status changed from new to assigned
  • description modified (diff)

Indeed minus one trillion to writing out tac files. I'm changing the description to leave that bit out. I'm also removing the stuff about not writing a tistd.log or .pid. I've started working on a branch (twistd-plugins-1922) to implement the remaining features.

5

Changed 7 years ago by radix

  • keywords review added
  • owner radix deleted
  • status changed from assigned to new
  • priority changed from normal to highest

Ok I think maybe this is ready for review in twistd-plugins-1922.

6

Changed 7 years ago by radix

  • description modified (diff)

7

Changed 7 years ago by ralphm

  • owner set to ralphm
  • cc ralphm added
  • status changed from new to assigned

8

Changed 7 years ago by exarkun

  • owner changed from ralphm to radix
  • status changed from assigned to new
  • keywords review removed

This needs to add some new unit tests for the new behavior.

I suggest at least these two tests:

  • One which grabs subCommands directly and asserts that subcommands for a set of test plugins are provided. The test plugins can live in a test directory, and you can parameterize the package to look plugins up in on the ServerOptions class.
  • One which calls twisted.scripts.twistd.getApplication directly with various configurations and asserts something about the returned Application

9

Changed 7 years ago by exarkun

Oops. I completely missed the added test_twistd.py.

Revised comments:

  • use file instead of open
  • don't delete the tap file in tearDown
  • I'd still like to see a test that actually results in getPlugins being called, but the tests here are pretty decent, so I guess that's optional.
  • add test-case-name to scripts/twistd.py

Merge when done

10

Changed 7 years ago by radix

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

(In [17926]) Merge twistd-plugins-1922

Author: radix Reviewer: exarkun Fixes #1922

The first step towards a mktapless world.

"Oh, ye so fiercely tended,

Ye little seeds of hate!

I bent above your growing

Early and noon and late,

Yet are ye drooped and pitiful,--

I cannot rear ye straight!"

twistd now can accept subcommands equivalent to mktap's; it will look up the IServiceMaker plugin for the given subcommand and use it in precisely the same way that mktap does, except that it immediately applies the service to an Application and starts it.

That is to say,

"twistd web --path ."

11

Changed 7 years ago by radix

(In [17959]) Revert r17926 - doesn't work on Windows (Fuck Yes I Said It) Refs #1922

12

Changed 7 years ago by radix

(In [17962]) Reviving dead branch twistd-plugins-1922 Refs #1922

13

Changed 7 years ago by radix

  • status changed from closed to reopened
  • resolution fixed deleted

14

Changed 7 years ago by radix

(In [17965]) *really* revive twistd-plugins-1922 Refs #1922

15

Changed 7 years ago by jml

  • cc jml added

16

Changed 7 years ago by radix

  • keywords review added

I think this is ready for review again. It probably works on Windows now, as I've now got unit tests that test the code there, but I haven't tested it interactively.

17

Changed 7 years ago by radix

ahem, and the branch is twistd-plugins-1922-2.

18

Changed 7 years ago by exarkun

  • status changed from reopened to new
  • keywords review removed

ApplicationRunner.createOrGetApplication should comment its usage of loadedPlugins, describing how iterating over subCommands initializes and populates it.

UnixApplicationRunner and its methods should have docstrings.

Any reason not to make setupEnvironment, startApplication, and startLogging (private) methods the Runner classes?

Nothing tests that preApplication and postApplication are ever called or are called in the right order with respect to makeService.

Itamar thinks there should be a subprocess test for twistd (but I think it'd be terrible).

Seems to basically work on Windows.

19

Changed 7 years ago by radix

  • status changed from new to assigned

The private functions in _twistd_unix: I'm not changing their API because certain third parties have decided to rely on them. When a more concerted effort is made to refactor twistd to have a decent internal design, then it will be more worthwhile to break those APIs.

Thanks for the review, I'm working on the other issues.

20

Changed 7 years ago by radix

  • keywords review added
  • owner changed from radix to exarkun
  • status changed from assigned to new

Ok I've done everything you required in your review.

21

Changed 7 years ago by radix

  • status changed from new to assigned
  • keywords review removed
  • owner changed from exarkun to radix

exarkun gives +1:

[17:01] exarkun radix: you don't know how to spell privileges
...
[17:03] exarkun fix that and then I guess merge

22

Changed 7 years ago by radix

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

(In [17992]) Merge twistd-plugins-1922-3

Author: radix Reviewer: exarkun Fixes #1922

The first step towards a mktapless world: take three.

"Oh, ye so fiercely tended,

Ye little seeds of hate!

I bent above your growing

Early and noon and late,

Yet are ye drooped and pitiful,--

I cannot rear ye straight!"

twistd now can accept subcommands equivalent to mktap's; it will look up the IServiceMaker plugin for the given subcommand and use it in precisely the same way that mktap does, except that it immediately applies the service to an Application and starts it.

That is to say,

"twistd web --path ."

23

Changed 2 years ago by <automation>

  • owner radix deleted
Note: See TracTickets for help on using tickets.