kafka.tools.utilities

kafka.tools.utilities.check_java_home()

Make sure that JAVA_HOME in the current environment is specified and is valid.

Raises:ConfigurationException if JAVA_HOME is not set or does not contain java
kafka.tools.utilities.find_path_containing(fname)

Search the PATH for the given executable filename

Parameters:fname – the filename to check
Returns:the path that contains the filename
Raises:ConfigurationException if the filename cannot be found, or if it is not executable
kafka.tools.utilities.get_tools_path(tools_path=None)

Find the Kafka admin utilities, either from the provided arg or the PATH.

Parameters:tools_path – the path to use for locating the Kafka admin utilities.
Returns:the path that contains Kafka admin utilities
Raises:ConfigurationException if the path cannot be determined
kafka.tools.utilities.is_exec_file(fname)

Check if the given filename is a regular file and is executable.

Parameters:fname – the filename to check.
Returns:True if the filename given exists and is executable, False otherwise
kafka.tools.utilities.json_loads(json_str)

Load the provided string as JSON data. Make sure to try the python2 way and the python3 way

Parameters:json_str – The JSON encoded string
Returns:The decoded JSON object
kafka.tools.utilities.synchronized(item)

Decorator that synchronizes access to the instance method it decorates using a preexisting lock in the _lock attribute of the instance