From 368cbf299b8b05e2bb7c15ed1c9ee5776ec98913 Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Fri, 13 Sep 2024 16:38:46 +0000 Subject: [PATCH] Pre-merge Cosmetic changes --- .gitignore | 2 +- src/analytics/backend/requirements.in | 2 +- src/analytics/frontend/__init__.py | 1 - .../frontend/client/AnalyticsFrontendClient.py | 2 +- src/analytics/frontend/requirements.in | 2 +- .../frontend/service/AnalyticsFrontendService.py | 2 +- src/analytics/frontend/service/__init__.py | 1 - src/analytics/frontend/tests/__init__.py | 14 ++++++++++++++ src/analytics/requirements.in | 2 +- src/analytics/tests/__init__.py | 14 ++++++++++++++ src/kpi_manager/database/KpiEngine.py | 6 +----- 11 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 src/analytics/frontend/tests/__init__.py create mode 100644 src/analytics/tests/__init__.py diff --git a/.gitignore b/.gitignore index 6a53f106e..e1f87cfd3 100644 --- a/.gitignore +++ b/.gitignore @@ -178,4 +178,4 @@ libyang/ **/logs/*.log.* # PySpark checkpoints -src/analytics/.spark/* \ No newline at end of file +src/analytics/.spark/* diff --git a/src/analytics/backend/requirements.in b/src/analytics/backend/requirements.in index e2917029e..9df678fe8 100644 --- a/src/analytics/backend/requirements.in +++ b/src/analytics/backend/requirements.in @@ -13,4 +13,4 @@ # limitations under the License. pyspark==3.5.2 -confluent-kafka==2.3.* \ No newline at end of file +confluent-kafka==2.3.* diff --git a/src/analytics/frontend/__init__.py b/src/analytics/frontend/__init__.py index 234a1af65..3ee6f7071 100644 --- a/src/analytics/frontend/__init__.py +++ b/src/analytics/frontend/__init__.py @@ -1,4 +1,3 @@ - # Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/analytics/frontend/client/AnalyticsFrontendClient.py b/src/analytics/frontend/client/AnalyticsFrontendClient.py index bfa8cae45..90e95d661 100644 --- a/src/analytics/frontend/client/AnalyticsFrontendClient.py +++ b/src/analytics/frontend/client/AnalyticsFrontendClient.py @@ -65,4 +65,4 @@ class AnalyticsFrontendClient: LOGGER.debug('SelectAnalyzers: {:s}'.format(grpc_message_to_json_string(request))) response = self.stub.SelectAnalyzers(request) LOGGER.debug('SelectAnalyzers result: {:s}'.format(grpc_message_to_json_string(response))) - return response \ No newline at end of file + return response diff --git a/src/analytics/frontend/requirements.in b/src/analytics/frontend/requirements.in index 20000420c..d81b9ddbe 100644 --- a/src/analytics/frontend/requirements.in +++ b/src/analytics/frontend/requirements.in @@ -17,4 +17,4 @@ confluent-kafka==2.3.* psycopg2-binary==2.9.* SQLAlchemy==1.4.* sqlalchemy-cockroachdb==1.4.* -SQLAlchemy-Utils==0.38.* \ No newline at end of file +SQLAlchemy-Utils==0.38.* diff --git a/src/analytics/frontend/service/AnalyticsFrontendService.py b/src/analytics/frontend/service/AnalyticsFrontendService.py index e702c0144..42a7fc9b6 100644 --- a/src/analytics/frontend/service/AnalyticsFrontendService.py +++ b/src/analytics/frontend/service/AnalyticsFrontendService.py @@ -25,4 +25,4 @@ class AnalyticsFrontendService(GenericGrpcService): self.analytics_frontend_servicer = AnalyticsFrontendServiceServicerImpl() def install_servicers(self): - add_AnalyticsFrontendServiceServicer_to_server(self.analytics_frontend_servicer, self.server) \ No newline at end of file + add_AnalyticsFrontendServiceServicer_to_server(self.analytics_frontend_servicer, self.server) diff --git a/src/analytics/frontend/service/__init__.py b/src/analytics/frontend/service/__init__.py index 234a1af65..3ee6f7071 100644 --- a/src/analytics/frontend/service/__init__.py +++ b/src/analytics/frontend/service/__init__.py @@ -1,4 +1,3 @@ - # Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/analytics/frontend/tests/__init__.py b/src/analytics/frontend/tests/__init__.py new file mode 100644 index 000000000..3ee6f7071 --- /dev/null +++ b/src/analytics/frontend/tests/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/src/analytics/requirements.in b/src/analytics/requirements.in index 98cf96710..8ff30ddaa 100644 --- a/src/analytics/requirements.in +++ b/src/analytics/requirements.in @@ -18,4 +18,4 @@ confluent-kafka==2.3.* psycopg2-binary==2.9.* SQLAlchemy==1.4.* sqlalchemy-cockroachdb==1.4.* -SQLAlchemy-Utils==0.38.* \ No newline at end of file +SQLAlchemy-Utils==0.38.* diff --git a/src/analytics/tests/__init__.py b/src/analytics/tests/__init__.py new file mode 100644 index 000000000..3ee6f7071 --- /dev/null +++ b/src/analytics/tests/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/src/kpi_manager/database/KpiEngine.py b/src/kpi_manager/database/KpiEngine.py index dff406de6..0fce7e3d3 100644 --- a/src/kpi_manager/database/KpiEngine.py +++ b/src/kpi_manager/database/KpiEngine.py @@ -16,8 +16,6 @@ import logging, sqlalchemy from common.Settings import get_setting LOGGER = logging.getLogger(__name__) - -# CRDB_URI_TEMPLATE = 'cockroachdb://{:s}:{:s}@127.0.0.1:{:s}/{:s}?sslmode={:s}' CRDB_URI_TEMPLATE = 'cockroachdb://{:s}:{:s}@cockroachdb-public.{:s}.svc.cluster.local:{:s}/{:s}?sslmode={:s}' class KpiEngine: @@ -33,12 +31,10 @@ class KpiEngine: CRDB_SSLMODE = get_setting('CRDB_SSLMODE') crdb_uri = CRDB_URI_TEMPLATE.format( CRDB_USERNAME, CRDB_PASSWORD, CRDB_NAMESPACE, CRDB_SQL_PORT, CRDB_DATABASE, CRDB_SSLMODE) - # crdb_uri = CRDB_URI_TEMPLATE.format( - # CRDB_USERNAME, CRDB_PASSWORD, CRDB_SQL_PORT, CRDB_DATABASE, CRDB_SSLMODE) try: engine = sqlalchemy.create_engine(crdb_uri, echo=False) LOGGER.info(' KpiDBmanager initalized with DB URL: {:}'.format(crdb_uri)) except: # pylint: disable=bare-except # pragma: no cover LOGGER.exception('Failed to connect to database: {:s}'.format(str(crdb_uri))) return None # type: ignore - return engine + return engine -- GitLab