mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-26 18:16:15 +00:00
parent
b367c80477
commit
3cedc104df
@ -105,6 +105,10 @@
|
|||||||
# set to True to support torch nightly build installation,
|
# set to True to support torch nightly build installation,
|
||||||
# notice: torch nightly builds are ephemeral and are deleted from time to time
|
# notice: torch nightly builds are ephemeral and are deleted from time to time
|
||||||
torch_nightly: false,
|
torch_nightly: false,
|
||||||
|
|
||||||
|
# if set to true, the agent will look for the "poetry.lock" file
|
||||||
|
# in the passed current working directory instead of the repository's root directory.
|
||||||
|
poetry_files_from_repo_working_dir: false
|
||||||
},
|
},
|
||||||
|
|
||||||
# target folder for virtual environments builds, created when executing experiment
|
# target folder for virtual environments builds, created when executing experiment
|
||||||
|
@ -2876,19 +2876,22 @@ class Worker(ServiceCommandSection):
|
|||||||
self.log_traceback(e)
|
self.log_traceback(e)
|
||||||
return freeze
|
return freeze
|
||||||
|
|
||||||
def _install_poetry_requirements(self, repo_info):
|
def _install_poetry_requirements(self, repo_info, lockfile_path):
|
||||||
# type: (Optional[RepoInfo]) -> Optional[PoetryAPI]
|
# type: (Optional[RepoInfo], Path) -> Optional[PoetryAPI]
|
||||||
if not repo_info:
|
if not repo_info:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
if not self.poetry.enabled:
|
if not self.poetry.enabled:
|
||||||
return None
|
return None
|
||||||
self.poetry.initialize(cwd=repo_info.root)
|
|
||||||
api = self.poetry.get_api(repo_info.root)
|
self.poetry.initialize(cwd=lockfile_path)
|
||||||
|
api = self.poetry.get_api(lockfile_path)
|
||||||
if api.enabled:
|
if api.enabled:
|
||||||
print('Poetry Enabled: Ignoring requested python packages, using repository poetry lock file!')
|
print('Poetry Enabled: Ignoring requested python packages, using repository poetry lock file!')
|
||||||
api.install()
|
api.install()
|
||||||
return api
|
return api
|
||||||
|
|
||||||
|
print(f"Could not find pyproject.toml or poetry.lock file in {lockfile_path} \n")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.error("failed installing poetry requirements: {}".format(ex))
|
self.log.error("failed installing poetry requirements: {}".format(ex))
|
||||||
return None
|
return None
|
||||||
@ -2919,7 +2922,10 @@ class Worker(ServiceCommandSection):
|
|||||||
"""
|
"""
|
||||||
if package_api:
|
if package_api:
|
||||||
package_api.cwd = cwd
|
package_api.cwd = cwd
|
||||||
api = self._install_poetry_requirements(repo_info)
|
|
||||||
|
files_from_working_dir = package_api.session.config.get("agent.package_manager.poetry_files_from_repo_working_dir", False)
|
||||||
|
lockfile_path = Path(repo_info.root) / (execution.working_dir if files_from_working_dir else "")
|
||||||
|
api = self._install_poetry_requirements(repo_info, lockfile_path)
|
||||||
if api:
|
if api:
|
||||||
# update back the package manager, this hack should be fixed
|
# update back the package manager, this hack should be fixed
|
||||||
if package_api == self.package_api:
|
if package_api == self.package_api:
|
||||||
|
Loading…
Reference in New Issue
Block a user