module OmfRc::ResourceProxy::Application
This module defines a Resource Proxy (RP) for an Application
. For a detailed usage tutorial see {file:doc/DEVELOPERS.mkd Resource Proxy tutorial}
Utility dependencies: platform_toos, common_tools
This Application
Proxy has the following properties:
-
binary_path (String) the path to the binary of this app
-
pkg_tarball (String) the URI of the installation tarball of this app
-
pkg_ubuntu (String) the name of the Ubuntu package for this app
-
pkg_fedora (String) the name of the Fedora package for this app
-
state (String) the state of this
Application
RP (stopped, running, paused, installed) -
installed (Boolean) is this application installed? (default false)
-
force_tarball_install (Boolean) if true then force the installation from tarball even if other distribution-specific installation are available (default false)
-
map_err_to_out (Boolean) if true then map StdErr to StdOut for this app (default false)
-
platform (Symbol) the OS platform where this app is running
-
environment (Hash) the environment variables to set prior to starting this app. { k1 => v1, … } will result in “env -i K1=v1 … ” (with k1 being either a String or a Symbol)
-
clean_env (Boolean) if true, application will be executed in a clean environment (env -i). Default is TRUE.
-
use_oml (Boolean) if true enable OML for this application (default false)
-
oml_loglevel (Integer) set a specific OML log level (default unset)
-
oml_logfile (String) set a specific path for OML log file (default unset)
-
oml_configfile (String) path of the OML config file (optional)
-
oml (Hash) OML specific properties (optional), this Hash contains the following keys:
- :available_mps (Array) list of available OML Measurement Points (Hash) - :collection (Hash) list of required OML Measurement Stream to collect when this application is running (defined in liboml2.conf manpage) http://omf.mytestbed.net/doc/oml/html/liboml2.conf.html - :experiment (String) name of the experiment in which this application is running - :id (String) OML id to use for this application when it is running
-
parameters (Hash) the command line parameters available for this app. This hash is of the form: { :param1 => attribut1, … } with param1 being the id of this parameter for this Proxy and with attribut1 being another Hash with the following possible keys and values (all are optional):
:cmd (String) the command line for this parameter :order (Fixnum) the appearance order on the command line, default FIFO :dynamic (Boolean) parameter can be dynammically changed, default false :type (Numeric|String|Boolean) this parameter's type :default value given by default to this parameter :value value to set for this parameter :mandatory (Boolean) this parameter is mandatory, default false
Note: this application proxy will merge new Hash values for the properties environment, oml, and parameters properties with the old Hash values.
Two examples of valid parameters definition are:
{ :host => {:default => 'localhost', :type => 'String', :mandatory => true, :order => 2}, :port => {:default => 5000, :type => 'Numeric', :cmd => '-p', :mandatory => true, :order => 1}, :size => {:default => 512, :type => 'Numeric', :cmd => '--pkt-size', :mandatory => true, :dynamic => true} :title => {:type => 'String', :mandatory => false} }
and
{ :title => {:value => "My First Application"} }
Constants
- DEFAULT_MANDATORY_PARAMETER
- MAX_PARAMETER_NUMBER
Public Instance Methods
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/application.rb, line 148 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 res.property.installed = true if app_id.include?("_INSTALL") && event_type.to_s.include?('EXIT') && msg == "0" if event_type == 'EXIT' res.property.state = :stopped 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) unless res.property.silent 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) unless res.property.quiet end end