Re: [Twisted-Python] How to restart Twisted service in-process

2017-02-18 Thread Glyph Lefkowitz

> On Feb 2, 2017, at 1:17 AM, Роман Мещеряков  
> wrote:
> 
> Hello everyone! I wrote Twisted-based TCP server which is capable of running 
> in several relatively different modes. When mode switch is needed, I would 
> like the server to restart itself by some means, for it to read new mode from 
> configuration file and create corresponding implementation. Also I wanted the 
> restart to occur without re-running twistd process, because it seems to me 
> more appropriate for Linux daemon.

Hi Roman,

Sorry it took a while to get to this one :).

If your solution is working for you, then it's fine.  You've correctly 
understood the API associated with IServiceCollection and your implementation 
(at least at first glance, I don't have time to test it exhaustively :)) is 
correct.

However, there's a more philosophical question as well: if you really want to 
re-start from scratch, what exactly are you shutting down and starting up 
again?  Wouldn't you want to be able to load new code?  Simply stopping and 
starting objects won't re-initialize the process from the beginning, only from 
some indeterminate middle state where parts of the program are already set up; 
this doesn't have the usual desired effect of a "restart" where potentially 
unknown or buggy state is cleared away.

You may want to consider simply calling execv 
https://docs.python.org/2.7/library/os.html#os.execv 
 with [sys.executable] + 
sys.argv rather than trying to do this in terms of Twisted's APIs.

-glyph

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How to restart Twisted service in-process

2017-02-18 Thread Jean-Paul Calderone
On Sat, Feb 18, 2017 at 2:25 PM, Glyph Lefkowitz 
wrote:

>
> On Feb 2, 2017, at 1:17 AM, Роман Мещеряков 
> wrote:
>
> *Hello everyone! I wrote Twisted-based TCP server which is capable of
> running in several relatively different modes. When mode switch is needed,
> I would like the server to restart itself by some means, for it to read new
> mode from configuration file and create corresponding implementation. Also
> I wanted the restart to occur without re-running twistd process, because it
> seems to me more appropriate for Linux daemon.*
>
>
> Hi Roman,
>
> Sorry it took a while to get to this one :).
>
> If your solution is working for you, then it's fine.  You've correctly
> understood the API associated with IServiceCollection and your
> implementation (at least at first glance, I don't have time to test it
> exhaustively :)) is correct.
>
> However, there's a more philosophical question as well: if you really want
> to *re-start* from scratch, what exactly are you shutting down and
> starting up again?  Wouldn't you want to be able to load new code?  Simply
> stopping and starting objects won't re-initialize the process from the
> beginning, only from some indeterminate middle state where parts of the
> program are already set up; this doesn't have the usual desired effect of a
> "restart" where potentially unknown or buggy state is cleared away.
>
> You may want to consider simply calling execv https://docs.python.org/
> 2.7/library/os.html#os.execv with [sys.executable] + sys.argv rather than
> trying to do this in terms of Twisted's APIs.
>

Or better yet.  Don't be afraid to just exit.  Your process is being
managed by a supervisor with a rich feature set - like easily controlled
re-restart behavior, right (If not, what do you do when your daemon simply
*crashes*)?

Jean-Paul
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How to restart Twisted service in-process

2017-02-18 Thread Glyph Lefkowitz

> On Feb 18, 2017, at 3:19 PM, Jean-Paul Calderone  
> wrote:
> 
>  (If not, what do you do when your daemon simply crashes)?


Twisted programs can crash!??!

-g___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How to restart Twisted service in-process

2017-02-18 Thread Jean-Paul Calderone
On Sat, Feb 18, 2017 at 6:32 PM, Glyph Lefkowitz 
wrote:

>
> On Feb 18, 2017, at 3:19 PM, Jean-Paul Calderone <
> exar...@twistedmatrix.com> wrote:
>
>  (If not, what do you do when your daemon simply *crashes*)?
>
>
>
> Twisted programs can crash!??!
>

The Linux OOM killer is pretty crazy, man.

Jean-Paul


>
> -g
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] (Potential) Twisted sprint in San Francisco - anyone want to help organize?

2017-02-18 Thread Glyph Lefkowitz
Hi all,

For those of you that live in the SF bay area, the SF Python Meetup is holding 
a sprint in almost exactly one month from today: 
https://www.meetup.com/sfpython/events/234926664/ 


Personally, I'm a bit tapped out at the moment in terms of spare time and 
brainpower to help organize things, but I do hope some enterprising member of 
the project can pick this up and help us have a great sprint there.  I can 
probably show up and write some code :-).

-glyph___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Weekly Bug Summary

2017-02-18 Thread trac



Bug summary
__
Summary for 2017-02-12 through 2017-02-19
  Opened Closed  Total Change
Enhancements:  5  2   1341 +3
Defects:   5  5881 +0
Tasks: 1  0 98 +1
Regressions:   0  1  7 -1
Total:11  8   2328 +3

|== Type Changes   |== Priority Changes   |== Component Changes 
|Defect:   +0  |High:+1   |Conch:   -1  
|Enhancement:  +3  |Normal:  +2   |Core:+1  
|Release Blocker: Regression:  -1  |Low: +1   |Pair:+1  
|Task: +1  |Lowest:  -1   |Release Management:  +0  
  |Trial:   +2  
  |Twist:   +1  
  |Website: -1  



Total Tickets
Open Tickets



New / Reopened Bugs
__
= High =
[#9034] Unable to run trial tests (PEP 302 violation) (opened by cas--)
defect  trial  http://twistedmatrix.com/trac/ticket/9034

= Normal =
[#9035] remove trial's support for accepting directory or file names to specify tests to run (opened by exarkun)
enhancement trial  http://twistedmatrix.com/trac/ticket/9035

[#9036] deprecate trial's support for accepting directory or file names to specify tests to run (opened by exarkun)
enhancement trial  http://twistedmatrix.com/trac/ticket/9036

[#9037] IPHeader has version and ipheaderlen wrong (opened by nlitsme)
defect  pair   http://twistedmatrix.com/trac/ticket/9037

[#9038] More cleanup for twisted.application.runner (opened by wsanchez)
enhancement twist  http://twistedmatrix.com/trac/ticket/9038

[#9039] inlineCallbacks adds a callback without return value (opened by meilof) (CLOSED, wontfix)
defect  core   http://twistedmatrix.com/trac/ticket/9039

[#9040] consistently use .tox directory for tox temporary artifacts (opened by glyph)
taskcore   http://twistedmatrix.com/trac/ticket/9040

[#9041] dubious haproxy endpoint wrapping ssl example (opened by pjenvey)
defect  core   http://twistedmatrix.com/trac/ticket/9041

[#9042] Add treq to Twisted CI (opened by exarkun)
enhancement release management http://twistedmatrix.com/trac/ticket/9042

[#9043] twist web's access logging is... unusual (opened by alex)
enhancement core   http://twistedmatrix.com/trac/ticket/9043

= Low =
[#9033] twistd portforward plugin default is not a valid strport, and argument help indicates integers and not ports (opened by philmayers)
defect  core   http://twistedmatrix.com/trac/ticket/9033



Closed Bugs
__
= Normal =
[#8972] `trial ...` and `python -m twisted.trial ...` result in significantly divergent `sys.path` values (opened by exarkun, closed by Julian, wontfix)
defect  trial  http://twistedmatrix.com/trac/ticket/8972

[#9014] txchecker is incorrectly checking variable names in keydata.py (opened by the0id, closed by glyph, invalid)
defect  release management http://twistedmatrix.com/trac/ticket/9014

[#8995] cannot convert 'DelayedCall' object to bytes on PY3 (opened by rodrigc, closed by Craig Rodrigues , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/8995

[#8979] Github Login does not work on Firefox (opened by cdunklau, closed by cdunklau, worksforme)
defect  websitehttp://twistedmatrix.com/trac/ticket/8979

[#9039] inlineCallbacks adds a callback without return value (opened by meilof, closed by glyph, wontfix)
defect  core   http://twistedmatrix.com/trac/ticket/9039

[#8912] The code for receiving UNIX socket doesn't check the ancillary data is of the appropriate type. (opened by tomprince, closed by Glyph , fixed)
defect  core   http://twistedmatrix.com/trac/ticket/8912

[#9031] twisted.conch.manhole sometimes exits with an unhandled TypeError (opened by exarkun, closed by Glyph , fixed)
release blocker: regression conch  http://twistedmatrix.com/trac/ticket/9031

= Lowest =
[#9027] callInThread and callFromThread links are broken on howto/logger and howto/threading doc pages (opened by jisaacstone, closed by Glyph , fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/9027



Ticket Lifetime Stats
__
Oldest open ticket - [#50] conch command-line client doesn't work in win32 (since 2003-07-12 14:41:06).
Newest open ticket - [#9043] tw