Commit cd1d2268 authored by Carla Guillen Carias's avatar Carla Guillen Carias
Browse files

Refactoring names to be consistent with plugin name

parent 9e902da5
......@@ -68,11 +68,11 @@ void PerSystDB::print_error(){
}
PerSystDB::PerSystDB(MYSQL *mysql, Rotation_t rotation, unsigned int every_x_days):
_mysql(mysql), _rotation(rotation), _every_x_days(every_x_days), _internal_connection(false) {
_mysql(mysql), _rotation(rotation), _every_x_days(every_x_days), _internal_connection(false), _aggregate_timestamp(0) {
}
PerSystDB::PerSystDB(const std::string & host, const std::string & user, const std::string & password, const std::string & database_name, int port, Rotation_t rotation, unsigned int every_x_days): _rotation(rotation), _every_x_days(every_x_days), _internal_connection(true) {
PerSystDB::PerSystDB(const std::string & host, const std::string & user, const std::string & password, const std::string & database_name, int port, Rotation_t rotation, unsigned int every_x_days): _rotation(rotation), _every_x_days(every_x_days), _internal_connection(true), _aggregate_timestamp(0) {
_mysql = mysql_init(NULL);
if(!mysql_real_connect(_mysql, host.c_str(), user.c_str(), password.c_str(), database_name.c_str(), port, NULL, 0)){
print_error();
......@@ -271,7 +271,9 @@ bool PerSystDB::updateJobsLastSuffix(std::map<std::string, std::string>& job_map
if (mysql_real_query(_mysql, query.c_str(), query.size())){
print_error();
return false;
}
return true;
}
......
......@@ -58,6 +58,8 @@ protected:
Rotation_t _rotation;
unsigned int _every_x_days; //ignored except when EVERY_XDAYS is chosen
bool _internal_connection;
unsigned long long _aggregate_timestamp;
std::string _current_table_suffix;
void print_error();
public:
......
//================================================================================
// Name : JobTSAggregatorConfigurator.cpp
// Name : PerSystSqlConfigurator.cpp
// Author : Carla Guillen
// Contact : info@dcdb.it
// Copyright : Leibniz Supercomputing Centre
......@@ -25,8 +25,6 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//================================================================================
#include "JobTSAggregatorConfigurator.h"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/foreach.hpp>
#include <boost/property_tree/detail/ptree_implementation.hpp>
......@@ -36,17 +34,18 @@
#include "../../includes/OperatorConfiguratorTemplate.h"
#include "../../includes/UnitInterface.h"
#include "PerSystSqlOperatorConfigurator.h"
JobTSAggregatorConfigurator::JobTSAggregatorConfigurator(): JobOperatorConfiguratorTemplate() {
PerSystSqlConfigurator::PerSystSqlConfigurator(): JobOperatorConfiguratorTemplate() {
_operatorName = "persystsql";
_baseName = "sensor";
}
JobTSAggregatorConfigurator::~JobTSAggregatorConfigurator() {
PerSystSqlConfigurator::~PerSystSqlConfigurator() {
}
void JobTSAggregatorConfigurator::sensorBase(AggregatorSensorBase& s, CFG_VAL config) {
void PerSystSqlConfigurator::sensorBase(AggregatorSensorBase& s, CFG_VAL config) {
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
{
if (boost::iequals(val.first, "operation")) {
......@@ -71,7 +70,7 @@ void JobTSAggregatorConfigurator::sensorBase(AggregatorSensorBase& s, CFG_VAL co
}
}
void JobTSAggregatorConfigurator::operatorAttributes(JobTSAggregatorOperator& op, CFG_VAL config) {
void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL config) {
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config) {
if (boost::iequals(val.first, "number_quantiles")) {
unsigned int num_quantiles = std::stoul(val.second.data());
......@@ -80,11 +79,11 @@ void JobTSAggregatorConfigurator::operatorAttributes(JobTSAggregatorOperator& op
}
}
bool JobTSAggregatorConfigurator::unit(UnitTemplate<AggregatorSensorBase>& u) {
bool PerSystSqlConfigurator::unit(UnitTemplate<AggregatorSensorBase>& u) {
return true;
}
bool JobTSAggregatorConfigurator::readUnits(JobTSAggregatorOperator& op,
bool PerSystSqlConfigurator::readUnits(PerSystSqlOperator& op,
std::vector<shared_ptr<AggregatorSensorBase>>& protoInputs,
std::vector<shared_ptr<AggregatorSensorBase>>& protoOutputs, inputMode_t inputMode) {
......
//================================================================================
// Name : JobTSAggregatorConfigurator.h
// Name : PerSystSqlConfigurator.h
// Author : Carla Guillen
// Contact : info@dcdb.it
// Copyright : Leibniz Supercomputing Centre
......@@ -25,33 +25,33 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//================================================================================
#ifndef ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATORCONFIGURATOR_H_
#define ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATORCONFIGURATOR_H_
#ifndef ANALYTICS_OPERATORS_PERSYSTSQL_PERSYSTSQLOPERATORCONFIGURATOR_H_
#define ANALYTICS_OPERATORS_PERSYSTSQL_PERSYSTSQLOPERATORCONFIGURATOR_H_
#include "../../includes/JobOperatorConfiguratorTemplate.h"
#include "../../includes/UnitTemplate.h"
#include "../aggregator/AggregatorSensorBase.h"
#include "../aggregator/JobAggregatorOperator.h"
#include "../smucngperf/SMUCSensorBase.h"
#include "JobTSAggregatorOperator.h"
#include "PerSystSqlOperatorOperator.h"
class JobTSAggregatorConfigurator: public JobOperatorConfiguratorTemplate<JobTSAggregatorOperator, AggregatorSensorBase> {
class PerSystSqlConfigurator: public JobOperatorConfiguratorTemplate<PerSystSqlOperator, AggregatorSensorBase> {
public:
JobTSAggregatorConfigurator();
virtual ~JobTSAggregatorConfigurator();
PerSystSqlConfigurator();
virtual ~PerSystSqlConfigurator();
private:
void sensorBase(AggregatorSensorBase& s, CFG_VAL config) override;
void operatorAttributes(JobTSAggregatorOperator& op, CFG_VAL config) override;
void operatorAttributes(PerSystSqlOperator& op, CFG_VAL config) override;
bool unit(UnitTemplate<AggregatorSensorBase>& u) override;
bool readUnits(JobTSAggregatorOperator& op, std::vector<shared_ptr<AggregatorSensorBase>>& protoInputs, std::vector<shared_ptr<AggregatorSensorBase>>& protoOutputs, inputMode_t inputMode);
bool readUnits(PerSystSqlOperator& op, std::vector<shared_ptr<AggregatorSensorBase>>& protoInputs, std::vector<shared_ptr<AggregatorSensorBase>>& protoOutputs, inputMode_t inputMode);
};
extern "C" OperatorConfiguratorInterface* create() {
return new JobTSAggregatorConfigurator;
return new PerSystSqlConfigurator;
}
extern "C" void destroy(OperatorConfiguratorInterface* c) {
delete c;
}
#endif /* ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATORCONFIGURATOR_H_ */
#endif /* ANALYTICS_OPERATORS_PERSYSTSQL_PERSYSTSQLOPERATORCONFIGURATOR_H_ */
//================================================================================
// Name : JobTSAggregatorOperator.cpp
// Name : PerSystSqlOperator.cpp
// Author : Carla Guillen
// Contact : info@dcdb.it
// Copyright : Leibniz Supercomputing Centre
......@@ -25,7 +25,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//================================================================================
#include "JobTSAggregatorOperator.h"
#include "PerSystSqlOperatorOperator.h"
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/trivial.hpp>
......@@ -41,14 +41,14 @@
#include "../../includes/CommonStatistics.h"
#include "../../includes/QueryEngine.h"
JobTSAggregatorOperator::JobTSAggregatorOperator(const std::string& name) :
PerSystSqlOperator::PerSystSqlOperator(const std::string& name) :
OperatorTemplate(name), JobOperatorTemplate(name), number_of_even_quantiles(0) {
}
JobTSAggregatorOperator::~JobTSAggregatorOperator() {
PerSystSqlOperator::~PerSystSqlOperator() {
}
void JobTSAggregatorOperator::compute(U_Ptr unit, qeJobData& jobData) {
void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
// Clearing the buffer, if already allocated
_buffer.clear();
size_t elCtr=0;
......@@ -72,7 +72,7 @@ void JobTSAggregatorOperator::compute(U_Ptr unit, qeJobData& jobData) {
compute_internal(unit, _buffer);
}
void JobTSAggregatorOperator::compute_internal(U_Ptr unit, vector<reading_t> buffer) {
void PerSystSqlOperator::compute_internal(U_Ptr unit, vector<reading_t> buffer) {
_quantileSensors.clear();
reading_t reading;
AggregatorSensorBase::aggregationOps_t op;
......@@ -121,7 +121,7 @@ void JobTSAggregatorOperator::compute_internal(U_Ptr unit, vector<reading_t> buf
}
}
void JobTSAggregatorOperator::compute(U_Ptr unit){
void PerSystSqlOperator::compute(U_Ptr unit){
//nothing here!
}
......
//================================================================================
// Name : JobTSAggregatorOperator.h
// Name : PerSystSqlOperator.h
// Author : Carla Guillen
// Contact : info@dcdb.it
// Copyright : Leibniz Supercomputing Centre
......@@ -25,8 +25,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//================================================================================
#ifndef ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATOROPERATOR_H_
#define ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATOROPERATOR_H_
#ifndef ANALYTICS_OPERATORS_PERSYSTSQL_PERSYSTSQLOPERATOROPERATOR_H_
#define ANALYTICS_OPERATORS_PERSYSTSQL_PERSYSTSQLOPERATOROPERATOR_H_
#include <vector>
......@@ -34,10 +34,10 @@
#include "../../includes/JobOperatorTemplate.h"
#include "../aggregator/AggregatorSensorBase.h"
class JobTSAggregatorOperator: public JobOperatorTemplate<AggregatorSensorBase>{
class PerSystSqlOperator: public JobOperatorTemplate<AggregatorSensorBase>{
public:
JobTSAggregatorOperator(const std::string& name);
virtual ~JobTSAggregatorOperator();
PerSystSqlOperator(const std::string& name);
virtual ~PerSystSqlOperator();
void compute(U_Ptr unit, qeJobData& jobData) override;
unsigned int getNumberOfEvenQuantiles() const {
......@@ -68,4 +68,4 @@ float severity_formula3(float metric, float threshold, float exponent);
float severity_memory(float metric, float threshold, float max_memory);
constexpr float severity_noformula(){return 0;} //No severity
#endif /* ANALYTICS_OPERATORS_PERSYSTSQL_JOBTSAGGREGATOROPERATOR_H_ */
#endif /* ANALYTICS_OPERATORS_PERSYSTSQL_PERSYSTSQLOPERATOROPERATOR_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment