Skip to content

Commit aac6d13

Browse files
committed
Bind clone engine inventory and launch to the installed Nextflow home
1 parent 7af5daf commit aac6d13

6 files changed

Lines changed: 36 additions & 7 deletions

File tree

‎modules/ngs/clone_validation.nf‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@ process RunCloneValidation {
7777
def validator = shellQuote("${codeRoot}/scripts/validate_wf_clone_runtime.py")
7878
def lock = shellQuote(lockPath)
7979
def wfCloneSingularityCache = runtimeLock.containers.cache_dir
80-
def wfCloneNxfHome = (params.wf_clone_nxf_home ?: System.getenv("NXF_HOME") ?: "${task.workDir}/.nextflow").toString()
80+
def wfCloneNxfHome = (params.wf_clone_nxf_home ?: System.getenv("NXF_HOME") ?: "${System.getenv('HOME')}/.nextflow").toString()
8181
"""
8282
set -euo pipefail
8383
export NXF_OFFLINE=true
8484
export NXF_DISABLE_CHECK_LATEST=true
8585
export NXF_DOCKER_ENABLED=false
8686
export NXF_SINGULARITY_CACHEDIR="${wfCloneSingularityCache}"
87-
export NXF_HOME="${wfCloneNxfHome}"
87+
export NXF_HOME=${shellQuote(wfCloneNxfHome)}
88+
export NXF_VER=${shellQuote(runtimeLock.nextflow.version)}
89+
export NXF_DIST="\${NXF_HOME}/framework"
8890
mkdir -p "\${NXF_HOME}"
8991
9092
${apiPython} ${validator} \

‎nextflow.config‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,9 @@ params {
11521152
// persistent shared cache explicitly; otherwise Nextflow stores remote
11531153
// Singularity images under each task's wf_clone_work/singularity directory.
11541154
wf_clone_singularity_cache = System.getenv('BMS_WF_CLONE_SINGULARITY_CACHE') ?: "${bmsContainerRootFallback}/singularity_cache"
1155-
wf_clone_nxf_home = System.getenv('BMS_WF_CLONE_NXF_HOME') ?: "${cacheRoot}/nextflow/wf-clone"
1155+
// Native compilation binds the installed engine home. Direct Nextflow use
1156+
// inherits its launcher home unless a clone-specific override is supplied.
1157+
wf_clone_nxf_home = System.getenv('BMS_WF_CLONE_NXF_HOME') ?: null
11561158
wf_clone_runtime_lock = System.getenv('BMS_WF_CLONE_RUNTIME_LOCK') ?: "${params.code_root}/config/ngs/wf_clone_validation_v1.8.4.lock.json"
11571159
wf_clone_basecaller_model = 'dna_r10.4.1_e8.2_400bps_hac@v6.0.0'
11581160
wf_clone_sample = null

‎platform/api/native_components.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ def ngs_clone_runtime_dependencies(params):
12341234
import os
12351235
from pathlib import Path
12361236
from component_runtime import SelectedDependency
1237-
from scripts.validate_wf_clone_runtime import resolve_lock_path, selected_images
1237+
from scripts.validate_wf_clone_runtime import resolve_lock_path, resolve_nextflow_home, selected_images
12381238
root = Path(__file__).resolve().parents[2]
12391239
lock_path = Path(params.get('wf_clone_runtime_lock') or os.environ.get('BMS_WF_CLONE_RUNTIME_LOCK') or
12401240
root / 'config/ngs/wf_clone_validation_v1.8.4.lock.json').resolve()
@@ -1257,7 +1257,7 @@ def add(kind, relative, path, sha256=None):
12571257
add('runtime_data', prefix + '/compatibility.patch',
12581258
resolve_lock_path(lock_path, lock['compatibility_patch']['path']),
12591259
lock['compatibility_patch']['sha256'])
1260-
home = Path(params.get('wf_clone_nxf_home') or os.environ.get('NXF_HOME') or Path.home() / '.nextflow')
1260+
home = resolve_nextflow_home(params.get('wf_clone_nxf_home'))
12611261
version = lock['nextflow']['version']
12621262
jar = f'framework/{version}/nextflow-{version}-one.jar'
12631263
add('runtime_data', prefix + '/nxf-home/' + jar, home / jar)

‎platform/api/services/nextflow.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5676,6 +5676,12 @@ def resolve_antibody_validation_profile(default_profile: str) -> str:
56765676
effective_profile = resolve_ont_workflow_alias(effective_profile)
56775677
params = normalize_ont_launch_params(effective_profile, params)
56785678
params['workflow_id'] = effective_profile
5679+
if (effective_profile == 'wf_clone_validation' or
5680+
(effective_profile == 'ont_construct_screening' and params.get('run_assembly') is True)):
5681+
from scripts.validate_wf_clone_runtime import resolve_nextflow_home
5682+
# Carry the installed engine selection into the plan and argv. The
5683+
# task must not invent a different cache after inventory selected it.
5684+
params['wf_clone_nxf_home'] = str(resolve_nextflow_home(params.get('wf_clone_nxf_home')))
56795685
is_fastq_only_ont_command = (
56805686
effective_profile == 'ont_fastq_qc'
56815687
and str(params.get('ont_input_mode') or params.get('input_mode') or '').strip() == 'fastq'

‎platform/api/tests/test_workflow_cache_hygiene.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ def test_nested_wf_clone_has_shared_singularity_and_nxf_caches() -> None:
2323

2424
assert "BMS_WF_CLONE_SINGULARITY_CACHE" in config_text
2525
assert 'wf_clone_singularity_cache = System.getenv(\'BMS_WF_CLONE_SINGULARITY_CACHE\') ?: "${bmsContainerRootFallback}/singularity_cache"' in config_text
26-
assert 'wf_clone_nxf_home = System.getenv(\'BMS_WF_CLONE_NXF_HOME\') ?: "${cacheRoot}/nextflow/wf-clone"' in config_text
26+
assert "wf_clone_nxf_home = System.getenv('BMS_WF_CLONE_NXF_HOME') ?: null" in config_text
27+
assert '${cacheRoot}/nextflow/wf-clone' not in config_text
2728
assert 'apptainer.cacheDir = System.getenv(\'NXF_APPTAINER_CACHEDIR\') ?: ensureDir("${cacheRoot}/apptainer")' in config_text
2829
assert 'export NXF_SINGULARITY_CACHEDIR="${wfCloneSingularityCache}"' in module_text
29-
assert 'export NXF_HOME="${wfCloneNxfHome}"' in module_text
30+
assert 'export NXF_HOME=${shellQuote(wfCloneNxfHome)}' in module_text
31+
assert 'export NXF_VER=${shellQuote(runtimeLock.nextflow.version)}' in module_text
32+
assert 'export NXF_DIST="\\${NXF_HOME}/framework"' in module_text
33+
assert '${task.workDir}/.nextflow' not in module_text

‎scripts/validate_wf_clone_runtime.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ def git(source: Path, *args: str) -> str:
8383
return result.stdout.strip()
8484

8585

86+
def resolve_nextflow_home(selected: str | Path | None = None) -> Path:
87+
"""Use the installed engine home, shared by inventory and native compilation.
88+
89+
Clone-specific/retained placement wins; otherwise inherit the managed
90+
launcher home. Cache roots do not select an independently installed engine.
91+
This resolves a path only: native launch retains its existing error behavior.
92+
"""
93+
explicit = (selected or os.environ.get("BMS_WF_CLONE_NXF_HOME")
94+
or os.environ.get("NXF_HOME") or os.environ.get("BMS_NEXTFLOW_HOME"))
95+
if explicit:
96+
return Path(explicit)
97+
data = os.environ.get("BMS_DATA")
98+
return Path(data) / "nextflow" if data else Path.home() / ".nextflow"
99+
100+
86101
def selected_images(lock: dict[str, Any], assembly_tool: str = "flye") -> list[dict[str, Any]]:
87102
"""Only Canu is conditional; annotation and reporting always execute."""
88103
return [image for image in lock["containers"]["images"]

0 commit comments

Comments
 (0)