Currently twistd converts some options into objects (app.ApplicationRunner et. al., and some options into a series of function calls (runReactorWithLogging, fixPdb, runWithProfiler, etc).
Before twistd does anything with the arguments that it's given, it should convert all of them into a set of introspectable, structured objects, which can be manipulated.
This would be helpful in two areas: testing and configurability by tac files and plugins. Testing would be easier because these objects could be mocked out, to ensure that their methods are called with the correct values in the correct order. Post-hoc or programmatic configuration would be easier because there could be defined points in the execution of the various options where certain objects could be mutated by user code. This could simplify tickets such as #638.
This might change in the course of implementation, but I believe the tasks that should be represented by objects here includes:
- daemonization
- logging
- IServiceMaker location
- reactor selection
- privilege management (uid, gid, euid, chroot?)
- persistence
- profiling
- process naming
Some or all of these things should also be integrated into the service hierarchy, but I leave it as an exercise to the implementor as to how. Depending on the amount of code that will have to be written to do this it may be wise to split it into multiple tickets.