class Orocos::RemoteProcess

Representation of a remote process started with Orocos::ProcessClient#start

Attributes

model[R]

The Orocos::Generation::StaticDeployment instance that describes this process

name[R]

The deployment name

name_mappings[R]

a mapping from the original to the new name

pid[R]

The process ID of this process on the machine of the process server

process_client[R]

The ProcessClient instance that gives us access to the remote process server

Public Class Methods

new(name, process_client, pid, prefix = nil) click to toggle source
# File lib/orocos/process_server.rb, line 606
def initialize(name, process_client, pid, prefix = nil)
    @name = name
    @process_client = process_client
    @pid = pid
    @alive = true
    @model = process_client.load_orogen_deployment(name)
    @name_mappings = Hash.new

    if prefix
        @model.task_activities.each do |task|
            map_name(task.name, "#{prefix}#{task.name}")                             
        end
    end
end

Public Instance Methods

alive?() click to toggle source

True if the process is running. This is an alias for running?

# File lib/orocos/process_server.rb, line 661
def alive?; @alive end
dead!() click to toggle source

Called to announce that this process has quit

# File lib/orocos/process_server.rb, line 630
def dead!
    @alive = false
end
get_mapped_name(name) click to toggle source
# File lib/orocos/process_server.rb, line 638
def get_mapped_name(name)
    name_mappings[name] || name
end
host_id() click to toggle source

A string describing the host. It can be used to check if two processes are running on the same host

# File lib/orocos/process_server.rb, line 594
def host_id
    process_client.host_id
end
join() click to toggle source

Wait for the

# File lib/orocos/process_server.rb, line 656
def join
    raise NotImplementedError, "RemoteProcess#join is not implemented"
end
kill(wait = true) click to toggle source

Stops the process

# File lib/orocos/process_server.rb, line 650
def kill(wait = true)
    raise ArgumentError, "cannot call RemoteProcess#kill(true)" if wait
    process_client.stop(name)
end
log_all_ports(options = Hash.new) click to toggle source
# File lib/orocos/process_server.rb, line 621
def log_all_ports(options = Hash.new)
    Orocos.log_all_ports(self, options)
end
map_name(old, new) click to toggle source
# File lib/orocos/process_server.rb, line 634
def map_name(old, new)
    name_mappings[old] = new
end
on_localhost?() click to toggle source

True if this process is located on the same machine than the ruby interpreter

# File lib/orocos/process_server.rb, line 599
def on_localhost?
    process_client.host == 'localhost'
end
running?() click to toggle source

True if the process is running. This is an alias for alive?

# File lib/orocos/process_server.rb, line 663
def running?; @alive end
setup_logger(options = Hash.new) click to toggle source
# File lib/orocos/process_server.rb, line 625
def setup_logger(options = Hash.new)
    Orocos.setup_default_logger(self, options)
end
task_names() click to toggle source
# File lib/orocos/process_server.rb, line 642
def task_names
    model.task_activities.map do |task|
        name = task.name
        get_mapped_name(name)
    end
end
wait_running(timeout = nil) click to toggle source

Waits for the deployment to be ready. timeout is the number of milliseconds we should wait. If it is nil, will wait indefinitely

# File lib/orocos/process_server.rb, line 667
def wait_running(timeout = nil)
    Orocos::Process.wait_running(self, timeout)
end