Skip to content

Commit

Permalink
Merge pull request #36 from regro/ref-again
Browse files Browse the repository at this point in the history
REF rename, add doc strings, adjust args
  • Loading branch information
beckermr authored Jun 1, 2024
2 parents f3059b9 + 93912a6 commit 7617f14
Show file tree
Hide file tree
Showing 6 changed files with 293 additions and 136 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
env:
PY_COLORS: "1"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: tests
Expand Down
26 changes: 13 additions & 13 deletions conda_forge_feedstock_check_solvable/check_solvable.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
)
from conda_forge_feedstock_check_solvable.utils import (
MAX_GLIBC_MINOR,
_clean_reqs,
_get_run_export,
apply_pins,
get_run_exports,
print_debug,
print_info,
print_warning,
suppress_conda_build_logging,
remove_reqs_by_name,
suppress_output,
)


Expand Down Expand Up @@ -99,7 +99,7 @@ def is_recipe_solvable(
{},
)
else:
print_warning("MAMBA SOLVER TIMEOUT for %s", feedstock_dir)
print_warning("SOLVER TIMEOUT for %s", feedstock_dir)
res = (
True,
[],
Expand Down Expand Up @@ -229,7 +229,7 @@ def _is_recipe_solvable_on_platform(
channel_sources = list(additional_channels) + channel_sources

print_debug(
"MAMBA: using channels %s on platform-arch %s-%s",
"SOLVER using channels %s on platform-arch %s-%s",
channel_sources,
platform,
arch,
Expand All @@ -239,7 +239,7 @@ def _is_recipe_solvable_on_platform(
# it would be used in a real build
print_debug("rendering recipe with conda build")

with suppress_conda_build_logging():
with suppress_output():
for att in range(2):
try:
if att == 1:
Expand Down Expand Up @@ -282,7 +282,7 @@ def _is_recipe_solvable_on_platform(
# now we loop through each one and check if we can solve it
# we check run and host and ignore the rest
print_debug("getting mamba solver")
with suppress_conda_build_logging():
with suppress_output():
solver = _mamba_factory(tuple(channel_sources), f"{platform}-{arch}")
build_solver = _mamba_factory(
tuple(channel_sources),
Expand All @@ -303,7 +303,7 @@ def _is_recipe_solvable_on_platform(
ign_runex_from = m.get_value("build/ignore_run_exports_from", [])

if build_req:
build_req = _clean_reqs(build_req, outnames)
build_req = remove_reqs_by_name(build_req, outnames)
_solvable, _err, build_req, build_rx = build_solver.solve(
build_req,
get_run_exports=True,
Expand Down Expand Up @@ -335,7 +335,7 @@ def _is_recipe_solvable_on_platform(
host_req = list(set(host_req) | build_rx["strong"])

if host_req:
host_req = _clean_reqs(host_req, outnames)
host_req = remove_reqs_by_name(host_req, outnames)
_solvable, _err, host_req, host_rx = solver.solve(
host_req,
get_run_exports=True,
Expand Down Expand Up @@ -363,7 +363,7 @@ def _is_recipe_solvable_on_platform(
)
if run_req:
run_req = apply_pins(run_req, host_req or [], build_req or [], outnames, m)
run_req = _clean_reqs(run_req, outnames)
run_req = remove_reqs_by_name(run_req, outnames)
_solvable, _err, _ = solver.solve(run_req, constraints=run_constrained)
solvable = solvable and _solvable
if _err is not None:
Expand All @@ -375,15 +375,15 @@ def _is_recipe_solvable_on_platform(
+ run_req
)
if tst_req:
tst_req = _clean_reqs(tst_req, outnames)
tst_req = remove_reqs_by_name(tst_req, outnames)
_solvable, _err, _ = solver.solve(tst_req, constraints=run_constrained)
solvable = solvable and _solvable
if _err is not None:
errors.append(_err)

print_info("RUN EXPORT CACHE STATUS: %s", _get_run_export.cache_info())
print_info("RUN EXPORT CACHE STATUS: %s", get_run_exports.cache_info())
print_info(
"MAMBA SOLVER MEM USAGE: %d MB",
"SOLVER MEM USAGE: %d MB",
psutil.Process().memory_info().rss // 1024**2,
)

Expand Down
10 changes: 5 additions & 5 deletions conda_forge_feedstock_check_solvable/mamba_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
MINIMUM_CUDA_VERS,
MINIMUM_OSX_64_VERS,
MINIMUM_OSX_ARM64_VERS,
_get_run_export,
_norm_spec,
convert_spec_to_conda_build,
get_run_exports,
print_debug,
print_warning,
)
Expand Down Expand Up @@ -206,8 +206,8 @@ def solve(
solver_options = [(api.SOLVER_FLAG_ALLOW_DOWNGRADE, 1)]
solver = api.Solver(self.pool, solver_options)

_specs = [_norm_spec(s) for s in specs]
_constraints = [_norm_spec(s) for s in constraints or []]
_specs = [convert_spec_to_conda_build(s) for s in specs]
_constraints = [convert_spec_to_conda_build(s) for s in constraints or []]

print_debug(
"MAMBA running solver for specs \n\n%s\nconstraints: %s\n",
Expand Down Expand Up @@ -286,7 +286,7 @@ def _get_run_exports(
for link_tuple in link_tuples:
lt_name = json.loads(link_tuple[-1])["name"]
if lt_name in names and lt_name not in ign_rex_from:
rx = _get_run_export(link_tuple)
rx = get_run_exports(link_tuple[0], link_tuple[1])
for key in rx:
rx[key] = {v for v in rx[key] if v not in ign_rex}
for key in DEFAULT_RUN_EXPORTS:
Expand Down
Loading

0 comments on commit 7617f14

Please sign in to comment.