2.11. Operations#
Operationは、Workflow、CommandLineTool、ExpressionToolと同様に、CWL Processの一種です。Workflowのステップで、入力と出力を指定しますが、実行するのに十分な情報を提供しません。
CWL runnerでワークフローを実行する前に、開発中のワークフローを可視化できます:
operations.cwl
#cwlVersion: v1.2
class: Workflow
inputs:
message: string
outputs: []
steps:
echo:
run: ../echo.cwl
in:
message: message
out: [out]
# Here you know you want an operation that changes the case of
# the previous step, but you do not have an implementation yet.
uppercase:
run:
class: Operation
inputs:
message: string
outputs:
uppercase_message: string
in:
message:
source: echo/out
out: [uppercase_message]
ワークフローのuppercase
ステップは Operation です。CommandLineToolやExpressionToolのように使用できます。また、CWL Viewerやcwltool
を使って可視化できます:
$ cwltool --print-dot operations.cwl
INFO /opt/hostedtoolcache/Python/3.9.19/x64/bin/cwltool 3.1.20240508115724
INFO Resolved 'operations.cwl' to 'file:///home/runner/work/user_guide/user_guide/src/_includes/cwl/operations/operations.cwl'
digraph G {
bgcolor="#eeeeee";
clusterrank=local;
labeljust=right;
labelloc=bottom;
"echo" [fillcolor=lightgoldenrodyellow, label=echo, shape=record, style=filled];
"uppercase" [fillcolor=lightgoldenrodyellow, label=uppercase, shape=record, style=dashed];
"echo" -> "uppercase";
subgraph cluster_inputs {
label="Workflow Inputs";
rank=same;
style=dashed;
"message" [fillcolor="#94DDF4", label=message, shape=record, style=filled];
}
"message" -> "echo";
subgraph cluster_outputs {
label="Workflow Outputs";
labelloc=b;
rank=same;
style=dashed;
}
}
The output of the command above can be rendered cwltool --print-dot operations.cwl | dot -Tsvg > operations.svg ; open operations.svg
.
operation ファイルを cwltool
で実行しようとすると、cwltool
が実行に必要な情報を持っていないため、失敗します:
cwltool
は、どうやってoperationsを実行するかを知りません#$ cwltool operations.cwl --message Hello
INFO /opt/hostedtoolcache/Python/3.9.19/x64/bin/cwltool 3.1.20240508115724
INFO Resolved 'operations.cwl' to 'file:///home/runner/work/user_guide/user_guide/src/_includes/cwl/operations/operations.cwl'
ERROR Workflow error, try again with --debug for more information:
operations.cwl:19:7: Workflow has unrunnable abstract Operation
注釈
CWL runnerは、operations を具体的なステップに結びつけるかもしれません。例えば、CWL runnerは、ワークフローエンジンで実行される異なるステップに対応するIDを持つ抽象的な operation を使用できます。