AppController/djinn.rb
# Terminates a specific AppServer (determined by the listening port)
# that hosts the specified App Engine app.
#
# Args:
#   app_id: A String naming the application that a process will be removed
#     from.
#   port: A Fixnum that names the port of the AppServer to remove.
#   secret: A String that is used to authenticate the caller.
# Returns:
#   A Boolean indicating the success of the operation.
Terminates a specific AppServer (determined by the listening port)
that hosts the specified App Engine app.

A String naming the application that a process will be removed
from.
port: A Fixnum that names the port of the AppServer to remove.
secret: A String that is used to authenticate the caller.
Returns:
A Boolean indicating the success of the operation.
Terminates a specific AppServer ( determined by the listening port ) that hosts the specified App Engine app . A String naming the application that a process will be removed from . port : A Fixnum that names the port of the AppServer to remove . secret : A String that is used to authenticate the caller . Returns : A Boolean indicating the success of the operation .
def remove_appserver_process(app_id, port)
    @state = "Stopping an AppServer to free unused resources"
    Djinn.log_debug("Deleting AppServer instance to free up unused resources")
    uac = UserAppClient.new(my_node.private_ip, @@secret)
    app_manager = AppManagerClient.new(my_node.private_ip)
    begin
      app_is_enabled = uac.is_app_enabled?(app_id)
    rescue FailedNodeException
      Djinn.log_warn("Failed to talk to the UserAppServer about " +
        "application #{app_id}")
      return false
    end
    Djinn.log_debug("is app #{app_id} enabled? #{app_is_enabled}")
    if app_is_enabled == "false"
      return false
    end
    begin
      result = app_manager.stop_app_instance(app_id, port)
    rescue FailedNodeException
      Djinn.log_error("Unable to talk to the UserAppServer " +
        "stop instance on port #{port} for application #{app_id}.")
      result = false
    end
    unless result
      Djinn.log_error("Unable to stop instance on port #{port} " +
        "application #{app_id}")
    end
    return true
  end
def remove_appserver_process ( app_id , port ) @state = "Stopping an AppServer to free unused resources" Djinn . log_debug ( "Deleting AppServer instance to free up unused resources" ) uac = UserAppClient . new ( my_node . private_ip , @@secret ) app_manager = AppManagerClient . new ( my_node . private_ip ) begin app_is_enabled = uac . is_app_enabled? ( app_id ) rescue FailedNodeException Djinn . log_warn ( "Failed to talk to the UserAppServer about " + "application #{app_id}" ) return false end Djinn . log_debug ( "is app #{app_id} enabled? #{app_is_enabled}" ) if app_is_enabled == "false" return false end begin result = app_manager . stop_app_instance ( app_id , port ) rescue FailedNodeException Djinn . log_error ( "Unable to talk to the UserAppServer " + "stop instance on port #{port} for application #{app_id}." ) result = false end unless result Djinn . log_error ( "Unable to stop instance on port #{port} " + "application #{app_id}" ) end return true end
Terminates a specific AppServer (determined by the listening port)
that hosts the specified App Engine app.
Terminates a specific AppServer ( determined by the listening port ) that hosts the specified App Engine app .
app_id
<not_specific>
port
<not_specific>