bioinformatics
cwl
CWLDay 16

CWL User Guide 15: Staging Input Files をやってみた

CWL User Guide 15: Staging Input Files

Common Workflow Language User Guide: Staging Input Files

今回は、実行時に必要なファイルをステージングする方法、について書かれています

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

CWLファイル、linkfile.cwl

linkfile.cwl
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool
hints:
  DockerRequirement:
    dockerPull: java:7
baseCommand: javac

requirements:
  - class: InlineJavascriptRequirement
  - class: InitialWorkDirRequirement
    listing:
      - $(inputs.src)

inputs:
  src:
    type: File
    inputBinding:
      position: 1
      valueFrom: $(self.basename)

outputs:
  classfile:
    type: File
    outputBinding:
      glob: "*.class"

パラメータファイルarguments-job.yml

arguments-job.yml
src:
  class: File
  path: Hello.java

必要なファイル

第8回で作った Hello.java が必要になります

public class Hello {}

実行

実行方法

cwltool linkfile.cwl arguments-job.yml

実行結果

$ cwltool linkfile.cwl arguments-job.yml
/usr/local/bin/cwltool 1.0.20171107133715
Resolved 'linkfile.cwl' to 'file:///home/vagrant/cwl_user_guide_work/15-staging/linkfile.cwl'
['docker', 'pull', 'java:7']
7: Pulling from library/java
Digest: sha256:c0b61b62639124aa838dc755c5a9d57c072f762b71b170281927399a14db4652
Status: Downloaded newer image for java:7
[job linkfile.cwl] /tmp/tmpNjfe1r$ docker \
    run \
    -i \
    --volume=/tmp/tmpNjfe1r:/var/spool/cwl:rw \
    --volume=/tmp/tmpwc5RxS:/tmp:rw \
    --volume=/home/vagrant/cwl_user_guide_work/15-staging/Hello.java:/var/spool/cwl/Hello.java:ro \
    --workdir=/var/spool/cwl \
    --read-only=true \
    --user=1000:1000 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/var/spool/cwl \
    java:7 \
    javac \
    Hello.java
[job linkfile.cwl] completed success
{
    "classfile": {
        "checksum": "sha1$e68df795c0686e9aa1a1195536bd900f5f417b18",
        "basename": "Hello.class",
        "location": "file:///home/vagrant/cwl_user_guide_work/15-staging/Hello.class",
        "path": "/home/vagrant/cwl_user_guide_work/15-staging/Hello.class",
        "class": "File",
        "size": 184
    }
}
Final process status is success

実行結果確認

Hello.class ができていることが確認できます

$ ls
arguments-job.yml  Hello.class  Hello.java  linkfile.cwl

今回使ったファイル

cwl_user_guide_work/15-staging at master · manabuishii/cwl_user_guide_work