9
7

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のincludeで_export

Last updated at Posted at 2016-10-26

やりたいこと

複数digファイルで共用したいパラメータと自digファイル内でのみ使用したいパラメータがある
includeをうまく使ってパラメータを共用したい

結論

  1. includeする方に_exportを書く、される方には書かない
  2. includeされる方はincludeする方のサブディレクトリに置く
  3. !include:の間には半角スペースが必要

やってみたこと

includeされる方・includeする方を同じディレクトリに置くとエラー

$ cat cmn.dig
var1: var1_val
$ cat a.dig
_export:
  !include : cmn.dig
  var2 : var2_val
+task1:
  echo>: ${var1} ${var2}
$ digdag run a.dig
2016-10-26 19:02:45 +0900: Digdag v0.8.17
error: Validating project failed
workflow /tmp/test3/cmn.dig Workflow 'cmn' includes unknown keys: [var1] (model validation)

includeされる方をincludeする方のサブディレクトリに置くと成功

http://docs.digdag.io/workflow_definition.html?#include-another-file にならってサブディレクトリに置くと成功

$ cat cmn/cmn.dig
var1: var1_val
$ cat a.dig
_export:
  !include : cmn/cmn.dig
  var2: var2_val
+task1:
  echo>: ${var1} ${var2}
$ digdag run a.dig
2016-10-26 18:59:11 +0900: Digdag v0.8.17
2016-10-26 18:59:14 +0900 [WARN] (main): Using a new session time 2016-10-26T00:00:00+00:00.
2016-10-26 18:59:14 +0900 [INFO] (main): Using session /tmp/test3/.digdag/status/20161026T000000+0000.
2016-10-26 18:59:14 +0900 [INFO] (main): Starting a new session project id=1 workflow name=a session_time=2016-10-26T00:00:00+00:00
2016-10-26 18:59:17 +0900 [INFO] (0016@+a+task1): echo>: var1_val var2_val
var1_val var2_val
Success. Task state is saved at /tmp/test3/.digdag/status/20161026T000000+0000 directory.
  * Use --session <daily | hourly | "yyyy-MM-dd[ HH:mm:ss]"> to not reuse the last session time.
  * Use --rerun, --start +NAME, or --goal +NAME argument to rerun skipped tasks.

この記事の続き

9
7
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
9
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?