Class: Syskit::ShellInterface
- Inherits:
-
Roby::Interface::CommandLibrary
- Object
- Roby::Interface::CommandLibrary
- Syskit::ShellInterface
- Defined in:
- lib/syskit/shell_interface.rb
Overview
Definition of the syskit-specific interface commands
Defined Under Namespace
Classes: LoggingConfiguration, LoggingGroup, ShellDeploymentRestart
Instance Method Summary collapse
- #disable_log_group(string) ⇒ Object
-
#disable_logging_of(string) ⇒ Object
deprecated
Deprecated.
use disable_log_group instead
-
#dump_all_config(path, name = nil) ⇒ nil
Saves the configuration of all running tasks to disk.
-
#dump_task_config(task_model, path, name = nil) ⇒ nil
Save the configuration of all running tasks of the given model to disk.
- #enable_log_group(string) ⇒ Object
-
#enable_logging_of(string) ⇒ Object
deprecated
Deprecated.
use enable_log_group instead
- #logging_conf ⇒ Object
- #pending_reloaded_configurations ⇒ Object
-
#redeploy ⇒ Object
Require the engine to redeploy the current network.
- #reload_config ⇒ Object
-
#restart_deployments(*models) ⇒ Object
Restarts deployment processes.
-
#stop_deployments(*models) ⇒ Object
Stops deployment processes.
- #update_logging_conf(conf) ⇒ Object
Instance Method Details
#disable_log_group(string) ⇒ Object
154 155 156 157 158 |
# File 'lib/syskit/shell_interface.rb', line 154 def disable_log_group(string) Syskit.conf.logs.disable_log_group(string) redeploy nil end |
#disable_logging_of(string) ⇒ Object
use disable_log_group instead
163 164 165 |
# File 'lib/syskit/shell_interface.rb', line 163 def disable_logging_of(string) disable_log_group(string) end |
#dump_all_config(path, name = nil) ⇒ nil
Saves the configuration of all running tasks to disk
30 31 32 33 |
# File 'lib/syskit/shell_interface.rb', line 30 def dump_all_config(path, name = nil) dump_task_config(Syskit::TaskContext, path, name) nil end |
#dump_task_config(task_model, path, name = nil) ⇒ nil
Save the configuration of all running tasks of the given model to disk
12 13 14 15 16 17 18 19 |
# File 'lib/syskit/shell_interface.rb', line 12 def dump_task_config(task_model, path, name = nil) FileUtils.mkdir_p(path) plan.find_tasks(task_model). each do |t| Orocos.conf.save(t.orocos_task, path, name || t.orocos_task.name) end nil end |
#enable_log_group(string) ⇒ Object
141 142 143 144 145 |
# File 'lib/syskit/shell_interface.rb', line 141 def enable_log_group(string) Syskit.conf.logs.enable_log_group(string) redeploy nil end |
#enable_logging_of(string) ⇒ Object
use enable_log_group instead
150 151 152 |
# File 'lib/syskit/shell_interface.rb', line 150 def enable_logging_of(string) enable_log_group(string) end |
#logging_conf ⇒ Object
169 170 171 172 173 174 175 176 177 |
# File 'lib/syskit/shell_interface.rb', line 169 def logging_conf conf = LoggingConfiguration.new(false, false, Hash.new) conf.port_logs_enabled = Syskit.conf.logs.port_logs_enabled? conf.conf_logs_enabled = Syskit.conf.logs.conf_logs_enabled? Syskit.conf.logs.groups.each_pair do |key, group| conf.groups[key] = LoggingGroup.new(key, group.enabled?) end conf end |
#pending_reloaded_configurations ⇒ Object
124 125 126 |
# File 'lib/syskit/shell_interface.rb', line 124 def pending_reloaded_configurations app.syskit_pending_reloaded_configurations end |
#redeploy ⇒ Object
Require the engine to redeploy the current network
It must be called after #reload_config to apply the new configuration(s)
134 135 136 137 |
# File 'lib/syskit/shell_interface.rb', line 134 def redeploy Runtime.apply_requirement_modifications(plan, force: true) nil end |
#reload_config ⇒ Object
117 118 119 |
# File 'lib/syskit/shell_interface.rb', line 117 def reload_config app.syskit_reload_config end |
#restart_deployments(*models) ⇒ Object
Restarts deployment processes
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/syskit/shell_interface.rb', line 83 def restart_deployments(*models) protection = ShellDeploymentRestart.new plan.add(protection) protection.start! if models.empty? models << Syskit::Deployment end done = Roby::AndGenerator.new done.signals protection.redeploy_event models.each do |m| agents = plan.find_tasks(m).each_with_object(Set.new) do |task, result| if task.kind_of?(Syskit::TaskContext) result << task.execution_agent else result << task end end agents.each do |agent_task| agent_task.each_executed_task do |task| task.stop_event.handle_with(protection) end done << agent_task.stop_event agent_task.stop! end end nil end |
#stop_deployments(*models) ⇒ Object
Stops deployment processes
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/syskit/shell_interface.rb', line 59 def stop_deployments(*models) if models.empty? models << Syskit::Deployment end models.each do |m| plan.find_tasks(m). each do |task| if task.kind_of?(Syskit::TaskContext) task.execution_agent.stop! else task.stop! end end end end |
#update_logging_conf(conf) ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/syskit/shell_interface.rb', line 180 def update_logging_conf(conf) conf.port_logs_enabled ? Syskit.conf.logs.enable_port_logging : Syskit.conf.logs.disable_port_logging conf.conf_logs_enabled ? Syskit.conf.logs.enable_conf_logging : Syskit.conf.logs.disable_conf_logging conf.groups.each_pair do |name, group| begin Syskit.conf.logs.group_by_name(name).enabled = group.enabled rescue ArgumentError Syskit.warn "tried to update a group that does not exist: #{name}" end end redeploy end |