pipert.contrib.save_predictions

Module Contents

Classes

OutputLogger

MarsDBHandler

PredsToDatabase

Helper class that provides a standard way to create an ABC using

class pipert.contrib.save_predictions.OutputLogger(endpoint, in_key, db_conf, redis_url)[source]

Bases: pipert.core.BaseComponent

toggle(self)[source]

Toggle saving to the database on or off. To be used with zpc.

Returns

None

class pipert.contrib.save_predictions.MarsDBHandler(db_conf, logger)[source]

Bases: pipert.contrib.database.PSQLDBHandler

define_tables(self)[source]

This method defines the structure of the tables that the handler should work with, as well as binds the pythonic Classes to the correct table in db within ‘self.tables’.

THIS IS THE ONLY PLACE THAT SHOULD REQUIRE CHANGES WHEN ADDING TABLES OR CHANGING TO ANOTHER DATABASE

class pipert.contrib.save_predictions.PredsToDatabase(in_queue, db_conf, *args, **kwargs)[source]

Bases: pipert.core.Routine

Helper class that provides a standard way to create an ABC using inheritance.

setup(self, *args, **kwargs)[source]
main_logic(self, *args, **kwargs)[source]
cleanup(self, *args, **kwargs)[source]
toggle(self)[source]

Toggle saving to the database on or off. Makes sure db connection is up when toggled ON.

Returns:

A message describing the new state (On/Off)

commit_to_db(self, routine)[source]

Commit the current session to database, rollback in case of an error

Args:

routine: This is just a dummy argument, but its necessary if this method is to be used as an event handler.

pipert.contrib.save_predictions.parser[source]