Digdag is an open source multi-cloud workflow engine. To put it simply, I thought it was a tool that would help me in the process of processing some tasks in order.
Since there is no book about Digdag, I would like to translate the document on Digdag's official website and organize it in Qiita. http://docs.digdag.io/getting_started.html The documentation is in English. Since the purpose is to study, I think there are mistranslations. Today we will start from the Getting Started part. The final goal is to create a batch in Rails using Digdag's Ruby.
The contents are as follows. Getting started Architecture Concepts Workflow definition Scheduling workflow Operators Command reference Language API -Ruby Change the setting value for each environment with Digdag (RubyOnRails) Batch implementation in RubyOnRails environment using Digdag
Getting started
Digdag is an executable file. You can put the file in `` ~ / bin``` using the
`curl``` command.
$ curl -o ~/bin/digdag --create-dirs -L "https://dl.digdag.io/digdag-latest"
$ chmod +x ~/bin/digdag
$ echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
digdag --help
If can be executed, the environment setting is completed.
If you use zsh, please change ~ / .bashrc
to `` `~ / .zshrc```.
Windows
PowerShell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::TLS12; mkdir -Force $env:USERPROFILE\bin; Invoke-WebRequest http://dl.digdag.io/digdag-latest.jar -OutFile $env:USERPROFILE\bin\digdag.bat}"
setx PATH "%PATH%;%USERPROFILE%\bin"
digdag init <dir>
The command creates a sample workflow.
$ digdag init mydag
$ cd mydag
$ digdag run
The following sample code (mydag) with the digdag init mydag command.dig) is generated
#### **`mayday.dig`**
```python
timezone: UTC
+setup:
echo>: start ${session_time}
+disp_current_date:
echo>: ${moment(session_time).utc().format('YYYY-MM-DD HH:mm:ss Z')}
+repeat:
for_each>:
order: [first, second, third]
animal: [dog, cat]
_do:
echo>: ${order} ${animal}
_parallel: true
+teardown:
echo>: finish ${session_time}
digdag run
workflow was executed
Execution result
Next time is Architecture
Recommended Posts