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 @@
#
# 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/>.
#
# 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
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
logging.info("Starting up")
MediametadataToDB.run()
logging.info("Shutting down")
......@@ -39,6 +39,19 @@
#
# 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/>.
#
# 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 logging
......@@ -255,8 +268,7 @@ def _write_values_in_db(mariadb_cursor, record_values_for_db):
class MediametadataToDB:
@staticmethod
def run():
def run(self):
"""
Import media metadata to mariaDB
This service should not return anything but run forever.
......@@ -315,18 +327,18 @@ class MediametadataToDB:
status = 'It was not possible to consume the Kafka messages.' + '\n' + str(ex)
logging.error(status)
return {"info": status}, 500
def __init__(self):
# TODO : maybe take that to a configuration (development vs pod running in
# k8s cluster)
try:
# to be used when inside a kubernetes cluster
config.load_incluster_config()
logging.info("Loading incluster config")
except K8sConfigException:
try:
# use .kube directory
# for local development
config.load_kube_config()
logging.info("Loading kube config (for local development)")
except K8sConfigException:
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