class Syskit::Models::ConfiguredDeployment

Representation of a deployment that is configured with name mappings and spawn options

Attributes

model[R]

@return [Model<Syskit::Deployment>] the deployment model

name_mappings[R]

@return [Hash] the name mappings, e.g. the mapping from a task

name in {#model} to the name this task should have while running
process_name[R]

@return [String] the process name

process_server_name[R]

@return [String] the name of the process server this deployment

should run on
spawn_options[R]

@return [Hash] the options that should be passed at deployment

startup

Public Class Methods

new(process_server_name, model, name_mappings = Hash.new, process_name = model.name, spawn_options = Hash.new) click to toggle source
# 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

==(other) click to toggle source
# 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
command_line(loader: Roby.app.default_pkgconfig_loader, **options) click to toggle source

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
each_orogen_deployed_task_context_model() { |task| ... } click to toggle source

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
eql?(other) click to toggle source
# File lib/syskit/models/configured_deployment.rb, line 104
def eql?(other); self == other end
filter_command_line_options(oro_logfile: nil, wait: nil, output: nil, **command_line_options) click to toggle source

@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
hash() click to toggle source
# File lib/syskit/models/configured_deployment.rb, line 100
def hash
    [process_name, model].hash
end
new(options = Hash.new) click to toggle source

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
orogen_model() click to toggle source

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
pretty_print(pp) click to toggle source
# 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