Add alias CLEARML_AGENT_DOCKER_AGENT_REPO env var for the FORCE_CLEARML_AGENT_REPO env var

This commit is contained in:
allegroai 2023-05-21 22:50:01 +03:00
parent b6ca0fa6a5
commit 1e09b88b7a
2 changed files with 9 additions and 2 deletions

View File

@ -73,6 +73,7 @@ from clearml_agent.definitions import (
ENV_FORCE_SYSTEM_SITE_PACKAGES, ENV_FORCE_SYSTEM_SITE_PACKAGES,
ENV_SERVICES_DOCKER_RESTART, ENV_SERVICES_DOCKER_RESTART,
ENV_CONFIG_BC_IN_STANDALONE, ENV_CONFIG_BC_IN_STANDALONE,
ENV_FORCE_DOCKER_AGENT_REPO,
) )
from clearml_agent.definitions import WORKING_REPOSITORY_DIR, PIP_EXTRA_INDICES from clearml_agent.definitions import WORKING_REPOSITORY_DIR, PIP_EXTRA_INDICES
from clearml_agent.errors import ( from clearml_agent.errors import (
@ -3930,6 +3931,7 @@ class Worker(ServiceCommandSection):
# if we are running a RC version, install the same version in the docker # if we are running a RC version, install the same version in the docker
# because the default latest, will be a release version (not RC) # because the default latest, will be a release version (not RC)
specify_version = '' specify_version = ''
# noinspection PyBroadException
try: try:
from clearml_agent.version import __version__ from clearml_agent.version import __version__
_version_parts = __version__.split('.') _version_parts = __version__.split('.')
@ -3938,13 +3940,15 @@ class Worker(ServiceCommandSection):
except: except:
pass pass
force_agent_repo = ENV_FORCE_DOCKER_AGENT_REPO.get()
if os.environ.get('FORCE_LOCAL_CLEARML_AGENT_WHEEL'): if os.environ.get('FORCE_LOCAL_CLEARML_AGENT_WHEEL'):
local_wheel = os.path.expanduser(os.environ.get('FORCE_LOCAL_CLEARML_AGENT_WHEEL')) local_wheel = os.path.expanduser(os.environ.get('FORCE_LOCAL_CLEARML_AGENT_WHEEL'))
docker_wheel = '/tmp/{}'.format(basename(local_wheel)) docker_wheel = '/tmp/{}'.format(basename(local_wheel))
base_cmd += ['-v', local_wheel + ':' + docker_wheel] base_cmd += ['-v', local_wheel + ':' + docker_wheel]
clearml_agent_wheel = '\"{}\"'.format(docker_wheel) clearml_agent_wheel = '\"{}\"'.format(docker_wheel)
elif os.environ.get('FORCE_CLEARML_AGENT_REPO'): elif force_agent_repo:
clearml_agent_wheel = os.environ.get('FORCE_CLEARML_AGENT_REPO') clearml_agent_wheel = force_agent_repo
else: else:
# clearml-agent{specify_version} # clearml-agent{specify_version}
clearml_agent_wheel = 'clearml-agent{specify_version}'.format(specify_version=specify_version) clearml_agent_wheel = 'clearml-agent{specify_version}'.format(specify_version=specify_version)

View File

@ -180,6 +180,9 @@ ENV_DOCKER_ARGS_HIDE_ENV = EnvironmentConfig("CLEARML_AGENT_DOCKER_ARGS_HIDE_ENV
ENV_CONFIG_BC_IN_STANDALONE = EnvironmentConfig("CLEARML_AGENT_STANDALONE_CONFIG_BC", type=bool) ENV_CONFIG_BC_IN_STANDALONE = EnvironmentConfig("CLEARML_AGENT_STANDALONE_CONFIG_BC", type=bool)
""" Maintain backwards compatible configuration when launching in standalone mode """ """ Maintain backwards compatible configuration when launching in standalone mode """
ENV_FORCE_DOCKER_AGENT_REPO = EnvironmentConfig("FORCE_CLEARML_AGENT_REPO", "CLEARML_AGENT_DOCKER_AGENT_REPO")
ENV_SERVICES_DOCKER_RESTART = EnvironmentConfig("CLEARML_AGENT_SERVICES_DOCKER_RESTART") ENV_SERVICES_DOCKER_RESTART = EnvironmentConfig("CLEARML_AGENT_SERVICES_DOCKER_RESTART")
""" """
Specify a restart value for a services agent task containers. Specify a restart value for a services agent task containers.