class Syskit::RobyApp::UnmanagedTasksManager
A class API-compatible with Orocos::RemoteProcesses::Client but that handle components started externally to syskit
Attributes
The OroGen loader
The name service that should be used to resolve the tasks
@return [#get]
The set of processes started so far
@return [Hash<String,UnmanagedProcess>] mapping from process name
to the process object
Public Class Methods
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 41 def initialize(loader: Roby.app.default_loader, name_service: Orocos::CORBA.name_service) @loader = loader @processes = Hash.new @name_service = name_service @deployments = Hash.new end
Public Instance Methods
Creates a new log dir, and save the given time tag in it (used later on by #save_log_dir)
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 106 def create_log_dir(log_dir, time_tag, metadata = Hash.new) end
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 49 def disconnect end
Register a new deployment model on this server.
If name mappings are needed, they must have been done in the model. {#start} does not support name mappings
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 56 def register_deployment_model(model) loader.register_deployment_model(model) end
Requests that the process server moves the log directory at
log_dir to results_dir
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 101 def save_log_dir(log_dir, results_dir) end
Start a registered deployment
@param [String] name the desired process name @param [String,OroGen::Spec::Deployment] deployment_name either
the name of a deployment model on {#loader}, or the deployment
model itself
@param [Hash] name_mappings name mappings. This is provided for
compatibility with the process server API, but should always be empty
@param [String] prefix a prefix to be added to all tasks in the
deployment. This is provided for compatibility with the process server API, but should always be nil
@param [Hash] options additional spawn options. This is provided
for compatibility with the process server API, but is ignored
@return [UnmanagedProcess]
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 76 def start(name, deployment_name = name, name_mappings = Hash.new, prefix: nil, **options) model = if deployment_name.respond_to?(:to_str) loader.deployment_model_from_name(deployment_name) else deployment_name end if processes[name] raise ArgumentError, "#{name} is already started in #{self}" end prefix_mappings = Orocos::ProcessBase.resolve_prefix(model, prefix) name_mappings = prefix_mappings.merge(name_mappings) name_mappings.each do |from, to| if from != to raise NameMappingsForbidden, "cannot do name mapping in unmanaged processes" end end process = UnmanagedProcess.new(self, name, model) process.spawn processes[name] = process end
Requests to stop the given deployment
The call does not block until the process has quit. You will have to call wait_termination to wait for the process end.
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 140 def stop(world_name) if w = processes[world_name] w.kill end end
Waits for processes to terminate. timeout is the number of
milliseconds we should wait. If set to nil, the call will block until a
process terminates
Returns a hash that maps deployment names to the Status object that represents their exit status.
# File lib/syskit/roby_app/unmanaged_tasks_manager.rb, line 115 def wait_termination(timeout = nil) # Verify that the monitor threads are in a good state, and # gather the ones that are actually dead dead_processes = Set.new processes.delete_if do |_, process| begin process.verify_threads_state rescue Exception => e process.fatal "assuming #{process} died because the background thread died with" Roby.log_exception(e, process, :fatal) dead_processes << process end if process.dead? dead_processes << process end dead_processes.include?(process) end dead_processes end