mirror of
https://github.com/clearml/clearml
synced 2025-02-24 13:17:03 +00:00
Optimize requirements
This commit is contained in:
parent
7eb27096ee
commit
31a0867ac9
@ -30,4 +30,3 @@ six>=1.11.0
|
||||
tqdm>=4.19.5
|
||||
typing>=3.6.4
|
||||
urllib3>=1.22
|
||||
watchdog>=0.8.0
|
||||
|
@ -20,7 +20,6 @@ from pyparsing import (
|
||||
ParseSyntaxException,
|
||||
)
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from watchdog.observers import Observer
|
||||
|
||||
from .bucket_config import S3BucketConfig
|
||||
from .defs import (
|
||||
@ -36,7 +35,6 @@ from .defs import is_config_file
|
||||
from .entry import Entry, NotSet
|
||||
from .errors import ConfigurationError
|
||||
from .log import initialize as initialize_log, logger
|
||||
from .reloader import ConfigReloader
|
||||
from .utils import get_options
|
||||
|
||||
try:
|
||||
@ -83,7 +81,6 @@ class Config(object):
|
||||
verbose=True,
|
||||
relative_to=None,
|
||||
app=None,
|
||||
watch=False,
|
||||
is_server=False,
|
||||
**_
|
||||
):
|
||||
@ -94,12 +91,7 @@ class Config(object):
|
||||
self._config = ConfigTree()
|
||||
self._env = env or os.environ.get("TRAINS_ENV", Environment.default)
|
||||
self.config_paths = set()
|
||||
self.watch = watch
|
||||
self.is_server = is_server
|
||||
if watch:
|
||||
self.observer = Observer()
|
||||
self.observer.start()
|
||||
self.handler = ConfigReloader(self)
|
||||
|
||||
if self._verbose:
|
||||
print("Config env:%s" % str(self._env))
|
||||
@ -138,9 +130,6 @@ class Config(object):
|
||||
|
||||
self.roots = list(map(normalize, module_paths))
|
||||
self.reload()
|
||||
if self.watch:
|
||||
for path in self.config_paths:
|
||||
self.observer.schedule(self.handler, str(path), recursive=True)
|
||||
|
||||
def _reload(self):
|
||||
env = self._env
|
||||
@ -288,9 +277,6 @@ class Config(object):
|
||||
print("No config in %s" % str(conf_root))
|
||||
return conf
|
||||
|
||||
if self.watch:
|
||||
self.config_paths.add(conf_root)
|
||||
|
||||
if verbose:
|
||||
print("Loading config from %s" % str(conf_root))
|
||||
for root, dirs, files in os.walk(str(conf_root)):
|
||||
|
@ -1,32 +0,0 @@
|
||||
import logging
|
||||
|
||||
from watchdog.events import FileSystemEventHandler, FileCreatedEvent, FileDeletedEvent, FileModifiedEvent, \
|
||||
FileMovedEvent
|
||||
|
||||
from .defs import is_config_file
|
||||
from .log import logger
|
||||
|
||||
|
||||
log = logger(__file__)
|
||||
log.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
class ConfigReloader(FileSystemEventHandler):
|
||||
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
|
||||
def reload(self):
|
||||
try:
|
||||
self.config.reload()
|
||||
except Exception as ex:
|
||||
log.warning('failed loading configuration: %s: %s', type(ex), ex)
|
||||
|
||||
def on_any_event(self, event):
|
||||
if not (
|
||||
is_config_file(event.src_path) and
|
||||
isinstance(event, (FileCreatedEvent, FileDeletedEvent, FileModifiedEvent, FileMovedEvent))
|
||||
):
|
||||
return
|
||||
log.debug('reloading configuration - triggered by %s', event)
|
||||
self.reload()
|
Loading…
Reference in New Issue
Block a user