oasislmf.lookup.interface

Module Contents

Classes

KeyServerInterface

Interface to implement to create a KeyServer

OasisLookupInterface

Old Oasis base class -deprecated

class oasislmf.lookup.interface.KeyServerInterface(config, config_dir, user_data_dir, output_dir)[source]

Interface to implement to create a KeyServer It define the method to be implemented to be used correctly in lookup.factory.KeyServerFactory all classes must:

  • specify the version of the interface they use

  • implement the init method

  • implement the generate_key_files method

interface_version = '1'[source]
abstract generate_key_files(location_fp, successes_fp, errors_fp=None, output_format='oasis', keys_success_msg=False, multiproc_enabled=True, multiproc_num_cores=-1, multiproc_num_partitions=-1, **kwargs)[source]

Writes a keys file, and optionally a keys error file.

Parameters:
  • location_fp (str) – path to the locations file

  • successes_fp (str) – path to the success keys file

  • errors_fp (str) – path to the error keys file (optional)

  • output_format (str) – format of the keys files (oasis or json)

  • keys_success_msg (bool) – option to write msg for success key

  • multiproc_enabled (bool) – option to run with multiple processor

  • multiproc_num_cores (int) – number of cores to use in multiproc mode

  • multiproc_num_partitions (int) – number of partition to create in multiproc mode

If keys_errors_file_path is not present then the method returns a pair (p, n) where p is the keys file path and n is the number of “successful” keys records written to the keys file, otherwise it returns a quadruple (p1, n1, p2, n2) where p1 is the keys file path, n1 is the number of “successful” keys records written to the keys file, p2 is the keys errors file path and n2 is the number of “unsuccessful” keys records written to keys errors file.

class oasislmf.lookup.interface.OasisLookupInterface(keys_data_directory=None, supplier=None, model_name=None, model_version=None, complex_lookup_config_fp=None, output_directory=None)[source]

Old Oasis base class -deprecated If you were using this interface, you can make you class inherit from the new abstract class AbstractBasicKeyServer or implement the KeyServerInterface interface

interface_version = '0'[source]
process_locations(loc_df)[source]

Process location rows - passed in as a pandas dataframe.