def init(self, debug=False, logging_level=logging.WARNING): """Initialisation function for workers, to set up the model and training environment""" global train_on_file train_on_file = self.train_on_file # Allow remote debugging if debug: from pdb_clone import pdbhandler pdbhandler.register() # Start logging pid = os.getpid() handler = logging.handlers.RotatingFileHandler('{}.log'.format(pid), maxBytes=1048576, backupCount=1, delay=True) logging.basicConfig(level=logging_level, handlers=[handler])
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2018-2019 Rechenzentrum, Universitaet Regensburg # GPLv3, see LICENSE # import sys try: # if pdb-clone is installed, register this process. in # case of problems, we can attach and debug. from pdb_clone import pdbhandler pdbhandler.register() except ImportError: pass if sys.argv[1] == "--master": from .http.master import run_master run_master() elif sys.argv[1] == "--machine": from .http.machine import run_machine run_machine()