BusinessCodes Package¶
BusinessCodes
Package¶
This package contains all BusinessCode importers.
BusinessCodeImporter
Module¶
This module contains the base class for all BusinessCode importers.
-
class
HPCStats.Importer.BusinessCodes.BusinessCodeImporter.
BusinessCodeImporter
(app, db, config)¶ Bases:
HPCStats.Importer.Importer.Importer
This is the base class common to all HPCStats BusinessCode importers. It defines a common set of attributes and generic methods.
-
find
(search)¶ Search for a Business over the list of Businesses loaded by importer in self.businesses attribute. Returns None if not found.
-
BusinessCodeImporterCSV
Module¶
This module contains the BusinessCodeImporterCSV class.
-
class
HPCStats.Importer.BusinessCodes.BusinessCodeImporterCSV.
BusinessCodeImporterCSV
(app, db, config)¶ Bases:
HPCStats.Importer.BusinessCodes.BusinessCodeImporter.BusinessCodeImporter
This class imports BusinessCodes from a CSV flat file.
-
check
()¶ Check if CSV file exists and is a proper flat file.
-
load
()¶ Load BusinessCodes from CSV files in businesses attribute. Raise HPCStatsSourceError if error in encountered.
-
update
()¶ Create or update BusinessCodes in database.
-
BusinessCodeImporterDummy
Module¶
This module contains the BusinessCodeImporterDumy class.
-
class
HPCStats.Importer.BusinessCodes.BusinessCodeImporterDummy.
BusinessCodeImporterDummy
(app, db, config)¶ Bases:
HPCStats.Importer.BusinessCodes.BusinessCodeImporter.BusinessCodeImporter
This class is dummy, it does not import any BusinessCode at all. It could be used as sane default when no BusinessCode have to be imported.
-
load
()¶ Dummy BusinessCodes load.
-
update
()¶ Dummy BusinessCodes update.
-
BusinessCodeImporterFactory
Module¶
This module contains the factory design pattern class that builds the appropriate BusinessCodeImporter depending on what is specified in configuration.
-
class
HPCStats.Importer.BusinessCodes.BusinessCodeImporterFactory.
BusinessCodeImporterFactory
¶ 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)¶ This method returns the appropriate BusinessCodeImporter object depending on what is specified in configuration. In case of configuration error, HPCStatsConfigurationException is raised.
-
static
BusinessCodeImporterSlurm
Module¶
This module import business codes from wckeys in Slurm accouting database.
-
class
HPCStats.Importer.BusinessCodes.BusinessCodeImporterSlurm.
BusinessCodeImporterSlurm
(app, db, config)¶ Bases:
HPCStats.Importer.BusinessCodes.BusinessCodeImporter.BusinessCodeImporter
Main class of this module.
-
check
()¶ Check if all Slurm databases are available and if we connect to them.
-
connect_db
(cluster)¶ Connect to a cluster Slurm database and set conn/cur attributes accordingly.
-
disconnect_db
()¶ Disconnect to currently connected Slurm DB.
-
load
()¶ Connects to all known Slurm databases to extract business codes from jobs wckeys. If a cluster raises a HPCStatsSourceError, it prints an error and continues with the next one.
-
load_cluster
(cluster)¶ Connect to cluster Slurm database to extract business codes from jobs wckeys. Raises HPCStatsSourceError in case of error.
-
update
()¶ Create BusinessCodes in database. It does not update BusinessCodes as they have no description when they are imported from Slurm and operators could have added description using
hpcstats modify
.
-