[Twisted-Python] spawnProcess - reapProcess not retrying on failures

Adi Roiban adi at roiban.ro
Fri Sep 5 00:30:35 MDT 2014


On 4 September 2014 12:59,  <exarkun at twistedmatrix.com> wrote:
[snip]
> What would be really nice is if someone collected *all* of the complaints
> about `spawnProcess` into one place and integrated solutions to them into a
> design for a replacement. :)
>
> Jean-Paul

Since I can not create wiki pages here are my notes:

To do:

* Always return a deferred. #2415

* Provide the option to timeout the execution... and on timeout errback with
  a dedicated failure #2415

* Add childs to the same process group #2415

* allways errback when failing to spawn (rather than raising OSError) and
  errback with a different failure when failing to spawn the executable #4184

* on Unix provide a method to install SIGCHLD handler, independent of the
  general reactor.run() signal handlers. ... maybe related to #5710

* Allow passing Unicode environment (at least on Windows) maybe needed
for Python3 #5968

* Allow passing Unicode command and arguments on Windows (current not
supported by pywin32 CreateProcess) #6470... maybe needed for Python3
#5968

* Improve fork/exec for speed and memory usage #5710 .... maybe by creating
  a auxiliary process which handles forks and child management.

* Execute as a different account in Windows

* Spawn only after reactor starts ? I am ok with forking before.

* Support client endpoint?

-------

For a new design:

* I like the ProcessProtocol API

* spawnProcess will always return a deferred... for backward compatibility
  we need to decide a name for this new method which returns a deferred.
  Maybe createProcess or connectProcess

* create spawnUnixProcess which has childFDs uid/gid

* create spawnWindowsProcess which has Windows specific options

* createProcess / connectProcess will call spawnUnixProcess or
spawnWindowsProcess
  depending on current OS

* ProcessProtocol.processEnded is similar to connectionLost..
  so maybe it can be rename it and add other methods so that IProcessProtocol
  can inherit from IProtocol. I guess that this will help with connectors.

------

I think that child management problem, does not affect the public API so I am
not discussing it here.

Timeouts are handled at protocol level and I see that we have 2 timeout types:
total execution time and  timeout after last child data was received.

-----

Does it make sense to put it on wiki or what should be the Twisted
Enhancement Proposal process?

Can I get 'create page' rights on Trac?

Thanks!

-- 
Adi Roiban




More information about the Twisted-Python mailing list