On Saturday, December 24, 2016 at 11:00:33 AM UTC+1, Jeroen Demeyer wrote:
>
> On 2016-12-24 10:37, Jean-Pierre Flori wrote: 
> > My issue is that I can not use the alarm() machinery to trigger it... 
>
> I do not understand why you would want to use alarm() to kill magma. It 
> seems like an instance of the XY problem (http://xyproblem.info/) to me, 
> where X=killing magma and Y=using alarm. 
>
> If Magma has special needs to be interrupted or killed, you need to 
> modify sage/interfaces/magma.py to have things work correctly with magma. 
>
> But maybe I am misunderstanding your explanation. 
>
Let me be more explicit, I want to do something like that:
"""
M = magma() # I only need an ephemeral Magma instance
try: 
    alarm(3600)
    M(...) # potentially very long one shot computation
except AlarmInterrupt:
    M.violently_kill() # I don't care about getting back the Magma prompt
"""
I don't want to use M.interrupt() although it does its job: it tries to 
cleanly interrupt Magma and get back a prompt which can still take a long 
time.
I just want to kill Magma because I don't hae anything valuable in the 
Magma session, I'mm just doing a long computation.
That's easy to code: send to SIGINT's or another signal.
But the issue with using alarm() is that the expect.py will call 
M.interrupt() and I'm stuck...
(On top of that the above code won't end up in the except clause as 
expect.py will raise a Keyboardinterrupt.)

I can setup my own signals/timers but it seems to me that alarm is made for 
my purpose: launch a long computation (or blockinf syscall) and interrupt 
it.
With the current state of the cysignal alarms and expect.py, the only way I 
see to modifythe Magma interface is as follow:tin
* give an option when setting up a Magma interface "interrupting_equal_kill"
* overloading the "interrupt" method to act as the generic method from 
expect.py if the option was not set, and kill Magma if it was.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to