The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit b7e056b1 authored by Alessio Netti's avatar Alessio Netti
Browse files

dcdbquery: Wintermute operations can be queried like normal operations

parent afcdad6e
......@@ -103,6 +103,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
for (queryMap_t::iterator it=start; it!=stop; it++) {
switch(it->second.operation) {
case DCDB_OP_NONE:
case DCDB_OP_WINTERMUTE:
std::cout << ",Value";
break;
case DCDB_OP_DELTA:
......@@ -176,6 +177,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
bool resultOk = false;
switch(it->second.operation) {
case DCDB_OP_NONE:
case DCDB_OP_WINTERMUTE:
if (scaleAndConvert(value, baseScalingFactor, it->second.scalingFactor, baseUnit, it->second.unit)) {
result = value;
resultOk = true;
......@@ -263,8 +265,8 @@ void DCDBQuery::parseSensorSpecification(const std::string sensor, std::string&
} else if (boost::iequals(functName, "integral")) {
queryCfg.operation = DCDB_OP_INTEGRAL;
} else {
queryCfg.operation = DCDB_OP_UNKNOWN;
std::cerr << "Unknown sensor operation: " << functName << std::endl;
queryCfg.operation = DCDB_OP_WINTERMUTE;
queryCfg.wintermuteOp = functName;
}
if (queryCfg.operation != DCDB_OP_UNKNOWN) {
......@@ -293,13 +295,25 @@ void DCDBQuery::prepareQuery(std::list<std::string> sensors) {
sensorConfig.getPublicSensorsByWildcard(publicSensors, sensorName.c_str());
if (publicSensors.size() > 0) {
for (auto sen: publicSensors) {
if(queryCfg.operation == DCDB_OP_WINTERMUTE) {
if(sen.operations.find(queryCfg.wintermuteOp) != sen.operations.end()) {
sen.name = sen.name + queryCfg.wintermuteOp;
sen.pattern = sen.pattern + queryCfg.wintermuteOp;
} else {
std::cerr << "Unknown sensor operation: " << queryCfg.wintermuteOp << std::endl;
continue;
}
}
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(sen, queryCfg));
}
} else {
DCDB::PublicSensor pS;
pS.name = sensorName;
pS.pattern = sensorName;
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(pS, queryCfg));
if(queryCfg.operation != DCDB_OP_WINTERMUTE)
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(pS, queryCfg));
else
std::cerr << "Unknown sensor operation: " << queryCfg.wintermuteOp << std::endl;
}
}
}
......@@ -325,17 +339,29 @@ void DCDBQuery::prepareQuery(std::list<std::string> sensors, std::list<std::stri
sensorConfig.getPublicSensorsByWildcard(publicSensors, s.c_str());
if (publicSensors.size() > 0) {
for (auto sen: publicSensors) {
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(sen, queryCfg));
if(queryCfg.operation == DCDB_OP_WINTERMUTE) {
if(sen.operations.find(queryCfg.wintermuteOp) != sen.operations.end()) {
sen.name = sen.name + queryCfg.wintermuteOp;
sen.pattern = sen.pattern + queryCfg.wintermuteOp;
} else {
std::cerr << "Unknown sensor operation: " << queryCfg.wintermuteOp << std::endl;
continue;
}
}
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(sen, queryCfg));
}
} else {
DCDB::PublicSensor pS;
pS.name = s;
pS.pattern = s;
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(pS, queryCfg));
if(queryCfg.operation != DCDB_OP_WINTERMUTE)
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(pS, queryCfg));
else
std::cerr << "Unknown sensor operation: " << queryCfg.wintermuteOp << std::endl;
}
}
}
}
}
}
void DCDBQuery::execute() {
......
......@@ -51,6 +51,7 @@ typedef enum {
DCDB_OP_DELTAT,
DCDB_OP_DERIVATIVE,
DCDB_OP_INTEGRAL,
DCDB_OP_WINTERMUTE,
DCDB_OP_UNKNOWN,
} DCDB_OP_TYPE;
......@@ -58,6 +59,7 @@ typedef struct queryConfig {
double scalingFactor;
DCDB::Unit unit;
DCDB_OP_TYPE operation;
std::string wintermuteOp;
} queryConfig_t;
typedef std::multimap<DCDB::PublicSensor, queryConfig_t> queryMap_t;
......
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