Skip to content

Commit

Permalink
wip: fixed remote execution pip-git-pkg support
Browse files Browse the repository at this point in the history
  • Loading branch information
saikonen committed Oct 4, 2023
1 parent 99a3d55 commit 758641d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion metaflow/plugins/pypi/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@
shutil.move(tmpfile, dest)

# Install PyPI packages.
# *.whl for regular index sources, *.zip for VCS sources
cmds.extend(
[
f"""./micromamba run --prefix {prefix} pip --disable-pip-version-check install --root-user-action=ignore --no-compile {pypi_pkgs_dir}/*.whl"""
f"""./micromamba run --prefix {prefix} pip --disable-pip-version-check install --root-user-action=ignore --no-compile {pypi_pkgs_dir}/*"""
]
)

Expand Down
18 changes: 12 additions & 6 deletions metaflow/plugins/pypi/conda_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,17 @@ def solve(id_, environment, type_):
)

def cache(storage, results, type_):
def _url(url, local_path):
base, _file = os.path.split(urlparse(url).path)
_, localfile = os.path.split(local_path)
return urlparse(url).netloc + os.path.join(base, localfile)

local_packages = {
url: {
# Path to package in datastore.
"path": urlparse(url).netloc + urlparse(url).path,
# e.g. example.com/path/to/package.whl
# or example.com/path/to/package.git@123abc
"path": _url(url, local_path),
# Path to package on local disk.
"local_path": local_path,
}
Expand All @@ -117,10 +124,8 @@ def cache(storage, results, type_):
else:
# TODO: Match up with CONDA_DATASTORE_ROOT so that cache
# gets invalidated when DATASTORE is moved.
package["path"] = (
urlparse(package["url"]).netloc
+ urlparse(package["url"]).path
)
_p = package.get("wheel_name", urlparse(package["url"]).path)
package["path"] = _url(package["url"], _p)
dirty.add(id_)

list_of_path_and_filehandle = [
Expand Down Expand Up @@ -360,7 +365,8 @@ def __init__(self, filename, mode="rb", url=None):
super().__init__()
self.filename = filename
self.mode = mode
self.url = url
# Do not handle VCS url's, as they are not pointers to files that could be downloaded.
self.url = None if url.startswith("git+") else url
self._file = None
self._buffer = None
self._position = 0
Expand Down

0 comments on commit 758641d

Please sign in to comment.