I really love the jobs feature! It's a game changer for me.
I live even better the fact that you can operate it via the rstudioapi package -- in particular the
The main problem that I have though is that I cannot find a way to kill / stop a job via the API.
There is a stop button in the jobs tab that does it not via the API. I know about the function to set the status to "succeeded" or any other status, and about the one to remove it from the queue so it won't be visible. But even if I set the job status to "succeeded" and remove the job from the queue, the process that runs it is still alive, and as far as I know, the script is still running.
Is there a way to use the API to do the equivalent of clicking the red stop button in the jobs tab? I really need the job to stop executing --- my use case is a library function that loops indefinitely (it communicates with a server) and I need to stop it after a while, do some processing, and relaunch it. I need then to make sure that the process that runs the function is dead, and that the function does no longer run.
PS: I can do without the option of using an export environment in this case; that is, not to capture any objects created by this job, as its results are saved in file(s) (e.g. rds files), and I can use these to communicate back the results. So I don't need any environment to outlive the process.