Skip to content

Commit

Permalink
@mashehu suggested that downloading the containers should not be opti…
Browse files Browse the repository at this point in the history
…onal for Tower downloads. Given that there is the option to provide the list of remote containers to skip their download, I agree that this is reasonable.
  • Loading branch information
MatthiasZepper committed May 25, 2023
1 parent e512878 commit 315b9a3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Move registry definitions out of profile scope ([#2286])(https://github.com/nf-core/tools/pull/2286)
- Remove `aws_tower` profile ([#2287])(https://github.com/nf-core/tools/pull/2287)
- Fixed the Slack report to include the pipeline name ([#2291](https://github.com/nf-core/tools/pull/2291))

### Download

- Introduce a `--tower` flag for `nf-core download` to obtain pipelines in an offline format suited for [seqeralabs® Nextflow Tower](https://cloud.tower.nf/) ([#2247](https://github.com/nf-core/tools/pull/2247)).
Expand Down
12 changes: 6 additions & 6 deletions nf_core/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def __init__(
self.force = force
self.tower = tower
self.include_configs = None
self.container = container if not singularity_cache_index else "singularity"
self.singularity_cache = (
singularity_cache if not singularity_cache_index else "remote"
) # if a singularity_cache_index is given, use the file and overrule choice.
# force download of containers if a cache index is given or download is meant to be used for Tower.
self.container = "singularity" if singularity_cache_index or bool(tower) else container
# if a singularity_cache_index is given, use the file and overrule choice.
self.singularity_cache = "remote" if singularity_cache_index else singularity_cache
self.singularity_cache_index = singularity_cache_index
self.parallel_downloads = parallel_downloads

Expand Down Expand Up @@ -377,7 +377,7 @@ def prompt_config_inclusion(self):
def prompt_container_download(self):
"""Prompt whether to download container images or not"""

if self.container is None and stderr.is_interactive:
if self.container is None and stderr.is_interactive and not self.tower:
stderr.print("\nIn addition to the pipeline code, this tool can download software containers.")
self.container = questionary.select(
"Download software container images:",
Expand Down Expand Up @@ -722,7 +722,7 @@ def find_container_images(self, workflow_directory):
Therefore, we need to repeat the search over the contents, extract the variable name, and use it inside a new regex.
To get the variable name ( ${container_id} in above example ), we match the literal word "container" and use lookbehind (reset the match).
Then we skip [^\${}]+ everything that is not $ or curly braces. The next capture group is
Then we skip [^${}]+ everything that is not $ or curly braces. The next capture group is
${ followed by any characters that are not curly braces [^{}]+ and ended by a closing curly brace (}),
but only if it's not followed by any other curly braces (?![^{]*}). The latter ensures we capture the innermost
variable name.
Expand Down
2 changes: 1 addition & 1 deletion nf_core/modules/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def check_process_section(self, lines, fix_version, progress_bar):
self.failed.append(("docker_tag", "Unable to parse docker tag", self.main_nf))
docker_tag = NoneD
if l.startswith("quay.io/"):
l_stripped = re.sub("\W+$", "", l)
l_stripped = re.sub(r"\W+$", "", l)
self.failed.append(
(
"container_links",
Expand Down
8 changes: 5 additions & 3 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_remote_container_functionality(self, tmp_dir):

download_obj.include_configs = False # suppress prompt, because stderr.is_interactive doesn't.

# test if settings are changed accordingly.
# test if the settings are changed to mandatory defaults, if an external cache index is used.
assert download_obj.singularity_cache == "remote" and download_obj.container == "singularity"
assert isinstance(download_obj.containers_remote, list) and len(download_obj.containers_remote) == 0
# read in the file
Expand Down Expand Up @@ -264,9 +264,11 @@ def test_download_workflow_for_tower(self, tmp_dir):
# corroborate that the other revisions are inaccessible to the user.
assert len(download_obj.workflow_repo.tags) == len(download_obj.revision)

# manually test container image detection for 3.7 revision
# download_obj.download_workflow_tower(location=tmp_dir) will run container image detection for all requested revisions
assert isinstance(download_obj.containers, list) and len(download_obj.containers) == 33
# manually test container image detection for 3.7 revision only
download_obj.containers = [] # empty container list for the test
download_obj.workflow_repo.checkout(download_obj.wf_sha["3.7"])
assert isinstance(download_obj.containers, list) and len(download_obj.containers) == 0
download_obj.find_container_images(download_obj.workflow_repo.access())
assert len(download_obj.containers) == 30 # 30 containers for 3.7
assert (
Expand Down

0 comments on commit 315b9a3

Please sign in to comment.