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 15: Staging Input Files をやってみた

Last updated at Posted at 2017-12-15

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

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?