This commit is contained in:
allegroai 2021-10-19 10:39:55 +03:00
parent 94d28ed44f
commit 0bc43a31f4
14 changed files with 37 additions and 32 deletions

View File

@ -12,7 +12,7 @@ from .datasets import Dataset
TaskTypes = Task.TaskTypes TaskTypes = Task.TaskTypes
if not PY2: if not PY2:
from .automation.controller import PipelineController from .automation.controller import PipelineController # noqa: F401
__all__ = [ __all__ = [
"__version__", "__version__",

View File

@ -265,7 +265,7 @@ class Session(TokenManager):
print("Failed getting vaults: {}".format(ex)) print("Failed getting vaults: {}".format(ex))
def _apply_config_sections(self, local_logger): def _apply_config_sections(self, local_logger):
# type: (_LocalLogger) -> None # type: (_LocalLogger) -> None # noqa: F821
default = self.config.get("sdk.apply_environment", False) default = self.config.get("sdk.apply_environment", False)
if ENV_ENABLE_ENV_CONFIG_SECTION.get(default=default): if ENV_ENABLE_ENV_CONFIG_SECTION.get(default=default):
try: try:
@ -753,8 +753,8 @@ class Session(TokenManager):
) )
class _LocalLogger: class _LocalLogger:
def __init__(self, l): def __init__(self, local_logger):
self.logger = l self.logger = local_logger
def __call__(self): def __call__(self):
if not self.logger: if not self.logger:

View File

@ -1,4 +1,4 @@
from ....config import config, deferred_config from ....config import deferred_config
class TaskStopReason(object): class TaskStopReason(object):

View File

@ -3,7 +3,7 @@ from threading import Thread, Event
from time import time from time import time
from ....config import config, deferred_config from ....config import deferred_config
from ....backend_interface.task.development.stop_signal import TaskStopSignal from ....backend_interface.task.development.stop_signal import TaskStopSignal
from ....backend_api.services import tasks from ....backend_api.services import tasks

View File

@ -13,7 +13,7 @@ from threading import Thread, Event
from .util import get_command_output, remove_user_pass_from_url from .util import get_command_output, remove_user_pass_from_url
from ....backend_api import Session from ....backend_api import Session
from ....config import config, deferred_config from ....config import deferred_config
from ....debugging import get_logger from ....debugging import get_logger
from .detectors import GitEnvDetector, GitDetector, HgEnvDetector, HgDetector, Result as DetectionResult from .detectors import GitEnvDetector, GitDetector, HgEnvDetector, HgDetector, Result as DetectionResult

View File

@ -63,7 +63,8 @@ def deferred_config(key=None, default=Config._MISSING, transform=None, multi=Non
next((ConfigSDKWrapper.get(*a) for a in multi if ConfigSDKWrapper.get(*a)), None)) next((ConfigSDKWrapper.get(*a) for a in multi if ConfigSDKWrapper.get(*a)), None))
if transform is None if transform is None
else (transform() if key is None else transform(ConfigSDKWrapper.get(key, default) if not multi else # noqa else (transform() if key is None else transform(ConfigSDKWrapper.get(key, default) if not multi else # noqa
next((ConfigSDKWrapper.get(*a) for a in multi if ConfigSDKWrapper.get(*a)), None))) next((ConfigSDKWrapper.get(*a) for a in multi
if ConfigSDKWrapper.get(*a)), None)))
) )

View File

@ -174,9 +174,9 @@ class CacheManager(object):
# check if someone else holds the lock file # check if someone else holds the lock file
locks = lock_files.get(f.name, []) locks = lock_files.get(f.name, [])
for l in locks: for lck in locks:
try: try:
a_lock = FileLock(filename=l) a_lock = FileLock(filename=lck)
a_lock.acquire(timeout=0) a_lock.acquire(timeout=0)
a_lock.release() a_lock.release()
a_lock.delete_lock_file() a_lock.delete_lock_file()

View File

@ -50,8 +50,8 @@ from .binding.matplotlib_bind import PatchedMatplotlib
from .binding.hydra_bind import PatchHydra from .binding.hydra_bind import PatchHydra
from .binding.click_bind import PatchClick from .binding.click_bind import PatchClick
from .config import ( from .config import (
config, DEV_TASK_NO_REUSE, get_is_master_node, DEBUG_SIMULATE_REMOTE_TASK, PROC_MASTER_ID_ENV_VAR, config, DEV_TASK_NO_REUSE, get_is_master_node, DEBUG_SIMULATE_REMOTE_TASK, DEV_DEFAULT_OUTPUT_URI,
DEV_DEFAULT_OUTPUT_URI, deferred_config, ) deferred_config, )
from .config import running_remotely, get_remote_task_id from .config import running_remotely, get_remote_task_id
from .config.cache import SessionCache from .config.cache import SessionCache
from .debugging.log import LoggerRoot from .debugging.log import LoggerRoot
@ -1889,10 +1889,10 @@ class Task(_Task):
Set task's script. Set task's script.
Examples: Examples:
task.set_script(repository="https://github.com/allegroai/clearml.git", task.set_script(repository='https://github.com/allegroai/clearml.git,
branch="master", branch='master',
working_dir="examples/reporting", working_dir='examples/reporting',
entry_point="artifacts.py") entry_point='artifacts.py')
:param repository: URL of remote repository. :param repository: URL of remote repository.
:param branch: Select specific repository branch / tag. :param branch: Select specific repository branch / tag.

View File

@ -40,24 +40,26 @@ class Unparser:
self.f.flush() self.f.flush()
def fill(self, text=""): def fill(self, text=""):
"Indent a piece of text, according to the current indentation level" """Indent a piece of text, according to the current indentation level"""
self.f.write("\n" + " " * self._indent + text) self.f.write("\n" + " " * self._indent + text)
def write(self, text): def write(self, text):
"Append a piece of text to the current line." """Append a piece of text to the current line."""
self.f.write(six.text_type(text)) self.f.write(six.text_type(text))
def enter(self): def enter(self):
"Print ':', and increase the indentation." """Print ':', and increase the indentation."""
self.write(":") self.write(":")
self._indent += 1 self._indent += 1
def leave(self): def leave(self):
"Decrease the indentation level." """Decrease the indentation level."""
self._indent -= 1 self._indent -= 1
def dispatch(self, tree): def dispatch(self, tree):
"Dispatcher function, dispatching tree type T to method _T." """
Dispatcher function, dispatching tree type T to method _T.
"""
if isinstance(tree, list): if isinstance(tree, list):
for t in tree: for t in tree:
self.dispatch(t) self.dispatch(t)
@ -65,12 +67,14 @@ class Unparser:
meth = getattr(self, "_" + tree.__class__.__name__) meth = getattr(self, "_" + tree.__class__.__name__)
meth(tree) meth(tree)
"""
############### Unparsing methods ###################### ############### Unparsing methods ######################
# There should be one method per concrete grammar type # # There should be one method per concrete grammar type #
# Constructors should be grouped by sum type. Ideally, # # Constructors should be grouped by sum type. Ideally, #
# this would follow the order in the grammar, but # # this would follow the order in the grammar, but #
# currently doesn't. # # currently doesn't. #
######################################################## ########################################################
"""
def _Module(self, tree): def _Module(self, tree):
for stmt in tree.body: for stmt in tree.body: