communication.functions module

This module contains helper functions

communication.functions.handle_sigterm(*_args)[source]

Sigterm handler: raise KeyboardInterrupt.

Parameters:

_args (Any) – unused arguments, accept any arguments

Raises:

KeyboardInterrupt – raises a keyboard interrupt

Return type:

None

communication.functions.init(name, logger_level=20)[source]

Initialize logger and sigterm handler.

Parameters:
  • name (str) – name of the logger

  • logger_level (int) – the logging level to use

Return type:

Logger

Returns:

a logger instance

communication.functions.trim_string(string, max_length=155)[source]

Trim string for debug purposes.

Parameters:
  • string (str) – the strim to trim

  • max_length (int) – the maximal output length of the trimmed string

Return type:

str

Returns:

the trimmed string as ‘<first half> … <second half>’