3
4

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.

Digdagのワークフローの中で他のワークフローを呼び出し実行する

Last updated at Posted at 2016-08-30

みなさま、こんばんわ。本日の我が家の夕食はカレーでした。
今日はカレー食べたことだし、digdagのワークフロー定義するdigファイル書く

##実行環境は前回作成したもの

5分でDigdagインストールしてワークフロー実行まで試してみる
http://qiita.com/namihitoo/items/ba259ad5fa682ee274b6

##参考資料

  • Getting started(毎度おなじみお世話になります)

##Let's Try
テスト用にdigファイルを2つ作成

digdag_one.dig
timezone: UTC

+step1:
  sh>: echo "step1"

+step2:
  !include : 'digdag_two.dig'

+step3:
  sh>: echo "End"
digdag_two.dig
timezone: UTC

+step_other:
  sh>: echo "step2"

localモードで実行
digファイル書いて試しに実行したい時は毎回pushしたりserver modeで起動しなくていいのね(汗

  • 参考
[root@vagrant-centos65 digdag_test]# digdag run digdag_one.dig
2016-08-30 13:42:34 +0000: Digdag v0.8.11
2016-08-30 13:42:36 +0000 [WARN] (main): Using a new session time 2016-08-30T00:00:00+00:00.
2016-08-30 13:42:36 +0000 [INFO] (main): Using session .digdag/status/20160830T000000+0000.
2016-08-30 13:42:37 +0000 [INFO] (main): Starting a new session project id=1 workflow name=digdag_one session_time=2016-08-30T00:00:00+00:00
2016-08-30 13:42:38 +0000 [INFO] (0016@+digdag_one+step1): sh>: echo "step1"
step1
2016-08-30 13:42:38 +0000 [INFO] (0016@+digdag_one+step2+step_other): sh>: echo "step2"
step2
2016-08-30 13:42:38 +0000 [INFO] (0016@+digdag_one+step3): sh>: echo "End"
End
Success. Task state is saved at .digdag/status/20160830T000000+0000 directory.

ちなみに、一度ワークフロー実行すると、sessionに成功した情報が残るので、連続してlocalモードで実行すると処理がSkipされるよ

[root@vagrant-centos65 digdag_test]# digdag run digdag_one.dig
2016-08-30 13:45:28 +0000: Digdag v0.8.11
2016-08-30 13:45:31 +0000 [WARN] (main): Reusing the last session time 2016-08-30T00:00:00+00:00.
2016-08-30 13:45:31 +0000 [INFO] (main): Using session .digdag/status/20160830T000000+0000.
2016-08-30 13:45:31 +0000 [INFO] (main): Starting a new session project id=1 workflow name=digdag_one session_time=2016-08-30T00:00:00+00:00
2016-08-30 13:45:31 +0000 [WARN] (0016@+digdag_one+step1): Skipped
2016-08-30 13:45:31 +0000 [WARN] (0016@+digdag_one+step2+step_other): Skipped
2016-08-30 13:45:31 +0000 [WARN] (0016@+digdag_one+step3): Skipped
Success. Task state is saved at .digdag/status/20160830T000000+0000 directory.

.digdag/statusの配下にymlが吐かれるみたい

[root@vagrant-centos65 digdag_test]# ls -lR .digdag/status/20160830T000000+0000/
.digdag/status/20160830T000000+0000/:
total 20
-rw-r--r-- 1 root root 153 Aug 30 13:45 +digdag_one+step1.yml
-rw-r--r-- 1 root root 164 Aug 30 13:45 +digdag_one+step2+step_other.yml
-rw-r--r-- 1 root root 153 Aug 30 13:45 +digdag_one+step2.yml
-rw-r--r-- 1 root root 153 Aug 30 13:45 +digdag_one+step3.yml
-rw-r--r-- 1 root root 147 Aug 30 13:45 +digdag_one.yml

ファイル中身はこんな感じ

[root@vagrant-centos65 digdag_test]# cat .digdag/status/20160830T000000+0000/+digdag_one+step1.yml 
fullName: "+digdag_one+step1"
state: "success"
result:
  subtaskConfig: {}
  exportParams: {}
  storeParams: {}
  report:
    inputs: []
    outputs: []

以上!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?