运行Cromwell所需的配置文件,影响了WDL流程语言的使用。这里是一个适配LSF集群的配置,同时适配了singularity容器,当在WDL的runtime模块中指定sif文件,即可调用对应的镜像,同时建立了一个环境变量用于将路径映射到容器中。
在配置文件中的backend部分进行修改
backend {
default = "LSF"
providers {
LSF {
actor-factory = "cromwell.backend.impl.sfs.config.ConfigBackendLifecycleActorFactory"
config {
runtime-attributes = """
Int runtime_minutes = 1440
Int cpus = 2
Int requestsed_memory_kb_per_core = 8000000
String? singularity
String? singularity_binding
"""
run-in-background = true
submit = """
if [ -z "${singularity}" ]; then
bsub \
-J ${job_name} \
-q "your_default_queue" \
-n ${cpus} \
-cwd ${cwd} \
-o ${out} \
-e ${err} \
-R 'span[hosts=1]' \
-M ${requestsed_memory_kb_per_core * cpus} \
-W ${runtime_minutes} \
/usr/bin/bash ${script}
elif [ -z "${singularity_binding}" ]; then
bsub \
-J ${job_name} \
-q "your_default_queue" \
-n ${cpus} \
-cwd ${cwd} \
-o ${out} \
-e ${err} \
-R 'span[hosts=1]' \
-M ${requestsed_memory_kb_per_core * cpus} \
-W ${runtime_minutes} \
singularity exec --bind ${cwd} ${singularity} /bin/bash ${script}
else
bsub \
-J ${job_name} \
-q "your_default_queue" \
-n ${cpus} \
-cwd ${cwd} \
-o ${out} \
-e ${err} \
-R 'span[hosts=1]' \
-M ${requestsed_memory_kb_per_core * cpus} \
-W ${runtime_minutes} \
singularity exec --bind ${cwd}:${cwd},${singularity_binding} ${singularity} /bin/bash ${script}
fi
"""
kill = "bkill ${job_id}"
check-alive = "bjobs -w ${job_id} |& egrep -qvw 'not found|EXIT|JOBID'"
job-id-regex = "Job <(\\d+)>.*"
# output directory
root = "Project"
}
filesystems {
local {
localization: [
"hard-link", "soft-link", "copy"
]
caching {
duplication-strategy: [
"hard-link", "soft-link", "copy"
]
hashing-strategy: "file"
check-sibling-md5: false
}
}
}
}
}
}
这样,在对应的WDL脚本中
task {
input {}
command <<<>>>
output {}
runtime {
singularity: "/path/to/xxxx.sif"
singularity_binding: "/path/to/bind_1:/path/in/container_1,/path/to/bind_2:/path/in/container_2"
}
}
通过这种方式,即可指定运行的sif镜像和映射路径了。