+
Skip to content

Remove resourceLimits from nf-test nextflow.config file and use profile instead #3597

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

Merged
merged 2 commits into from
Jun 2, 2025
Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We also enabled to install subworkflows with modules from different remotes.

- Remove the on `pull_request_target` trigger and `pull_request` types from the download test. Also drop `push` triggers on other CI tests. ([#3399](https://github.com/nf-core/tools/pull/3399))
- Add nf-core template version badges to README ([#3396](https://github.com/nf-core/tools/pull/3396))
- Basic pipeline level nf-test tests ([#3469](https://github.com/nf-core/tools/pull/3469))
- Basic pipeline level nf-test tests ([#3469](https://github.com/nf-core/tools/pull/3469), [3597](https://github.com/nf-core/tools/pull/3597))
- Add Bluesky badge to readme ([#3475](https://github.com/nf-core/tools/pull/3475))
- Add .nftignore to trigger list ([#3508](https://github.com/nf-core/tools/pull/3508))
- Tun nf-test tests on runsOn runners ([#3525](https://github.com/nf-core/tools/pull/3525))
Expand Down
8 changes: 0 additions & 8 deletions nf_core/pipeline-template/tests/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,4 @@
params.modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
params.pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/{{ short_name }}'

process {
resourceLimits = [
cpus: 4,
memory: '15.GB',
time: '1.h'
]
}

aws.client.anonymous = true // fixes S3 access issues on self-hosted runners
34 changes: 1 addition & 33 deletions nf_core/pipelines/lint/nf_test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from typing import Dict, List, Union

from nf_core.utils import load_tools_config, run_cmd
from nf_core.utils import load_tools_config

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -124,26 +124,6 @@ def nf_test_content(self) -> Dict[str, List[str]]:
# Content of nextflow.config file
conf_fn = Path(self.wf_path, "tests", "nextflow.config")

# Get the CPU, memory and time values defined in the test profile configuration.
cmd = f"config -profile test -flat {self.wf_path}"
result = run_cmd("nextflow", cmd)
config_values = {"cpus": "4", "memory": "15.GB", "time": "1.h"}
if result is not None:
stdout, _ = result
for config_line in stdout.splitlines():
ul = config_line.decode("utf-8")
try:
k, v = ul.split(" = ", 1)
if k == "cpus":
config_values["cpus"] = v.strip("'\"")
elif k == "memory":
config_values["memory"] = v.strip("'\"")
elif k == "time":
config_values["time"] = v.strip("'\"")
except ValueError:
log.debug(f"Couldn't find key=value config pair:\n {ul}")
pass

config_checks: Dict[str, Dict[str, str]] = {
"modules_testdata_base_path": {
"pattern": "modules_testdata_base_path",
Expand All @@ -153,18 +133,6 @@ def nf_test_content(self) -> Dict[str, List[str]]:
"pattern": "pipelines_testdata_base_path",
"description": "`pipelines_testdata_base_path`",
},
"cpus": {
"pattern": f"cpus: *[\"']?{config_values['cpus']}[\"']?",
"description": f"correct CPU resource limits. Should be {config_values['cpus']}",
},
"memory": {
"pattern": f"memory: *[\"']?{config_values['memory']}[\"']?",
"description": f"correct memory resource limits. Should be {config_values['memory']}",
},
"time": {
"pattern": f"time: *[\"']?{config_values['time']}[\"']?",
"description": f"correct time resource limits. Should be {config_values['time']}",
},
}

if nf_test_content_conf is None or str(conf_fn.relative_to(self.wf_path)) not in nf_test_content_conf:
Expand Down
14 changes: 3 additions & 11 deletions tests/pipelines/lint/test_nf_test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,16 @@ def test_nf_test_content_nf_test_files(self):
assert "'tests/test.nf.test' does not snapshot a 'versions.yml' file" in result["failed"]

def test_nf_test_content_nextflow_config_file(self):
"""Test failure if nextflow.config does not contain correct resource limits."""
# Create nextflow.config without resource limits or required parameters
"""Test failure if nextflow.config does not contain correct parameters."""
# Create nextflow.config without required parameters
config_file = Path(self.new_pipeline) / "tests" / "nextflow.config"
with open(config_file, "w") as f:
f.write("// Missing resource limits and parameters")
f.write("// Missing parameters")
lint_obj = nf_core.pipelines.lint.PipelineLint(self.new_pipeline)
result = lint_obj.nf_test_content()
assert len(result["failed"]) > 0
assert "'tests/nextflow.config' does not contain `modules_testdata_base_path`" in result["failed"]
assert "'tests/nextflow.config' does not contain `pipelines_testdata_base_path`" in result["failed"]
assert "'tests/nextflow.config' does not contain correct CPU resource limits. Should be 4" in result["failed"]
assert (
"'tests/nextflow.config' does not contain correct memory resource limits. Should be 15.GB"
in result["failed"]
)
assert (
"'tests/nextflow.config' does not contain correct time resource limits. Should be 1.h" in result["failed"]
)

def test_nf_test_content_missing_nf_test_config_file(self):
"""Test failure if nf-test.config does not contain required settings."""
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载