hpycc.utils package

Submodules

hpycc.utils.docker_tools module

Functions to create and control HPCC docker images. Requires Docker to be installed and running!!!!!!!

class hpycc.utils.docker_tools.HPCCContainer(tag='latest', name='hpycc_test_img', users=None, pull=True, start=True)[source]

Bases: object

create_passwords()[source]
pull_image()[source]
put_archive(b, name, path)[source]
setup_hpcc()[source]
start_container()[source]
start_hpcc()[source]
stop_container()[source]

hpycc.utils.filechunker module

functions that chunk an iterable.

Functions

  • make_chunks – Return tuples of start index and chunk size.
hpycc.utils.filechunker.make_chunks(num, chunk_size=10000)[source]

Return tuples of start index and chunk size.

Parameters:
  • num (int) – Total number of items.
  • chunk_size (int, optional) – Max chunk size, 10,000 by default.
Returns:

chs – List of chunks in the form [(start_index, num_items)]

Return type:

list of tuples

hpycc.utils.parsers module

hpycc.utils.parsers.apply_custom_dtypes(schema, dtypes)[source]
hpycc.utils.parsers.get_python_type_from_ecl_type(child)[source]

Get the python type from an hpcc schema node

Parameters:child (XML node) – Node of schema xml. See parse_schema_from_xml
Returns:type – Pythonic type. If the HPCC type cannot be mapped, is str.
Return type:type
hpycc.utils.parsers.parse_schema_from_xml(xml)[source]

Parse an ECL schema into python types.

Parameters:xml (str) – xml string returned by ecl run. This is located in the json as [“WUResultResponse][“Result”][“XmlSchema”][“xml”].
Returns:
  • OrderedDict – dict of column stats, in the form {name: Str, type: Str, is_a_set: Bool}.
  • list – Column names in order of occurrence.
hpycc.utils.parsers.parse_wuid_from_failed_response(result)[source]
hpycc.utils.parsers.parse_wuid_from_xml(result)[source]

Function retrieves a WUID for a script that has run. This retrieves it only in the cases where the request response was in XML format.

Parameters:result ('XML') – The XML response for the script that has run.
Returns:wuid – The Workunit ID from the XML.
Return type:str
hpycc.utils.parsers.parse_xml(xml)[source]

Return a DataFrame from a nested XML.

Parameters:xml (str) – xml to be parsed.
Returns:df – Parsed xml.
Return type:pd.DataFrame

Module contents