Home Help Center

Stopping an AMI

alversonalverson Member Dennis AlversonOrganization: Braxton TechnologiesProject: Orbital Analysis
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.

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    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.

    Regards,
    Mark
Sign In or Register to comment.