Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove influxdb 1.8 as source, its dependencies and tests #234

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ lint = [

# Databases:
mongodb = ["pymongo >= 3.7.2"]
influxdb = ["influxdb-client >= 1.30.0", "influxdb >= 2.12"]
influxdb = ["influxdb-client >= 1.30.0"]
opentsdb = ["opentsdb-py >= 0.6.0"]
prometheus = ["prometheus-client >= 0.9.0"]

Expand Down
5 changes: 1 addition & 4 deletions src/powerapi/cli/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
TIMEOUT_QUERY_DEFAULT_VALUE
from powerapi.processor.pre.libvirt.libvirt_pre_processor_actor import LibvirtPreProcessorActor
from powerapi.report import HWPCReport, PowerReport, ControlReport, ProcfsReport, Report, FormulaReport
from powerapi.database import MongoDB, CsvDB, InfluxDB, OpenTSDB, SocketDB, PrometheusDB, \
from powerapi.database import MongoDB, CsvDB, OpenTSDB, SocketDB, PrometheusDB, \
VirtioFSDB, FileDB
from powerapi.puller import PullerActor
from powerapi.pusher import PusherActor
Expand Down Expand Up @@ -186,9 +186,6 @@ def __init__(self, component_group_name: str):
current_path=os.getcwd() if 'directory' not in db_config else db_config[
'directory'],
files=[] if 'files' not in db_config else db_config['files']),
'influxdb': lambda db_config: InfluxDB(report_type=db_config['model'], uri=db_config['uri'],
port=db_config['port'], db_name=db_config['db'],
tags=gen_tag_list(db_config)),
'influxdb2': lambda db_config: InfluxDB2(report_type=db_config['model'], url=db_config['uri'],
org=db_config['org'],
bucket_name=db_config['db'], token=db_config['token'],
Expand Down
1 change: 0 additions & 1 deletion src/powerapi/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from powerapi.database.csvdb import CsvBadCommonKeysError, HeaderAreNotTheSameError
from powerapi.database.mongodb import MongoDB, MongoBadDBError
from powerapi.database.opentsdb import OpenTSDB, CantConnectToOpenTSDBException
from powerapi.database.influxdb import InfluxDB, CantConnectToInfluxDBException
from powerapi.database.influxdb2 import InfluxDB2
from powerapi.database.prometheus_db import PrometheusDB
from powerapi.database.virtiofs_db import VirtioFSDB
Expand Down
128 changes: 0 additions & 128 deletions src/powerapi/database/influxdb.py

This file was deleted.

38 changes: 1 addition & 37 deletions tests/acceptation/test_simple_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@
from tests.utils.formula.dummy import DummyFormulaActor

from tests.utils.acceptation import launch_simple_architecture, BASIC_CONFIG, SOCKET_DEPTH_LEVEL, \
INFLUX_OUTPUT_CONFIG, CSV_INPUT_OUTPUT_CONFIG
CSV_INPUT_OUTPUT_CONFIG
from tests.utils.report.hwpc import extract_rapl_reports_with_2_sockets
# noinspection PyUnresolvedReferences
from tests.utils.db.mongo import MONGO_URI, MONGO_INPUT_COLLECTION_NAME, MONGO_OUTPUT_COLLECTION_NAME, \
MONGO_DATABASE_NAME, mongo_database
# noinspection PyUnresolvedReferences
from tests.utils.db.influx import INFLUX_DBNAME, INFLUX_URI, get_all_reports, influx_database
# noinspection PyUnresolvedReferences
from tests.utils.db.csv import ROOT_PATH, OUTPUT_PATH, files
from tests.utils.db.socket import ClientThread, ClientThreadDelay

Expand Down Expand Up @@ -124,40 +122,6 @@ def influxdb_content():
return []


def check_influx_db(influx_client):
"""
Verify that output DB has the correct information
"""
mongo = pymongo.MongoClient(INFLUX_URI)
c_input = mongo[MONGO_DATABASE_NAME][MONGO_INPUT_COLLECTION_NAME]
c_output = get_all_reports(influx_client, INFLUX_DBNAME)

assert len(c_output) == c_input.count_documents({})

for report in c_input.find():
influx_client.switch_database(INFLUX_DBNAME)

query_result = list(influx_client.query(
'SELECT * FROM "power_consumption" WHERE "time" = \'' + report['timestamp'] + 'Z\'').get_points())
assert len(query_result) == 1


def test_run_mongo_to_influx(mongo_database, influx_database, shutdown_system):
"""
Check that report are correctly stored into an output influx database.
The input source is a mongo database.
"""
supervisor = Supervisor()
launch_simple_architecture(config=INFLUX_OUTPUT_CONFIG, supervisor=supervisor, hwpc_depth_level=SOCKET_DEPTH_LEVEL,
formula_class=DummyFormulaActor)

time.sleep(4)

check_influx_db(influx_database)

supervisor.kill_actors()


##############
# CSV to CSV #
##############
Expand Down
100 changes: 0 additions & 100 deletions tests/integration/cli/test_generate_pusher.py

This file was deleted.

Loading