Auxiliaries & Utilities

File location:
  • Bundled implementation: source/client/python/utils.py

  • Cluster implementation: cluster/core/source/python/utils.py

@utils.suppress

A decorator that suppresses all exceptions.

utils.file_lock(file: str)

A context lock for file modification with a file system lock.

Parameters:

file (str) – Filename to be locked in the context.

utils.print_file(s: Any, file: str)

Wrapper function to process-safely print s into file.

Parameters:
  • s (str) – Content to be printed.

  • file (str) – Filename of output stream.

utils.redirect(src: str, dst: str, label='unknown')

Redirect the content of src to dst with label as prefix:

<label> line from src
Parameters:
  • src (str) – Filename of source file.

  • dst (str) – Filename of destination file.

  • label (str) – Optional prefix to the redirected content.

utils.is_nan(value: Any)

Check if value is None or a NaN.

Parameters:

value – Value to be checked.

Return type:

bool