treasure-data / digdag

Workload Automation System
https://www.digdag.io/
Apache License 2.0
1.31k stars 221 forks source link

How to set working directory for entire dig? #1634

Closed vnktsh closed 3 years ago

vnktsh commented 3 years ago

Hello right now, the default working directory is at /tmp/digdag-tempdirxxx/workspace/.

Is there an easy and quick way to change this?

Setting _workdir: <work-path> gives me model validation error

2021-09-03 05:01:38 +0000: Digdag v0.9.40
Creating .digdag/tmp/archive-6621367414052580682.tar.gz...
error: Validating project failed
workflow /home/ubuntu/example.dig Workflow 'example' includes unknown keys: [_workdir] (model validation)
hiroyuki-sato commented 3 years ago

Hello, @vnktsh

Digdag isolates the working directory intentionally. So, basically, you can't change a directory except for some operators (ie.sh>).

Ref: #785

vnktsh commented 3 years ago

@hiroyuki-sato Thank you Hiro for the clarification. I have made workaround by doing cd ${workspace} for every sh>: operator.

Example:

_export:
  workdir: "/home/ubuntu/project/"

+run:
  +update-git:
    sh>: cd ${workdir} && git checkout master && git pull origin master

  +task:
    sh>: cd ${workdir} && python parser.py