class Syskit::ShellInterface

Definition of the syskit-specific interface commands

Constants

LoggingConfiguration
LoggingGroup

Public Instance Methods

disable_log_group(string) click to toggle source
# File lib/syskit/shell_interface.rb, line 156
def disable_log_group(string)
    Syskit.conf.logs.disable_log_group(string)
    redeploy
    nil
end
disable_logging_of(string) click to toggle source

@deprecated use #disable_log_group instead

# File lib/syskit/shell_interface.rb, line 165
def disable_logging_of(string)
    disable_log_group(string)
end
dump_all_config(path, name = nil) click to toggle source

Saves the configuration of all running tasks to disk

@param [String] name the section name for the new configuration @param [String] path the directory in which the files should be saved @return [nil]

# 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) click to toggle source

Save the configuration of all running tasks of the given model to disk

@param [String,nil] name the section name for the new configuration.

If nil, the task's orocos name will be used

@param [String] path the directory in which the files should be saved @return [nil]

# 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) click to toggle source
# File lib/syskit/shell_interface.rb, line 143
def enable_log_group(string)
    Syskit.conf.logs.enable_log_group(string)
    redeploy
    nil
end
enable_logging_of(string) click to toggle source

@deprecated use #enable_log_group instead

# File lib/syskit/shell_interface.rb, line 152
def enable_logging_of(string)
    enable_log_group(string)
end
logging_conf() click to toggle source
# File lib/syskit/shell_interface.rb, line 171
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() click to toggle source

(see Application#syskit_pending_reloaded_configurations)

# File lib/syskit/shell_interface.rb, line 126
def pending_reloaded_configurations
    app.syskit_pending_reloaded_configurations
end
redeploy() click to toggle source

Require the engine to redeploy the current network

It must be called after {#reload_config} to apply the new configuration(s)

# File lib/syskit/shell_interface.rb, line 136
def redeploy
    Runtime.apply_requirement_modifications(plan, force: true)
    nil
end
reload_config() click to toggle source

(see Application#syskit_reload_config)

# File lib/syskit/shell_interface.rb, line 119
def reload_config
    app.syskit_reload_config
end
restart_deployments(*models) click to toggle source

Restarts deployment processes

@param [Array<Model<Deployment>,Model<TaskContext>>] models if

non-empty, only the deployments matching this model or the deployments
supporting tasks matching the models will be restarted, otherwise all
deployments are restarted.
# 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 = Set.new
        plan.find_tasks(m).
            each do |task|
                if task.kind_of?(Syskit::TaskContext)
                    agents << task.execution_agent
                else
                    agents << 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) click to toggle source

Stops deployment processes

@param [Array<Model<Deployment>>] models if non-empty, only the

deployments matching this model will be stopped, otherwise all
deployments are stopped.
# 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) click to toggle source
# File lib/syskit/shell_interface.rb, line 182
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