This forum has been archived. Please start a new discussion on GitHub.

Stopping an AMI

Is there a way to stop an AMI that is already in progress before it completes? I am executing an AMI from a GUI client, and I would like to provide the user the ability to stop the operation.


  • mes
    mes California
    Hi Dennis,

    For various technical reasons, Ice does not provide a way to cancel a remote operation. This is something you would need to implement in an application-specific way.

    For example, one option would be to set a flag in your AMI callback to ignore the response. Of course, that wouldn't have any effect on what the server is doing.

    If the intent is to stop the activity in the server to avoid wasting compute resources, you should consider modifying the Slice definitions of long-running and/or compute-intensive operations to return a proxy with which the client can terminate the request:
    interface Job
        void cancel();
    interface Server
        Job* longRunningOperation();

    I realize that what I'm proposing is quite a bit more complex than simply issuing an AMI request, since now you also have to deal with launching the task in the background, notifying the client when the task completes, and delivering the results. However, the simple fact is that only the server knows how to safely terminate a request.