Skip to content

Commit

Permalink
Forgot one area for Mamba 2+
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-intel committed Sep 27, 2024
1 parent c2e7e6d commit 416afc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
18 changes: 9 additions & 9 deletions metaflow_extensions/netflix_ext/plugins/conda/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _modified_logger(*args: Any, **kwargs: Any):
self._mode = mode
self._bins = None # type: Optional[Dict[str, Optional[str]]]
self._conda_executable_type = None # type: Optional[str]
self._is_non_conda_exec = False # type: bool
self.is_non_conda_exec = False # type: bool

self._have_micromamba_server = False # type: bool
self._micromamba_server_port = None # type: Optional[int]
Expand Down Expand Up @@ -272,7 +272,7 @@ def call_conda(
if (
args
and args[0] not in ("package", "info")
and (self._is_non_conda_exec or binary == "micromamba")
and (self.is_non_conda_exec or binary == "micromamba")
):
args.extend(["-r", self.root_prefix, "--json"])
debug.conda_exec("Conda call: %s" % str([self._bins[binary]] + args))
Expand Down Expand Up @@ -1910,7 +1910,7 @@ def _ensure_remote_conda(self):
self._bins = {"conda": self._ensure_micromamba()}
self._bins["micromamba"] = self._bins["conda"]
self._conda_executable_type = "micromamba"
self._is_non_conda_exec = True
self.is_non_conda_exec = True

def _install_remote_conda(self):
# We download the installer and return a path to it
Expand Down Expand Up @@ -1961,7 +1961,7 @@ def _install_remote_conda(self):
os.sync()
self._bins = {"conda": final_path, "micromamba": final_path}
self._conda_executable_type = "micromamba"
self._is_non_conda_exec = True
self.is_non_conda_exec = True

def _validate_conda_installation(self) -> Optional[Exception]:
# If this is installed in CONDA_LOCAL_PATH look for special marker
Expand Down Expand Up @@ -2034,7 +2034,7 @@ def _validate_conda_installation(self) -> Optional[Exception]:
self._install_message_for_resolver("micromamba")
)
else:
self._is_non_conda_exec = True
self.is_non_conda_exec = True
elif "mamba version" in self._info_no_lock:
# Mamba 2.0.0 has mamba version but no conda_version
if parse_version(self._info_no_lock["mamba version"]) < parse_version(
Expand All @@ -2044,7 +2044,7 @@ def _validate_conda_installation(self) -> Optional[Exception]:
self._install_message_for_resolver("mamba")
)
else:
self._is_non_conda_exec = True
self.is_non_conda_exec = True
else:
if parse_version(self._info_no_lock["conda_version"]) < parse_version(
"4.14.0"
Expand Down Expand Up @@ -2111,7 +2111,7 @@ def _check_match(dir_name: str) -> Optional[EnvID]:
self._remove(os.path.basename(dir_name))
return None

if self._is_non_conda_exec or CONDA_LOCAL_PATH is not None or CONDA_TEST:
if self.is_non_conda_exec or CONDA_LOCAL_PATH is not None or CONDA_TEST:
# Micromamba (or Mamba 2.0+) does not record created environments so we look
# around for them
# in the root env directory. We also do this if had a local installation
Expand Down Expand Up @@ -2423,7 +2423,7 @@ def _create(self, env: ResolvedEnvironment, env_name: str) -> str:
"--offline",
"--no-deps",
]
if self._is_non_conda_exec:
if self.is_non_conda_exec:
# Micromamba (some versions) seem to have a bug when compiling .py files.
# In some circumstances, it just hangs forever. We avoid this by not
# compiling any file and letting things get compiled lazily. This may
Expand Down Expand Up @@ -2466,7 +2466,7 @@ def _create(self, env: ResolvedEnvironment, env_name: str) -> str:
"--no-deps",
"--no-input",
]
if self._is_non_conda_exec:
if self.is_non_conda_exec:
# Be consistent with what we install with micromamba
arg_list.append("--no-compile")
arg_list.extend(["-r", pypi_list.name])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def resolve(
# - actions:
# - FETCH: List of objects to fetch -- this is where we get hash and URL
# - LINK: Packages to actually install (in that order)
# On micromamba, we can just use the LINK blob since it has all information we need
# On micromamba (or Mamba 2+), we can just use the LINK blob since it has all
# information we need
if not conda_result["success"]:
print(
"Pretty-printed Conda create result:\n%s" % conda_result,
Expand All @@ -104,7 +105,7 @@ def resolve(
"Could not resolve environment -- see above pretty-printed error."
)

if self._conda.conda_executable_type == "micromamba":
if self._conda.is_non_conda_exec:
for lnk in conda_result["actions"]["LINK"]:
parse_result = parse_explicit_url_conda(
"%s#%s" % (lnk["url"], lnk["md5"])
Expand Down

0 comments on commit 416afc1

Please sign in to comment.