Package node_manager_fkie :: Module screen_handler :: Class ScreenHandler
[frames] | no frames]

Class ScreenHandler

source code

object --+
         |
        ScreenHandler

The class to handle the running screen sessions and create new sessions on start of the ROS nodes.

Instance Methods

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
str
createSessionName(cls, node=None)
Creates a name for the screen session.
source code
str, str
splitSessionName(cls, session)
Splits the screen session name into PID and session name generated by createSessionName().
source code
 
testScreen(cls)
Tests for whether the SCREEN binary exists and raise an exception if not.
source code
str
getScreenLogFile(cls, session=None, node=None)
Generates a log file name for the screen session.
source code
str
getROSLogFile(cls, node)
Generates a log file name of the ROS log.
source code
str
getScreenCfgFile(cls, session=None, node=None)
Generates a configuration file name for the screen session.
source code
str
getScreenPidFile(cls, session=None, node=None)
Generates a PID file name for the screen session.
source code
[str(session name), ...]
getActiveScreens(cls, host, session='', auto_pw_request=True, user=None, pwd=None)
Returns the list with all compatible screen names.
source code
 
openScreenTerminal(cls, host, screen_name, nodename, user=None)
Open the screen output in a new terminal.
source code
 
openScreen(cls, node, host, auto_item_request=False, user=None, pw=None, items=[])
Searches for the screen associated with the given node and open the screen output in a new terminal.
source code
 
killScreens(cls, node, host, auto_ok_request=True, user=None, pw=None)
Searches for the screen associated with the given node and kill this screens.
source code
(output, err)
getLocalOutput(cls, cmd)
This method is used to read the output of the command executed in a terminal.
source code
str
getSceenCmd(cls, node)
Generates a configuration file and return the command prefix to start the given node in a screen terminal.
source code
Class Variables
  LOG_PATH = '/home/rosbuild/.ros/log/'
  SCREEN = '/usr/bin/screen'
  SLASH_SEP = '_'
Properties

Inherited from object: __class__

Method Details

createSessionName(cls, node=None)
Class Method

source code 

Creates a name for the screen session. All slash separators are replaced by SLASH_SEP

Parameters:
  • node (str) - the name of the node
Returns: str
name for the screen session.

splitSessionName(cls, session)
Class Method

source code 

Splits the screen session name into PID and session name generated by createSessionName().

Parameters:
  • session (str) - the screen session name
Returns: str, str
PID, session name generated by createSessionName(). Not presented values are coded as empty strings. Not valid session names have an empty PID string.

testScreen(cls)
Class Method

source code 

Tests for whether the SCREEN binary exists and raise an exception if not.

Raises:

getScreenLogFile(cls, session=None, node=None)
Class Method

source code 

Generates a log file name for the screen session.

Parameters:
  • session (str) - the name of the screen session
Returns: str
the log file name

getROSLogFile(cls, node)
Class Method

source code 

Generates a log file name of the ROS log.

Parameters:
  • node (str) - the name of the node
Returns: str
the ROS log file name

To Do: get the run_id from the ROS parameter server and search in this log folder for the log file (handle the node started using a launch file).

getScreenCfgFile(cls, session=None, node=None)
Class Method

source code 

Generates a configuration file name for the screen session.

Parameters:
  • session (str) - the name of the screen session
Returns: str
the configuration file name

getScreenPidFile(cls, session=None, node=None)
Class Method

source code 

Generates a PID file name for the screen session.

Parameters:
  • session (str) - the name of the screen session
Returns: str
the PID file name

getActiveScreens(cls, host, session='', auto_pw_request=True, user=None, pwd=None)
Class Method

source code 

Returns the list with all compatible screen names. If the session is set to an empty string all screens will be returned.

Parameters:
  • host (str) - the host name or IP to search for the screen session.
  • session (str (Default: '')) - the name or the suffix of the screen session
Returns: [str(session name), ...]
the list with session names
Raises:
  • Exception - on errors while resolving host

openScreenTerminal(cls, host, screen_name, nodename, user=None)
Class Method

source code 

Open the screen output in a new terminal.

Parameters:
  • host (str) - the host name or ip where the screen is running.
  • screen_name (str) - the name of the screen to show
  • nodename (str) - the name of the node is used for the title of the terminal
Raises:
  • Exception - on errors while resolving host

openScreen(cls, node, host, auto_item_request=False, user=None, pw=None, items=[])
Class Method

source code 

Searches for the screen associated with the given node and open the screen output in a new terminal.

Parameters:
  • node (str) - the name of the node those screen output to show
  • host (str) - the host name or ip where the screen is running
Raises:
  • Exception - on errors while resolving host

killScreens(cls, node, host, auto_ok_request=True, user=None, pw=None)
Class Method

source code 

Searches for the screen associated with the given node and kill this screens.

Parameters:
  • node (str) - the name of the node those screen output to show
  • host (str) - the host name or ip where the screen is running

getLocalOutput(cls, cmd)
Class Method

source code 

This method is used to read the output of the command executed in a terminal.

Parameters:
  • cmd (str) - the command to execute in a terminal
Returns: (output, err)
the output generated by the execution of the command.

getSceenCmd(cls, node)
Class Method

source code 

Generates a configuration file and return the command prefix to start the given node in a screen terminal.

Parameters:
  • node (str) - the name of the node
Returns: str
the command prefix