Class: Syskit::RobyApp::ProcessServer
- Inherits:
-
Orocos::RemoteProcesses::Server
- Object
- Orocos::RemoteProcesses::Server
- Syskit::RobyApp::ProcessServer
- Defined in:
- lib/syskit/roby_app/process_server.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #create_log_dir(log_dir, time_tag, metadata = Hash.new) ⇒ Object
-
#initialize(app, loader: Orocos::RemoteProcesses::Server.create_pkgconfig_loader, port: Orocos::RemoteProcesses::DEFAULT_PORT) ⇒ ProcessServer
constructor
A new instance of ProcessServer.
- #open(fd: nil) ⇒ Object
- #start_process(name, deployment_name, name_mappings, options) ⇒ Object
Constructor Details
#initialize(app, loader: Orocos::RemoteProcesses::Server.create_pkgconfig_loader, port: Orocos::RemoteProcesses::DEFAULT_PORT) ⇒ ProcessServer
Returns a new instance of ProcessServer
9 10 11 12 |
# File 'lib/syskit/roby_app/process_server.rb', line 9 def initialize(app, loader: Orocos::RemoteProcesses::Server.create_pkgconfig_loader, port: Orocos::RemoteProcesses::DEFAULT_PORT) @app = app super(Hash[wait: false, output: "%m-%p.txt"], port, loader) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app
8 9 10 |
# File 'lib/syskit/roby_app/process_server.rb', line 8 def app @app end |
Instance Method Details
#create_log_dir(log_dir, time_tag, metadata = Hash.new) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/syskit/roby_app/process_server.rb', line 33 def create_log_dir(log_dir, time_tag, = Hash.new) if log_dir app.log_base_dir = log_dir end if parent_info = ['parent'] if app_name = parent_info['app_name'] app.app_name = app_name end if robot_name = parent_info['robot_name'] app.robot(robot_name, parent_info['robot_type'] || robot_name) end end app.() app.find_and_create_log_dir(time_tag) if parent_info = ['parent'] ::Robot.info "created #{app.log_dir} on behalf of" YAML.dump(parent_info).each_line do |line| ::Robot.info " #{line.chomp}" end else ::Robot.info "created #{app.log_dir}" end end |
#open(fd: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/syskit/roby_app/process_server.rb', line 14 def open(fd: nil) if fd server = TCPServer.for_fd(fd) else server = TCPServer.new(nil, required_port) end server.fcntl(Fcntl::FD_CLOEXEC, 1) @port = server.addr[1] com_r, com_w = IO.pipe @all_ios.clear @all_ios << server << com_r trap 'SIGCHLD' do com_w.write INTERNAL_SIGCHLD_TRIGGERED end end |
#start_process(name, deployment_name, name_mappings, options) ⇒ Object
58 59 60 61 |
# File 'lib/syskit/roby_app/process_server.rb', line 58 def start_process(name, deployment_name, name_mappings, ) = Hash[working_directory: app.log_dir].merge() super(name, deployment_name, name_mappings, ) end |