[RUBY] Learn Digdag from Digdag Official Documentation-Getting started

About Digdag

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.

Target

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.

#table of contents

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

1. Download and install the latest version of Digdag

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 --helpIf 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"

2. Try running the sample

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 runworkflow was executed Execution result スクリーンショット 2020-07-09 13.19.57.png

Next time is Architecture

Recommended Posts

Learn Digdag from Digdag Official Documentation-Getting started
Learn Digdag from Digdag Official Documentation-Architecture
Learn Digdag from Digdag Official Documentation-Scheduling workflow
Learn Digdag from Digdag official documentation-Language API-Ruby
Learn Digdag from Digdag Official Documentation-Ah Concepts
Learn Digdag from Digdag official documentation-Ah Workflow definition
Learn Digdag from Digdag official documentation-Operators ① Workflow control operators