0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CWL User Guide 21: Writing Workflows をやってみた

Last updated at Posted at 2017-12-20

CWL User Guide 21: Writing Workflows

今回は、いくつかのツールをまとめてワークフローにする方法について書かれています

Key Points より引用

  • Each step in a workflow must have its own CWL description.
  • Top level inputs and outputs of the workflow are described in the inputs and outputs fields respectively.
  • The steps are specified under steps.
  • Execution order is determined by the flow of inputs and outputs between steps.

この回にでてくる主なキーワード

CWLファイル、1st-workflow.cwl

1st-workflow.cwl
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: Workflow
inputs:
  inp: File
  ex: string

outputs:
  classout:
    type: File
    outputSource: compile/classfile

steps:
  untar:
    run: tar-param.cwl
    in:
      tarfile: inp
      extractfile: ex
    out: [example_out]

  compile:
    run: arguments.cwl
    in:
      src: untar/example_

パラメータファイル 1st-workflow-job.yml

inp:
  class: File
  path: hello.tar
ex: Hello.java

必要なファイル

arguments.cwl, tar-param.cwl
Hello.class を持っている hello.tar です。
これらは以前作ったものがつかえます。

実行

実行前確認

Hello ではじまるファイルが無いことが確認できます

$ rm Hello.*
$ ls
1st-workflow.cwl  1st-workflow-job.yml  arguments.cwl  hello.tar  tar-param.cwl

実行方法

実行結果

$ cwltool 1st-workflow.cwl 1st-workflow-job.yml
/usr/local/bin/cwltool 1.0.20171107133715
Resolved '1st-workflow.cwl' to 'file:///home/vagrant/cwl_user_guide_work/21-1st-workflow/1st-workflow.cwl'
[workflow 1st-workflow.cwl] start
[step untar] start
[job untar] /tmp/tmpCI9OHQ$ tar \
    xf \
    /tmp/tmpLIXNiE/stg205fd207-085e-47cf-b3cc-476f28a33da8/hello.tar \
    Hello.java
[job untar] completed success
[step untar] completed success
[step compile] start
[job compile] /tmp/tmp3Ui2EV$ docker \
    run \
    -i \
    --volume=/tmp/tmp3Ui2EV:/var/spool/cwl:rw \
    --volume=/tmp/tmpwFWaRm:/tmp:rw \
    --volume=/tmp/tmpCI9OHQ/Hello.java:/var/lib/cwl/stg713fb841-c885-436b-b0b3-ba8e5a93a43a/Hello.java:ro \
    --workdir=/var/spool/cwl \
    --read-only=true \
    --user=1000:1000 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/var/spool/cwl \
    java:7-jdk \
    javac \
    -d \
    /var/spool/cwl \
    /var/lib/cwl/stg713fb841-c885-436b-b0b3-ba8e5a93a43a/Hello.java
[job compile] completed success
[step compile] completed success
[workflow 1st-workflow.cwl] completed success
{
    "classout": {
        "checksum": "sha1$e68df795c0686e9aa1a1195536bd900f5f417b18",
        "basename": "Hello.class",
        "location": "file:///home/vagrant/cwl_user_guide_work/21-1st-workflow/Hello.class",
        "path": "/home/vagrant/cwl_user_guide_work/21-1st-workflow/Hello.class",
        "class": "File",
        "size": 184
    }
}
Final process status is success

実行結果確認

Hello.javaHello.class が新しくできていることがわかる

$ ls
1st-workflow.cwl  1st-workflow-job.yml  arguments.cwl  Hello.class  hello.tar  tar-param.cwl

今回使ったファイル

cwl_user_guide_work/21-1st-workflow at master · manabuishii/cwl_user_guide_work

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?