Fix build failing due to missing session

This commit is contained in:
allegroai 2020-05-31 14:02:42 +03:00
parent cc99077c92
commit 566427d550
4 changed files with 11 additions and 10 deletions

View File

@ -1887,6 +1887,7 @@ class Worker(ServiceCommandSection):
global_package_manager_params = dict( global_package_manager_params = dict(
interpreter=executable_name, interpreter=executable_name,
session=self._session,
) )
if not self.is_conda and standalone_mode: if not self.is_conda and standalone_mode:

View File

@ -1,22 +1,24 @@
import sys import sys
from itertools import chain from itertools import chain
from typing import Text from typing import Text, Optional
from trains_agent.definitions import PIP_EXTRA_INDICES, PROGRAM_NAME from trains_agent.definitions import PIP_EXTRA_INDICES, PROGRAM_NAME
from trains_agent.helper.package.base import PackageManager from trains_agent.helper.package.base import PackageManager
from trains_agent.helper.process import Argv, DEVNULL from trains_agent.helper.process import Argv, DEVNULL
from trains_agent.session import Session
class SystemPip(PackageManager): class SystemPip(PackageManager):
indices_args = None indices_args = None
def __init__(self, interpreter=None): def __init__(self, interpreter=None, session=None):
# type: (Text) -> () # type: (Optional[Text], Optional[Session]) -> ()
""" """
Program interface to the system pip. Program interface to the system pip.
""" """
self._bin = interpreter or sys.executable self._bin = interpreter or sys.executable
self.session = session
@property @property
def bin(self): def bin(self):

View File

@ -15,19 +15,17 @@ class VirtualenvPip(SystemPip, PackageManager):
Program interface to virtualenv pip. Program interface to virtualenv pip.
Must be given either path to virtualenv or source command. Must be given either path to virtualenv or source command.
Either way, ``self.source`` is exposed. Either way, ``self.source`` is exposed.
:param session: a Session object for communication
:param python: interpreter path :param python: interpreter path
:param path: path of virtual environment to create/manipulate :param path: path of virtual environment to create/manipulate
:param python: python version :param python: python version
:param interpreter: path of python interpreter :param interpreter: path of python interpreter
""" """
super(VirtualenvPip, self).__init__( super(VirtualenvPip, self).__init__(
interpreter session=session,
or Path( interpreter=interpreter or Path(
path, path, select_for_platform(linux="bin/python", windows="scripts/python.exe"))
select_for_platform(linux="bin/python", windows="scripts/python.exe"),
) )
)
self.session = session
self.path = path self.path = path
self.requirements_manager = requirements_manager self.requirements_manager = requirements_manager
self.python = python self.python = python

View File

@ -22,7 +22,7 @@ class RequirementsTranslator(object):
self.enabled = config["agent.pip_download_cache.enabled"] self.enabled = config["agent.pip_download_cache.enabled"]
Path(self.cache_dir).mkdir(parents=True, exist_ok=True) Path(self.cache_dir).mkdir(parents=True, exist_ok=True)
self.config = Config() self.config = Config()
self.pip = SystemPip(interpreter=interpreter) self.pip = SystemPip(interpreter=interpreter, session=self._session)
def download(self, url): def download(self, url):
self.pip.download_package(url, cache_dir=self.cache_dir) self.pip.download_package(url, cache_dir=self.cache_dir)