Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canceling in rails console #180

Open
martnst opened this issue Jun 23, 2016 · 3 comments
Open

Canceling in rails console #180

martnst opened this issue Jun 23, 2016 · 3 comments

Comments

@martnst
Copy link

martnst commented Jun 23, 2016

Hi,

apparently interrupt signal in threads is not supported anymore. Hence I am wondering why that is the case and furthermore if there is any alternative to cancel long running stuff while being in the rails console.

Thx

@grosser
Copy link
Owner

grosser commented Jun 23, 2016

Should be supported, if not that's a bug, please try to reproduce / fix
(maybe simplest with bundle open parallel)

On Thu, Jun 23, 2016 at 3:09 AM, Martin Stemmle notifications@github.com
wrote:

Hi,

apparently interrupt signal in threads is not supported anymore. Hence I
am wondering why that is the case and furthermore if there is any
alternative to cancel long running stuff while being in the rails console.

Thx


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#180, or mute the thread
https://github.com/notifications/unsubscribe/AAAsZ7ryIRj8NJrlgicixuN1SeItUCVPks5qOltsgaJpZM4I8ptv
.

@martnst
Copy link
Author

martnst commented Jun 23, 2016

  1. here it says it's not supported anymore https://github.com/grosser/parallel/blob/master/lib/parallel.rb#L299
  2. Trying this with in_threads: 3 does not cancel when hitting CTRL + C

[22] pry(main)> Parallel.map(1..50, in_threads: 3, progress: "Doing stuff") { sleep 1 }
^CInterrupt:  ETA: 00:00:19 | ================                                                                                                          | Time: 00:00:03
from /Users/marste/.rvm/gems/ruby-2.1.5/gems/parallel-1.9.0/lib/parallel.rb:193:in `value'
[23] pry(main)> Doing stuff | ETA: 00:00:16 | ========================                                                                                                  Doing stuff |Time: 00:00:17 | ========================================================================================================================= | Time: 00:00:17
[23] pry(main)> 
[24] pry(main)> 

@grosser
Copy link
Owner

grosser commented Jun 23, 2016

ah yes ... the whole interrupt handling is supported via an at_exit hook
and that is not getting set up when using threads :/

I'd prefer not to mess with at_exit ... maybe there is some other way the
Interrupt can get caught by the threads ... not even sure if the at_exit
would trigger since this is in irb ...

On Thu, Jun 23, 2016 at 8:21 AM, Martin Stemmle notifications@github.com
wrote:

here it says it's not supported anymore
https://github.com/grosser/parallel/blob/master/lib/parallel.rb#L299
2.

Trying this with in_threads: 3 does not cancel when hitting CTRL + C

[22] pry(main)> Parallel.map(1..50, in_threads: 3, progress: "Doing stuff") { sleep 1 }
^CInterrupt: ETA: 00:00:19 | ================ | Time: 00:00:03
from /Users/marste/.rvm/gems/ruby-2.1.5/gems/parallel-1.9.0/lib/parallel.rb:193:in `value'
[23] pry(main)> Doing stuff | ETA: 00:00:16 | ======================== Doing stuff |Time: 00:00:17 | ========================================================================================================================= | Time: 00:00:17
[23] pry(main)>
[24] pry(main)>


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#180 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAAsZ7GwYiBtxpJleu_ACcZM5RSAz6mwks5qOqSIgaJpZM4I8ptv
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants