Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mulled: also consider non strict channel priority #19425

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/galaxy/tool_util/deps/mulled/invfile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ for i = 1, #channels do
channel_args = channel_args .. " -c '" .. channels[i] .. "'"
end

local strict_channel_priority = VAR.STRICT_CHANNEL_PRIORITY
if strict_channel_priority == '' then
strict_channel_priority = ''
else
strict_channel_priority = '--strict-channel-priority'
end

local target_args = ''
local targets = VAR.TARGETS:split(",")
for i = 1, #targets do
Expand Down Expand Up @@ -90,8 +97,9 @@ inv.task('build')
.run('/bin/sh', '-c', preinstall
.. conda_bin .. ' install '
.. channel_args .. ' '
.. strict_channel_priority .. ' '
.. target_args
.. ' --strict-channel-priority -p /usr/local --copy --yes '
.. ' -p /usr/local --copy --yes '
.. verbose
.. postinstall)
.wrap('build/dist')
Expand Down
45 changes: 32 additions & 13 deletions lib/galaxy/tool_util/deps/mulled/mulled_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ def mull_targets(
conda_install = f"""conda install {verbose} --yes {" ".join(f"'{spec}'" for spec in specs)}"""
involucro_args.extend(["-set", f"PREINSTALL=if {mamba_test} ; then {conda_install} ; fi"])

involucro_args.append(command)
if test_files:
test_bind = []
for test_file in test_files:
Expand All @@ -333,12 +332,23 @@ def mull_targets(
if os.path.exists(test_file.split(":")[0]):
test_bind.append(test_file)
if test_bind:
involucro_args.insert(6, "-set")
involucro_args.insert(7, f"TEST_BINDS={','.join(test_bind)}")
cmd = involucro_context.build_command(involucro_args)
print(f"Executing: {shlex_join(cmd)}")
involucro_args.append("-set")
involucro_args.append(f"TEST_BINDS={','.join(test_bind)}")

involucro_args_list = []
for strict_channel_priority in [True, False]:
involucro_args_list.append(involucro_args[:])
if strict_channel_priority:
involucro_args_list[-1].extend(["-set", "STRICT_CHANNEL_PRIORITY=1"])

for involucro_args in involucro_args_list:
involucro_args.append(command)

if dry_run:
cmd = involucro_context.build_command(involucro_args_list[0])
print(f"Executing: {shlex_join(cmd)}")
return 0

ensure_installed(involucro_context, True)
if singularity:
if not os.path.exists(singularity_image_dir):
Expand All @@ -349,12 +359,19 @@ def mull_targets(
"base_image": dest_base_image or DEFAULT_BASE_IMAGE,
}
sin_def.write(fill_template)
with PrintProgress():
ret = involucro_context.exec_command(involucro_args)
if singularity:
# we can not remove this folder as it contains the image wich is owned by root
pass
# shutil.rmtree('./singularity_import')

for involucro_args in involucro_args_list:
cmd = involucro_context.build_command(involucro_args)
print(f"Executing: {shlex_join(cmd)}")

with PrintProgress():
ret = involucro_context.exec_command(involucro_args)
if singularity:
# we can not remove this folder as it contains the image wich is owned by root
pass
# shutil.rmtree('./singularity_import')
if not ret:
break
return ret


Expand Down Expand Up @@ -404,10 +421,10 @@ def __init__(self, involucro_bin=None, shell_exec=None, verbose="3"):
self.shell_exec = shell_exec or commands.shell
self.verbose = verbose

def build_command(self, involucro_args):
def build_command(self, involucro_args: List[str]) -> List[str]:
return [self.involucro_bin, f"-v={self.verbose}"] + involucro_args

def exec_command(self, involucro_args):
def exec_command(self, involucro_args: List[str]) -> int:
cmd = self.build_command(involucro_args)
# Create ./build dir manually, otherwise Docker will do it as root
created_build_dir = False
Expand Down Expand Up @@ -585,6 +602,8 @@ def args_to_mull_targets_kwds(args):
kwds["singularity_image_dir"] = args.singularity_image_dir
if hasattr(args, "invfile"):
kwds["invfile"] = args.invfile
if hasattr(args, "verbose"):
kwds["verbose"] = args.verbose

kwds["involucro_context"] = context_from_args(args)

Expand Down
Loading