2.15. 入力ファイルのステージング#
通常、入力ファイルは出力ディレクトリとは別の読み取り専用ディレクトリに置かれます。 これは、ツールが同じディレクトリに入力ファイルと一緒に出力ファイルを書き込むことを期待している場合に問題を引き起こします。 入力ファイルを出力ディレクトリにステージング(配置のこと)するには、InitialWorkDirRequirement
を使用します。この例では、JavaScript式を使用して、先頭のディレクトリパスから入力ファイルのベース名を抽出しています。
#!/usr/bin/env cwl-runner
cwlVersion: v1.2
class: CommandLineTool
hints:
DockerRequirement:
dockerPull: openjdk:9.0.1-11-slim
baseCommand: javac
requirements:
InitialWorkDirRequirement:
listing:
- $(inputs.src)
inputs:
src:
type: File
inputBinding:
position: 1
valueFrom: $(self.basename)
outputs:
classfile:
type: File
outputBinding:
glob: "*.class"
src:
class: File
path: Hello.java
ここで、コマンドラインにツール定義と入力オブジェクトを指定して、cwltool
を起動します:
$ cwltool linkfile.cwl arguments-job.yml
INFO /home/docs/checkouts/readthedocs.org/user_builds/common-workflow-language-user-guide-ja/envs/latest/bin/cwltool 3.1.20240508115724
INFO Resolved 'linkfile.cwl' to 'file:///home/docs/checkouts/readthedocs.org/user_builds/common-workflow-language-user-guide-ja/checkouts/latest/src/_includes/cwl/staging-input-files/linkfile.cwl'
ERROR Workflow error, try again with --debug for more information:
Docker is not available for this tool, try --no-container to disable Docker, or install a user space Docker replacement like uDocker with --user-space-docker-cmd.: docker executable is not available