Stopping PEAK application on SIGINT
Alexey Smishlayev <[email protected]> Tue, 29 Sep 2015 15:06:03 +0300
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============0535156857==
Content-Type: multipart/alternative;
boundary="------------060705030204020308050800"
This is a multi-part message in MIME format.
--------------060705030204020308050800
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Good day everyone!
I would like my PEAK application to stop on ^C or SIGINT. Currently, in
that case I get an output something like
> 29.09.2015 14:56:48.179 [DEBUG] Connect.twisted Unexpected error in
main loop.
> 29.09.2015 14:56:48.190 [ERROR] Connect.twisted Traceback (most
recent call last):
> 29.09.2015 14:56:48.190 [ERROR] File
"/Users/alexey/xtech2/tester/build/lib/ank/BBS/CommandBase.py", line 38,
in run
> 29.09.2015 14:56:48.190 [ERROR] self.mainLoop.run()
> 29.09.2015 14:56:48.190 [ERROR] File
"/Library/Python/2.7/site-packages/peak/running/scheduler.py", line 78,
in run
> 29.09.2015 14:56:48.190 [ERROR] return
self.eventLoop.runUntil(self.exitCode,True,idle=self.sleep)[0]
> 29.09.2015 14:56:48.190 [ERROR] File
"/Library/Python/2.7/site-packages/peak/events/twisted_support.py", line
186, in runUntil
> 29.09.2015 14:56:48.190 [ERROR] self.reactor.run(False)
> 29.09.2015 14:56:48.190 [ERROR] File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/base.py",
line 1192, in run
> 29.09.2015 14:56:48.190 [ERROR] self.mainLoop()
> 29.09.2015 14:56:48.190 [ERROR] --- <exception caught here> ---
> 29.09.2015 14:56:48.190 [ERROR] File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/base.py",
line 1204, in mainLoop
> 29.09.2015 14:56:48.190 [ERROR] self.doIteration(t)
> 29.09.2015 14:56:48.190 [ERROR] File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/selectreactor.py",
line 105, in doSelect
> 29.09.2015 14:56:48.190 [ERROR] [], timeout)
> 29.09.2015 14:56:48.190 [ERROR] exceptions.KeyboardInterrupt:
in the log file. In CommandBase.py attribute self.mainloop is defined as
> from peak.api import binding
> from peak.running import commands, interfaces
> class CommandBase(commands.EventDriven):
> mainLoop = binding.Obtain(interfaces.IMainLoop)
> ...
If I set "peak.running.mainLoop.stopOnSignals" in my project's .ini file
to anything else except empty tuple, on the application's startup I get
the following error (I tried "stopOnSignals = ('SIGINT',)")
> Traceback (most recent call last):
> File "../ank/BBS/Assembler.py", line 370, in run
> _exitCode = _root.run()
> File "/Library/Python/2.7/site-packages/peak/running/commands.py",
line 229, in run
> return self._run() or 0
> File "/Library/Python/2.7/site-packages/peak/running/commands.py",
line 509, in _run
> return self.invoke()
> File
"/Users/alexey/xtech2/tester/build/lib/ank/BBS/CommandBase.py", line 38,
in run
> self.mainLoop.run()
> File "/Library/Python/2.7/site-packages/peak/running/scheduler.py",
line 66, in run
> handler = self.eventLoop.signals(*self.stopOnSignals)
> File "_once.pyx", line 112, in _once.BaseDescriptor.__get__
> File "_once.pyx", line 100, in _once.__get__
> File
"/Library/Python/2.7/site-packages/peak/binding/components.py", line
682, in delegate
> return getattr(getattr(s,delegateAttr),a)
> File "_once.pyx", line 112, in _once.BaseDescriptor.__get__
> File "_once.pyx", line 100, in _once.__get__
> File
"/Library/Python/2.7/site-packages/peak/binding/components.py", line
682, in delegate
> return getattr(getattr(s,delegateAttr),a)
> File "_once.pyx", line 88, in _once.BaseDescriptor.__get__
> AttributeError: ('Recursive attempt to compute attribute', 'signals')
How do I do everything correctly?
Best regards,
Alexey Smishlayev
--------------060705030204020308050800
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
Good day everyone!<br>
I would like my PEAK application to stop on ^C or SIGINT. Currently,
in that case I get an output something like<br>
<br>
> 29.09.2015 14:56:48.179 [DEBUG] Connect.twisted Unexpected
error in main loop.<br>
> 29.09.2015 14:56:48.190 [ERROR] Connect.twisted Traceback (most
recent call last):<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0 File
"/Users/alexey/xtech2/tester/build/lib/ank/BBS/CommandBase.py", line
38, in run<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0=C2=A0=C2=A0 self.mai=
nLoop.run()<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0 File
"/Library/Python/2.7/site-packages/peak/running/scheduler.py", line
78, in run<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0=C2=A0=C2=A0 return
self.eventLoop.runUntil(self.exitCode,True,idle=3Dself.sleep)[0]<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0 File
"/Library/Python/2.7/site-packages/peak/events/twisted_support.py",
line 186, in runUntil<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0=C2=A0=C2=A0 self.rea=
ctor.run(False)<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0 File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/=
python/twisted/internet/base.py",
line 1192, in run<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0=C2=A0=C2=A0 self.mai=
nLoop()<br>
> 29.09.2015 14:56:48.190 [ERROR] --- <exception caught
here> ---<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0 File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/=
python/twisted/internet/base.py",
line 1204, in mainLoop<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0=C2=A0=C2=A0 self.doI=
teration(t)<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0 File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/=
python/twisted/internet/selectreactor.py",
line 105, in doSelect<br>
> 29.09.2015 14:56:48.190 [ERROR]=C2=A0=C2=A0=C2=A0=C2=A0 [], time=
out)<br>
> 29.09.2015 14:56:48.190 [ERROR] exceptions.KeyboardInterrupt:<br=
>
<br>
in the log file. In CommandBase.py attribute self.mainloop is
defined as <br>
<br>
> from peak.api import binding<br>
> from peak.running import commands, interfaces<br>
> class CommandBase(commands.EventDriven):<br>
>=C2=A0 =C2=A0=C2=A0 mainLoop =3D binding.Obtain(interfaces.IMainL=
oop)
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
<br>
>=C2=A0=C2=A0=C2=A0=C2=A0 ...<br>
<br>
If I set "peak.running.mainLoop.stopOnSignals" in my project's .ini
file to anything else except empty tuple, on the application's
startup I get the following error (I tried "stopOnSignals =3D
('SIGINT',)")<br>
<br>
> Traceback (most recent call last):<br>
> =C2=A0 File "../ank/BBS/Assembler.py", line 370, in run<br>
> =C2=A0=C2=A0=C2=A0 _exitCode =3D _root.run()<br>
> =C2=A0 File
"/Library/Python/2.7/site-packages/peak/running/commands.py", line
229, in run<br>
> =C2=A0=C2=A0=C2=A0 return self._run() or 0<br>
> =C2=A0 File
"/Library/Python/2.7/site-packages/peak/running/commands.py", line
509, in _run<br>
> =C2=A0=C2=A0=C2=A0 return self.invoke()<br>
> =C2=A0 File
"/Users/alexey/xtech2/tester/build/lib/ank/BBS/CommandBase.py", line
38, in run<br>
> =C2=A0=C2=A0=C2=A0 self.mainLoop.run()<br>
> =C2=A0 File
"/Library/Python/2.7/site-packages/peak/running/scheduler.py", line
66, in run<br>
> =C2=A0=C2=A0=C2=A0 handler =3D self.eventLoop.signals(*self.stop=
OnSignals)<br>
> =C2=A0 File "_once.pyx", line 112, in _once.BaseDescriptor.__get=
__<br>
> =C2=A0 File "_once.pyx", line 100, in _once.__get__<br>
> =C2=A0 File
"/Library/Python/2.7/site-packages/peak/binding/components.py", line
682, in delegate<br>
> =C2=A0=C2=A0=C2=A0 return getattr(getattr(s,delegateAttr),a)<br>
> =C2=A0 File "_once.pyx", line 112, in _once.BaseDescriptor.__get=
__<br>
> =C2=A0 File "_once.pyx", line 100, in _once.__get__<br>
> =C2=A0 File
"/Library/Python/2.7/site-packages/peak/binding/components.py", line
682, in delegate<br>
> =C2=A0=C2=A0=C2=A0 return getattr(getattr(s,delegateAttr),a)<br>
> =C2=A0 File "_once.pyx", line 88, in _once.BaseDescriptor.__get_=
_<br>
> AttributeError: ('Recursive attempt to compute attribute',
'signals')<br>
<br>
How do I do everything correctly?<br>
<br>
<br>
Best regards,<br>
Alexey Smishlayev<br>
</body>
</html>
--------------060705030204020308050800--
--===============0535156857==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
PEAK mailing list
[email protected]
http://www.eby-sarna.com/mailman/listinfo/peak
--===============0535156857==--