class Syskit::Models::ConfiguredDeployment
Representation of a deployment that is configured with name mappings and spawn options
Attributes
@return [Model<Syskit::Deployment>] the deployment model
@return [Hash] the name mappings, e.g. the mapping from a task
name in {#model} to the name this task should have while running
@return [String] the process name
@return [String] the name of the process server this deployment
should run on
@return [Hash] the options that should be passed at deployment
startup
Public Class Methods
# File lib/syskit/models/configured_deployment.rb, line 20 def initialize(process_server_name, model, name_mappings = Hash.new, process_name = model.name, spawn_options = Hash.new) @process_server_name, @model, @name_mappings, @process_name, @spawn_options = process_server_name, model, name_mappings, process_name, spawn_options end
Public Instance Methods
# File lib/syskit/models/configured_deployment.rb, line 91 def ==(other) return if !other.kind_of?(ConfiguredDeployment) return process_server_name == other.process_server_name && process_name == other.process_name && model == other.model && spawn_options == other.spawn_options && name_mappings == other.name_mappings end
Returns the command line information needed to start this deployment on the same machine than Syskit
# File lib/syskit/models/configured_deployment.rb, line 37 def command_line(loader: Roby.app.default_pkgconfig_loader, **options) model.command_line(process_name, name_mappings, loader: loader, **filter_command_line_options(options)) end
Enumerate the oroGen specification for the deployed tasks
@yieldparam [OroGen::Spec::TaskDeployment]
# File lib/syskit/models/configured_deployment.rb, line 66 def each_orogen_deployed_task_context_model return enum_for(__method__) if !block_given? model.each_orogen_deployed_task_context_model do |deployed_task| task = deployed_task.dup task.name = name_mappings[task.name] || task.name yield(task) end end
# File lib/syskit/models/configured_deployment.rb, line 104 def eql?(other); self == other end
@api private
Filters out options that are part of the spawn options but not of the command-line generation options
# File lib/syskit/models/configured_deployment.rb, line 29 def filter_command_line_options(oro_logfile: nil, wait: nil, output: nil, **command_line_options) return command_line_options end
# File lib/syskit/models/configured_deployment.rb, line 100 def hash [process_name, model].hash end
Create a new deployment task that can represent self in a plan
@return [Syskit::Deployment] a new, properly configured, instance
of {#model}. Usually a {Syskit::Deployment}
# File lib/syskit/models/configured_deployment.rb, line 79 def new(options = Hash.new) options = options.merge( process_name: process_name, name_mappings: name_mappings, spawn_options: spawn_options, on: process_server_name) options.delete(:working_directory) options.delete(:output) options.delete(:wait) model.new(options) end
The oroGen model object that represents this configured deployment
It differs from model.orogen_model in that the {#name_mappings} are applied
@return [OroGen::Spec::Deployment]
# File lib/syskit/models/configured_deployment.rb, line 49 def orogen_model if @orogen_model return @orogen_model end @orogen_model = model.orogen_model.dup orogen_model.task_activities.map! do |activity| activity = activity.dup activity.name = name_mappings[activity.name] || activity.name activity end @orogen_model end
# File lib/syskit/models/configured_deployment.rb, line 106 def pretty_print(pp) pp.text "deployment #{model.orogen_model.name} with the following tasks" pp.nest(2) do each_orogen_deployed_task_context_model do |task| pp.breakable task.pretty_print(pp) end end end