Class: Orocos::RemoteProcesses::Process

Inherits:
ProcessBase show all
Defined in:
lib/orocos/remote_processes/process.rb

Overview

Representation of a remote process started with ProcessClient#start

Instance Attribute Summary collapse

Attributes inherited from ProcessBase

#default_logger, #logged_ports, #model, #name, #name_mappings, #tasks

Instance Method Summary collapse

Methods inherited from ProcessBase

#default_logger_name, #each_task, #get_mapped_name, #log_all_ports, #map_name, #orogen, #register_task, resolve_prefix, #setup_default_logger, #task_names

Constructor Details

#initialize(name, deployment_model, process_client, pid) ⇒ Process

Returns a new instance of Process.


17
18
19
20
21
22
# File 'lib/orocos/remote_processes/process.rb', line 17

def initialize(name, deployment_model, process_client, pid)
    @process_client = process_client
    @pid = pid
    @alive = true
    super(name, deployment_model)
end

Instance Attribute Details

#pidObject (readonly)

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


15
16
17
# File 'lib/orocos/remote_processes/process.rb', line 15

def pid
  @pid
end

#process_clientObject (readonly)

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


7
8
9
# File 'lib/orocos/remote_processes/process.rb', line 7

def process_client
  @process_client
end

Instance Method Details

#alive?Boolean

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

Returns:

  • (Boolean)

51
# File 'lib/orocos/remote_processes/process.rb', line 51

def alive?; @alive end

#dead!Object

Called to announce that this process has quit


30
31
32
# File 'lib/orocos/remote_processes/process.rb', line 30

def dead!
    @alive = false
end

#host_idObject

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


10
# File 'lib/orocos/remote_processes/process.rb', line 10

def host_id; process_client.host_id end

#joinObject

Wait for the


46
47
48
# File 'lib/orocos/remote_processes/process.rb', line 46

def join
    process_client.join(name)
end

#kill(wait = true) ⇒ Object

Stops the process


41
42
43
# File 'lib/orocos/remote_processes/process.rb', line 41

def kill(wait = true)
    process_client.stop(name, wait)
end

#on_localhost?Boolean

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

Returns:

  • (Boolean)

13
# File 'lib/orocos/remote_processes/process.rb', line 13

def on_localhost?; process_client.host == 'localhost' end

#processObject

Retunging the Process name of the remote process


25
26
27
# File 'lib/orocos/remote_processes/process.rb', line 25

def process
    self
end

#running?Boolean

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

Returns:

  • (Boolean)

53
# File 'lib/orocos/remote_processes/process.rb', line 53

def running?; @alive end

#task(task_name) ⇒ Object

Returns the task context object for the process' task that has this name


36
37
38
# File 'lib/orocos/remote_processes/process.rb', line 36

def task(task_name)
    process_client.name_service.get(task_name)
end

#wait_running(timeout = nil) ⇒ Object

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


57
58
59
# File 'lib/orocos/remote_processes/process.rb', line 57

def wait_running(timeout = nil)
           Orocos::Process.wait_running(self, timeout)
end