module OmfRc::ResourceProxy::ScheduledApplication

Constants

DEFAULT_MANDATORY_PARAMETER
MAX_PARAMETER_NUMBER

Public Instance Methods

process_event(res, event_type, app_id, msg) click to toggle source

This method processes an event coming from the application instance, which was started by this Resource Proxy (RP). It is a callback, which is usually called by the ExecApp class in OMF

@param [AbstractResource] res this RP @param [String] event_type the type of event from the app instance

(STARTED, EXIT, STDOUT, STDERR)

@param [String] app_id the id of the app instance @param [String] msg the message carried by the event

# File lib/omf_rc/resource_proxy/scheduled_application.rb, line 143
def process_event(res, event_type, app_id, msg)
    logger.info "App Event from '#{app_id}' "+
                "(##{res.property.event_sequence}) - "+
                "#{event_type}: '#{msg}'"
    res.property.event_sequence += 1
    if event_type == 'EXIT'
      res.property.state = :unscheduled
      res.inform(:status, {
                      status_type: 'APP_EVENT',
                      event: event_type.to_s.upcase,
                      app: app_id,
                      exit_code: msg,
                      msg: msg,
                      state: res.property.state,
                      seq: res.property.event_sequence,
                      uid: res.uid # do we really need this? Should be identical to 'src'
                    }, :ALL)
    else
      res.inform(:status, {
                    status_type: 'APP_EVENT',
                    event: event_type.to_s.upcase,
                    app: app_id,
                    msg: msg,
                    seq: res.property.event_sequence,
                    uid: res.uid
                  }, :ALL)
    end
end