From 8f3517d5b6ae290460cbeb2f0c7a45e3fde9875d Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Wed, 6 Nov 2019 15:38:00 +0100 Subject: [PATCH] Remove logging code --- app/models.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/app/models.py b/app/models.py index 470e5c6a..4ccdd2ba 100644 --- a/app/models.py +++ b/app/models.py @@ -7,7 +7,6 @@ from . import db from . import login_manager import os import shutil -import logging import xml.etree.ElementTree as ET @@ -226,13 +225,10 @@ class User(UserMixin, db.Model): Delete user from database. Also delete all associated jobs and corpora files. """ - logger = logging.getLogger(__name__) delete_path = os.path.join('/mnt/opaque/', str(self.id)) - logger.warning('Delete path for user is: {}'.format(delete_path)) while os.path.exists(delete_path): try: shutil.rmtree(delete_path, ignore_errors=True) - logger.warning('Path does still exist.') except OSError: pass db.session.delete(self) @@ -383,14 +379,11 @@ class Job(db.Model): for good. See: https://docs.docker.com/engine/swarm/swarm-tutorial/delete-service/ """ - logger = logging.getLogger(__name__) delete_path = os.path.join('/mnt/opaque/', str(self.user_id), 'jobs', str(self.id)) - logger.warning('Delete path is: {}'.format(delete_path)) while os.path.exists(delete_path): try: shutil.rmtree(delete_path, ignore_errors=True) - logger.warning('Path does still exist.') except OSError: pass db.session.delete(self) @@ -412,15 +405,12 @@ class CorpusFile(db.Model): corpus_id = db.Column(db.Integer, db.ForeignKey('corpora.id')) def delete(self): - logger = logging.getLogger(__name__) - logger.warning('Called CorpusFile.delete') path = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'], self.dir, self.filename) try: os.remove(path) except: - logger.warning('[ERROR] CorpusFile.delete') return self.corpus.status = 'unprepared' db.session.delete(self) @@ -473,24 +463,15 @@ class Corpus(db.Model): 'user_id': self.user_id} def delete(self): - logger = logging.getLogger(__name__) - logger.warning('Called Corpus.delete') for corpus_file in self.files: corpus_file.delete() - logger.warning('bis hierhin und nicht weiter') - logger.warning('base_dir: {}'.format(current_app.config['OPAQUE_STORAGE_DIRECTORY'])) - logger.warning('user_id: {}'.format(self.user_id)) - logger.warning('id: {}'.format(self.id)) path = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'], str(self.user_id), 'corpora', str(self.id)) - logger.warning(path) try: - logger.warning('Try to remove {}'.format(path)) shutil.rmtree(path) except: - logger.warning('[ERROR] Corpus.delete') return db.session.delete(self) db.session.commit()