生信

WDL: 快速编写属于你的分析流程——续

2020-09-13  本文已影响0人  生信云笔记

前言

  前面分享了WDL+Cromwell如何在本地跑流程——《WDL: 快速编写属于你的分析流程》,今天来说一说如何使用它们在集群上跑流程。WDL可以使用本地、集群、云端三种模式来跑流程,本地运行是不需要服务器后台配置文件,而另外两种需要配置文件。

  那么下面我们来看一下想在SGE集群上运行应该准备什么样的配置文件,具体内容如下:

include required(classpath("application"))

backend {
  default = SGE
  # sge config
  providers {
    SGE {
      actor-factory = "cromwell.backend.impl.sfs.config.ConfigBackendLifecycleActorFactory"
      config {

        # Limits the number of concurrent jobs
        concurrent-job-limit = 50

        # Warning: If set, Cromwell will run 'check-alive' for every job at this interval
        # exit-code-timeout-seconds = 120

        runtime-attributes = """
        Int cpu = 8
        Float? memory_gb
        String? sge_queue
        String? sge_project
        """

        submit = """
        qsub \
        -terse \
        -N ${job_name} \
        -wd ${cwd} \
        -o ${out}.out \
        -e ${err}.err \
        ${"-pe smp " + cpu} \
        ${"-l mem_free=" + memory_gb + "g"} \
        ${"-q " + sge_queue} \
        ${"-P " + sge_project} \
        ${script}
        """

        kill = "qdel ${job_id}"
        check-alive = "qstat -j ${job_id}"
        job-id-regex = "(\\d+)"

        # filesystem config
        filesystems {
          local {

            localization: [
               "hard-link","soft-link", "copy"
              ]

            caching {
              duplication-strategy: [
              "hard-link","soft-link",  "copy"
              ]

              # Default: "md5"
              hashing-strategy: "md5"

              # Default: 10485760 (10MB).
              fingerprint-size: 10485760

              # Default: false
              check-sibling-md5: false
            }
          }
        }
      }
    }
  }
}

准备好上面的配置文件后,使用如下的命令运行WDL,则流程中的任务就会被提交到集群来运行,命令如下:

java -Dconfig.file=backend.conf -jar cromwell-51.jar run test.wdl --inputs test.json

使用上面的命令可以将任务提交到服务器,并且这个命令会一直运行到所有任务都结束,所以如果任务需要很长时间可以将其挂后台运行。

最后

  使用WDL+Cromwell在集群上运行还是很简单的,只需准备如上所示的配置文件让WDL可以用集群提交命令将任务提交给集群即可。emm,今天就分享到这里了。

上一篇下一篇

猜你喜欢

热点阅读