Skip to content

Commit 88046be

Browse files
committed
remove resourceLimits from nf-test nextflow.config file and use profile instead
1 parent 1572bd0 commit 88046be

File tree

3 files changed

+4
-52
lines changed

3 files changed

+4
-52
lines changed

nf_core/pipeline-template/tests/nextflow.config

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,4 @@
99
params.modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
1010
params.pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/{{ short_name }}'
1111

12-
process {
13-
resourceLimits = [
14-
cpus: 4,
15-
memory: '15.GB',
16-
time: '1.h'
17-
]
18-
}
19-
2012
aws.client.anonymous = true // fixes S3 access issues on self-hosted runners

nf_core/pipelines/lint/nf_test_content.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44
from typing import Dict, List, Union
55

6-
from nf_core.utils import load_tools_config, run_cmd
6+
from nf_core.utils import load_tools_config
77

88
log = logging.getLogger(__name__)
99

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

127-
# Get the CPU, memory and time values defined in the test profile configuration.
128-
cmd = f"config -profile test -flat {self.wf_path}"
129-
result = run_cmd("nextflow", cmd)
130-
config_values = {"cpus": "4", "memory": "15.GB", "time": "1.h"}
131-
if result is not None:
132-
stdout, _ = result
133-
for config_line in stdout.splitlines():
134-
ul = config_line.decode("utf-8")
135-
try:
136-
k, v = ul.split(" = ", 1)
137-
if k == "cpus":
138-
config_values["cpus"] = v.strip("'\"")
139-
elif k == "memory":
140-
config_values["memory"] = v.strip("'\"")
141-
elif k == "time":
142-
config_values["time"] = v.strip("'\"")
143-
except ValueError:
144-
log.debug(f"Couldn't find key=value config pair:\n {ul}")
145-
pass
146-
147127
config_checks: Dict[str, Dict[str, str]] = {
148128
"modules_testdata_base_path": {
149129
"pattern": "modules_testdata_base_path",
@@ -153,18 +133,6 @@ def nf_test_content(self) -> Dict[str, List[str]]:
153133
"pattern": "pipelines_testdata_base_path",
154134
"description": "`pipelines_testdata_base_path`",
155135
},
156-
"cpus": {
157-
"pattern": f"cpus: *[\"']?{config_values['cpus']}[\"']?",
158-
"description": f"correct CPU resource limits. Should be {config_values['cpus']}",
159-
},
160-
"memory": {
161-
"pattern": f"memory: *[\"']?{config_values['memory']}[\"']?",
162-
"description": f"correct memory resource limits. Should be {config_values['memory']}",
163-
},
164-
"time": {
165-
"pattern": f"time: *[\"']?{config_values['time']}[\"']?",
166-
"description": f"correct time resource limits. Should be {config_values['time']}",
167-
},
168136
}
169137

170138
if nf_test_content_conf is None or str(conf_fn.relative_to(self.wf_path)) not in nf_test_content_conf:

tests/pipelines/lint/test_nf_test_content.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,16 @@ def test_nf_test_content_nf_test_files(self):
2828
assert "'tests/test.nf.test' does not snapshot a 'versions.yml' file" in result["failed"]
2929

3030
def test_nf_test_content_nextflow_config_file(self):
31-
"""Test failure if nextflow.config does not contain correct resource limits."""
32-
# Create nextflow.config without resource limits or required parameters
31+
"""Test failure if nextflow.config does not contain correct parameters."""
32+
# Create nextflow.config without required parameters
3333
config_file = Path(self.new_pipeline) / "tests" / "nextflow.config"
3434
with open(config_file, "w") as f:
35-
f.write("// Missing resource limits and parameters")
35+
f.write("// Missing parameters")
3636
lint_obj = nf_core.pipelines.lint.PipelineLint(self.new_pipeline)
3737
result = lint_obj.nf_test_content()
3838
assert len(result["failed"]) > 0
3939
assert "'tests/nextflow.config' does not contain `modules_testdata_base_path`" in result["failed"]
4040
assert "'tests/nextflow.config' does not contain `pipelines_testdata_base_path`" in result["failed"]
41-
assert "'tests/nextflow.config' does not contain correct CPU resource limits. Should be 4" in result["failed"]
42-
assert (
43-
"'tests/nextflow.config' does not contain correct memory resource limits. Should be 15.GB"
44-
in result["failed"]
45-
)
46-
assert (
47-
"'tests/nextflow.config' does not contain correct time resource limits. Should be 1.h" in result["failed"]
48-
)
4941

5042
def test_nf_test_content_missing_nf_test_config_file(self):
5143
"""Test failure if nf-test.config does not contain required settings."""

0 commit comments

Comments
 (0)