Unverified Commit 1e80301f authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

set logging level to INFO



Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 9d5b017e
Pipeline #16742 passed with stages
in 4 minutes and 17 seconds
...@@ -26,8 +26,26 @@ ...@@ -26,8 +26,26 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from mediametadatatodb_app.resources.MediametadataToDB import MediametadataToDB from mediametadatatodb_app.resources.MediametadataToDB import MediametadataToDB
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
logging.info("Starting up")
MediametadataToDB.run() MediametadataToDB.run()
logging.info("Shutting down")
...@@ -39,6 +39,19 @@ ...@@ -39,6 +39,19 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import json import json
import logging import logging
...@@ -255,8 +268,7 @@ def _write_values_in_db(mariadb_cursor, record_values_for_db): ...@@ -255,8 +268,7 @@ def _write_values_in_db(mariadb_cursor, record_values_for_db):
class MediametadataToDB: class MediametadataToDB:
@staticmethod def run(self):
def run():
""" """
Import media metadata to mariaDB Import media metadata to mariaDB
This service should not return anything but run forever. This service should not return anything but run forever.
...@@ -315,18 +327,18 @@ class MediametadataToDB: ...@@ -315,18 +327,18 @@ class MediametadataToDB:
status = 'It was not possible to consume the Kafka messages.' + '\n' + str(ex) status = 'It was not possible to consume the Kafka messages.' + '\n' + str(ex)
logging.error(status) logging.error(status)
return {"info": status}, 500
def __init__(self): def __init__(self):
# TODO : maybe take that to a configuration (development vs pod running in # TODO : maybe take that to a configuration (development vs pod running in
# k8s cluster) # k8s cluster)
try: try:
# to be used when inside a kubernetes cluster # to be used when inside a kubernetes cluster
config.load_incluster_config() config.load_incluster_config()
logging.info("Loading incluster config")
except K8sConfigException: except K8sConfigException:
try: try:
# use .kube directory # use .kube directory
# for local development # for local development
config.load_kube_config() config.load_kube_config()
logging.info("Loading kube config (for local development)")
except K8sConfigException: except K8sConfigException:
logging.error("No kubernetes cluster defined") logging.error("No kubernetes cluster defined")
Supports Markdown
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