Events Package

Events Package

This package contains all the Event importers.

EventImporter Module

This module contains the base class for all Event importers.

class HPCStats.Importer.Events.EventImporter.EventImporter(app, db, config, cluster)

Bases: HPCStats.Importer.Importer.Importer

This is the base class common to all HPCStats Event importers. It simply defines a common set of attributes.

EventImporterFactory Module

This module contains the factory design pattern class that builds the appropriate EventImporter depending on what is specified in configuration.

class HPCStats.Importer.Events.EventImporterFactory.EventImporterFactory

Bases: object

This class simply delivers the factory() static method, there is not point to instanciate it with an object.

static factory(app, db, config, cluster)

This method returns the appropriate EventImporter object depending on what is specified in configuration. In case of configuration error, HPCStatsConfigurationException is raised.

EventImporterSlurm Module

This module contains the EventImporterSlurm class.

class HPCStats.Importer.Events.EventImporterSlurm.EventImporterSlurm(app, db, config, cluster)

Bases: HPCStats.Importer.Events.EventImporter.EventImporter

This EventImporter imports Events from a cluster Slurm accounting database.

check()

Check if cluster Slurm database is available for connection.

connect_db()

Connect to cluster Slurm database and set conn/cur attribute accordingly. Raises HPCStatsSourceError in case of problem.

disconnect_db()

Disconnect from cluster Slurm database.

get_new_events(start)

Get all new Events from Slurm DB since start datetime. Parameter start must be a valid datetime. Returns a list of Events. The list is empty if none found.

load()

Load Events from Slurm DB and store them into self.events list attribute.

merge_successive_events(events)

Merge successive Events in the list. For example, if the list contains 2 events on node A from X to Y and from Y to Z, this method will merge them into one event on node A from Y to Z. Ex:

[ { node: N1, reason: R1, start: X, end Y },
  { node: N1, reason: R1, start: Y, end Z } ]
-> [ { node: N1, reason: R1, start: X, end: Z } ]
static txt_slurm_event_type(reason_uid)

Convert reason_uid integer that holds node state in Slurm bitmap convention to string representing this state into human readable format.

update()

Update Events in DB.