Skip to content

WISH: Add method for interrupting / terminating a future #93

@HenrikBengtsson

Description

@HenrikBengtsson

Background / Question

@gdevailly, sorry I didn't see your June 16 question on Twitter until now;

How can one stops futures that are currently running?

The simple answer is that this is not possible.

CLARIFICATION 2018-03-15: but I hope we can add something that can be used (e.g. although not part of the official Future API there could this be functions that the end user can use to manually kill workers)

Ideas / Thoughts

Technically, it should be possible to interrupt and even terminate background R processes that evaluates a future. At least if they run on the local machine.

For instance, for multicore futures we already have an internal handle for the process ID (pid) of the forked process. For multisession futures, we could retrieve the pid for each cluster worker before launching the actual future. With this pid, we should be able to send an interrupt signal, which should signal an interrupt condition within R for that process. What complicates this is that we need to come up with a platform-independent method for terminating/signalling processes. We most likely need to reach out to a system() call for this. This should be doable, but increases the risk for not working everywhere.

Signalling a process running on another machine is a bit more complicated. It would basically require being able to launch a separate signalling process on that same machine. Not impossible, but also not guaranteed to work, e.g. maybe the future process already running occupies the last available port / socket for that machine.

For futures running on a cluster via a job scheduler (as created by the future.BatchJobs package) it should also be possible to terminate such futures / jobs using the killJob() functionality already provided by the BatchJobs package.

That's just some of my thoughts for now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions