Shiny Shiny - Various - The Bop Wont Stop
Label: Concept Records - CC0005 • Format: 2x, Vinyl LP, Compilation • Country: Australia • Genre: Rock, Funk / Soul, Pop •
Provided you can split the heavy duty calculations into several parts, or have access to the part of the code that is involved in the computation, you can insert a breaker part. I implemented this in a Shiny app that listens for a button press before continuing with the rest of the calculation.
You can run the app from R by. For me it works the way I want since I use bash scripts that are triggered by R shiny and I want to be able to abort them. So how about putting your R code in a script and trigger the script by the system command? In the example below I just use a simple dummy bash script that runs a sleep command, while the first CL argument is the amount of sleep.
Everything below 10 secs is not accepted and puts the exit status to 1. In addition, I get some output in a logfile that I can monitor, and thus the progress in realtime. Learn more. Is it possible to stop executing of R code inside shiny without stopping the shiny process?
Ask Question. Asked 4 years, 6 months ago. Active 9 months ago. Viewed 7k times. DeanAttali DeanAttali I have an "analyze" button that can take several minutes. Sometimes I realize I forgot to set some option and I'd like to cancel it so that I can make a small adjustment. Killing the app to restart is inconvenient, I'd have to go through the whole process again.
And it Shiny Shiny - Various - The Bop Wont Stop like even Shiny Shiny - Various - The Bop Wont Stop the session itself is killed if I close the window where the "analyze" button was clicked, the code still runs, at least in that case I'd like to be able to kill the request. I wonder if you could integrate a booby-trap inside analyze that would listen for a certain event like button press and break from the code. I suppose you could for example have some global boolean flag, and inside analyze you would periodically Shiny Shiny - Various - The Bop Wont Stop the flag.
So yes you can make a hacky solution assuming you have access to whatever code it is that's doing the long computation. This is R, you have access to more or less everything. Sure, but I mean if you're calling a function where a single expression takes minutes, I'm not sure how you'd make it stop without terminating the session.
So another answer, outside a loop : use a child process. I can't run that code as-is because mcparallel is not defined maybe I need a newer version Boombastic - Various - The Best Summer Album In The World.Ever! the parallel package?
But I do see what you're doing, and yes I think that would work. It's not the prettiest solution but it's good you posted this here so that if someone needs to do this, they'll know of a way.
With R being single threaded, there is no other way, for now. I think. Are you on Windows? This will not run Shiny Shiny - Various - The Bop Wont Stop that platform: see parallel doc. You could ask Shiny team for a reactiveChildProcess. Yep, on Windows. As are many most? This isn't a big deal, I don't think it'll get Confidenzialmente (Versione Per Archi) - Ennio Morricone - Come Un Delfino (Colonna Sonora), I'm not pressed to file an issue about it R and ui.
R and run it using runApp. What about httpuv::service? Thank you, but the problem with this solution is that it can only stop Little Boy - The Folkstudio Singers - A Man Called Jesus iterations of something. I want to be able to call a function that takes a long time, which I don't have access to so I can't enter "breakpoints" inside it, and be able to just stop "ok, nevermind, stop that function call!
I see. I just realised that I have exactly the same problem. Hope you find this helpful. Dmitry Zotikov Dmitry Zotikov 4 4 silver badges 10 10 bronze badges. DmitryZotikov - answers should be self-contained. What if the link breaks? Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. A holiday carol for coders. Featured on Meta. Update: an agreement with Monica Cellio. Linked 6. Related 0. Hot Network Questions. Question feed.
God Bless America - The Eric Rogers Chorale And Orchestra* - America Sings, 8 Mile Road (Dubbyman Remix) - The Asphalt - 8 Mile Road EP, Exact Agony, Take Life - Twilight - Twilight, Call Me - Tony Mottola - Call Me / The World Of Your Embrace, Hyacinth House - The Doors - Infinite (Vinyl, Album, Album, Album, Album, Album, Album)