mirror of
https://github.com/clearml/clearml-agent
synced 2025-03-03 18:52:22 +00:00
Fix get_task_session()
may cause an old copy of the APIClient
to be used containing a reference to the previous session
This commit is contained in:
parent
6e7fb5f331
commit
396abf13b6
@ -958,6 +958,7 @@ class Worker(ServiceCommandSection):
|
|||||||
if not (result.ok() and result.response):
|
if not (result.ok() and result.response):
|
||||||
return
|
return
|
||||||
new_session = copy(session)
|
new_session = copy(session)
|
||||||
|
new_session.api_client = None
|
||||||
new_session.set_auth_token(result.response.token)
|
new_session.set_auth_token(result.response.token)
|
||||||
return new_session
|
return new_session
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class Session(_Session):
|
|||||||
if os.path.exists(os.path.expanduser(os.path.expandvars(f))):
|
if os.path.exists(os.path.expanduser(os.path.expandvars(f))):
|
||||||
self._config_file = f
|
self._config_file = f
|
||||||
break
|
break
|
||||||
self.api_client = APIClient(session=self, api_version="2.5")
|
self._api_client = None
|
||||||
# HACK make sure we have python version to execute,
|
# HACK make sure we have python version to execute,
|
||||||
# if nothing was specific, use the one that runs us
|
# if nothing was specific, use the one that runs us
|
||||||
def_python = ConfigValue(self.config, "agent.default_python")
|
def_python = ConfigValue(self.config, "agent.default_python")
|
||||||
@ -167,6 +167,16 @@ class Session(_Session):
|
|||||||
if not kwargs.get('only_load_config'):
|
if not kwargs.get('only_load_config'):
|
||||||
self.create_cache_folders()
|
self.create_cache_folders()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def api_client(self):
|
||||||
|
if self._api_client is None:
|
||||||
|
self._api_client = APIClient(session=self, api_version="2.5")
|
||||||
|
return self._api_client
|
||||||
|
|
||||||
|
@api_client.setter
|
||||||
|
def api_client(self, value):
|
||||||
|
self._api_client = value
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_logger(name):
|
def get_logger(name):
|
||||||
logger = logging.getLogger(name)
|
logger = logging.getLogger(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user