fkie_mas_pylib.system.screen module
- exception fkie_mas_pylib.system.screen.ScreenException
Bases:
Exception
- fkie_mas_pylib.system.screen.create_screen_cfg(clear_previous: bool = False) None
Create screen configuration file
- Raises:
ScreenHandlerException – if the screen binary not found.
- fkie_mas_pylib.system.screen.create_session_name(node: str = '', namespace: str = '/') str
Creates a name for the screen session. All slash separators are replaced by SLASH_SEP and all SLASH_SEP are replaced by double SLASH_SEP.
- Parameters:
node (str) – the name of the node
- Returns:
name for the screen session.
- Return type:
str
- fkie_mas_pylib.system.screen.delete_log(nodename: str, namespace: str = '/') None
Removes log and runtime files located in ROS-log directory. These are log and configuration file of node’s screen. PID file and ROS-log file of the node.
- Parameters:
nodename (str) – Name of the node.
- fkie_mas_pylib.system.screen.get_active_screens(nodename: str = '') Dict[str, str]
Returns the dictionary (session name: node name) with all compatible screen names. If the session is set to an empty string all screens will be returned.
- Parameters:
nodename (str) – the name of the node.
- Returns:
On empty nodename returns all screen.
- Return type:
{str: [str]}
- fkie_mas_pylib.system.screen.get_cmd(node: str, namespace: str = '/') str
Return the command prefix to start the given node in a screen terminal.
- Parameters:
node (str) – the name of the node
- Returns:
the command prefix
- Return type:
str
- fkie_mas_pylib.system.screen.get_logfile(session: str = None, node: str = None, for_new_screen: bool = False, namespace: str = '/') str
Generates a log file name of the ROS log.
- Parameters:
node (str) – the name of the node
- Returns:
the ROS log file name
- Return type:
str
- Todo:
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).
- fkie_mas_pylib.system.screen.get_pid_file(session: str = None, node: str = None, namespace: str = '/') str
Generates a PID file name for the screen session.
- Parameters:
session (str) – the name of the screen session
- Returns:
the PID file name
- Return type:
str
- fkie_mas_pylib.system.screen.get_ros_logfile(node: str, namespace: str = '/', for_new_screen: bool = False) str
Generates a log file name for the ROS log
- Parameters:
node (str) – the name of the node
- Returns:
the log file name
- Return type:
str
- fkie_mas_pylib.system.screen.log_dir_size() int
- Returns:
Disk usage in bytes for ROS log directory.
- Return type:
int
- fkie_mas_pylib.system.screen.ros_clean() None
Removes the content of the ROS-log directory. We didn’t use rosclean purge because it removes the log-directory. This needs restart of ROS nodes or recreate log directory to get log again.
- fkie_mas_pylib.system.screen.session_name2node_name(session: str) str
Create a node name from screen session name. Revert changes done by
create_session_name()- Parameters:
session (str) – the name of the session without pid
- Returns:
name name.
- Return type:
str
- fkie_mas_pylib.system.screen.split_session_name(session: str) Tuple[int, str]
Splits the screen session name into PID and session name generated by create_session_name().
- Parameters:
session (str) – the screen session name
- Returns:
PID, session name generated by create_session_name(). Not presented values are coded as empty strings. Not valid session names have an empty PID string.
- Return type:
int, str
- fkie_mas_pylib.system.screen.test_screen() None
Tests for whether the SCREEN binary exists and raise an exception if not.
- Raises:
ScreenHandlerException – if the screen binary not found.
- fkie_mas_pylib.system.screen.wipe() None
Calls ‘screen -wipe’ command to clean up SockDir.