3
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.

1. cromwell でCWLを実行してみる

Last updated at Posted at 2018-05-30

cromwellワークフローエンジンを利用してcwlを実行する

cromwell の実行環境については、0. cromwell でCWLを実行してみる を参照

CWLのFirst Exampleを利用する

cwlのサンプルを作成

次の2つのファイルを作成

  • 1st-tool.cwl
  • echo-job.yml
1st-tool.cwl
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
inputs:
  message:
    type: string
    inputBinding:
      position: 1
outputs: []
echo-job.yml
message: Hello world!

cromwellでcwlを実行する

cromwellに上記の2つのファイルを指定して実行する

java -jar cromwell.jar run --type cwl --inputs YAML形式の入力ファイル ワークフローのCWL

# java -jar cromwell.jar run --type cwl --inputs echo-job.yml 1st-tool.cwl 
[2018-05-30 07:30:33,70] [info] Running with database db.url = jdbc:hsqldb:mem:e2bcacde-b3d0-4af2-8e74-9f2690991ab8;shutdown=false;hsqldb.tx=mvcc
[2018-05-30 07:30:38,67] [info] Running migration RenameWorkflowOptionsInMetadata with a read batch size of 100000 and a write batch size of 100000
[2018-05-30 07:30:38,69] [info] [RenameWorkflowOptionsInMetadata] 100%
[2018-05-30 07:30:38,78] [info] Running with database db.url = jdbc:hsqldb:mem:0113123e-dba9-4387-a894-4214f36387f4;shutdown=false;hsqldb.tx=mvcc
[2018-05-30 07:30:39,32] [info] Slf4jLogger started
[2018-05-30 07:30:39,37] [info] Pre Processing Workflow...
[2018-05-30 07:30:39,58] [info] Pre-Processing /git/1st-tool.cwl
[2018-05-30 07:30:39,65] [info] Pre Processing Inputs...
Exception in thread "main" cromwell.CromwellEntryPoint$$anon$1: ERROR: Unable to submit workflow to Cromwell::
running cwltool on file /git/1st-tool.cwl failed with Cannot run program "cwltool" (in directory "/git"): error=2, No such file or directory
...

プリプロセスは実行できるが、cwltoolが無いために実行できないとのメッセージが表示される

# java -jar cromwell.jar --version
cromwell 32

少なくとも、このバージョンのcromwellは内部でcwltoolを利用する事でcwlを実行している事がわかる

cwltoolをインストール

cromwellのエンジンだけではcwlを実行できないのでcwltoolをインストールする
cwltoolはpythonのプログラムなので、python3(又はpython2)も事前にインストールする

インストール手順は次の通り

  • python3のインストール
  • python3-pipのインストール
  • gitのインストール
  • gitを利用してcwltoolを取得
  • pip3を利用してcwltoolのインストール
# apt-get -y install python3
# apt-get -y install python3-pip
# apt-get -y install git
# git clone https://github.com/common-workflow-language/cwltool.git
# cd cwltool
# pip3 install .
# cd ../

cwltoolのバージョンを確認

# cwltool --version             
/usr/local/bin/cwltool 1.0.20180528123027

cwltoolの動作を確認

# cwltool 1st-tool.cwl echo-job.yml
/usr/local/bin/cwltool 1.0.20180528123027
Resolved '1st-tool.cwl' to 'file:///git/1st-tool.cwl'
[job 1st-tool.cwl] /tmp/tmp5qptk9al$ echo \
    'Hello world!'
Hello world!
[job 1st-tool.cwl] completed success
{}
Final process status is success

cwltool でサンプルが実行できることを確認したので、次にcromwellから実行する

# java -jar cromwell.jar run --type cwl --inputs echo-job.yml 1st-tool.cwl 
[2018-05-30 07:54:48,81] [info] Running with database db.url = jdbc:hsqldb:mem:601a446a-7221-4921-aa20-33b74753bedb;shutdown=false;hsqldb.tx=mvcc
[2018-05-30 07:54:53,79] [info] Running migration RenameWorkflowOptionsInMetadata with a read batch size of 100000 and a write batch size of 100000
...
[2018-05-30 07:54:56,30] [info] Workflow heartbeat configuration:
{
  "cromwellId" : "cromid-b4de34d",
  "heartbeatInterval" : "2 minutes",
  "ttl" : "10 minutes",
  "writeBatchSize" : 10000,
  "writeThreshold" : 10000
}
[2018-05-30 07:54:56,39] [info] Metadata summary refreshing every 2 seconds.
...
[2018-05-30 07:55:00,53] [info] BackgroundConfigAsyncJobExecutionActor [2fdd1b221st-tool.cwl:NA:1]: 'echo' 'Hello world!'
[2018-05-30 07:55:00,59] [info] BackgroundConfigAsyncJobExecutionActor [2fdd1b221st-tool.cwl:NA:1]: executing: /bin/bash /git/cromwell-executions/1st-tool.cwl/2fdd1b22-4f31-47cf-92f1-823560755450/call-1st-tool.cwl/execution/script
[2018-05-30 07:55:01,45] [info] BackgroundConfigAsyncJobExecutionActor [2fdd1b221st-tool.cwl:NA:1]: job id: 7914
[2018-05-30 07:55:01,45] [info] BackgroundConfigAsyncJobExecutionActor [2fdd1b221st-tool.cwl:NA:1]: Status change from - to Done
[2018-05-30 07:55:01,68] [info] WorkflowExecutionActor-2fdd1b22-4f31-47cf-92f1-823560755450 [2fdd1b22]: Workflow 1st-tool.cwl complete. Final Outputs:
{

}
[2018-05-30 07:55:01,96] [info] WorkflowManagerActor WorkflowActor-2fdd1b22-4f31-47cf-92f1-823560755450 is in a terminal state: WorkflowSucceededState
[2018-05-30 07:55:08,89] [info] SingleWorkflowRunnerActor workflow finished with status 'Succeeded'.
{
  "outputs": {

  },
  "id": "2fdd1b22-4f31-47cf-92f1-823560755450"
}
[2018-05-30 07:55:11,53] [info] Workflow polling stopped
...
[2018-05-30 07:55:11,69] [info] Shutdown finished.

cromwellとcwltoolを利用してcwlの実行が確認できた

今回はここまで:smiley:

3
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
3
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?