Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Created May 19, 2020 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroyuki-sato/69c74bca4c5a43c88ca586b113a18599 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/69c74bca4c5a43c88ca586b113a18599 to your computer and use it in GitHub Desktop.
digdag server example
timezone: UTC

_export:
  rb:
    require: scripts/myclass

+setup:
  rb>: MyClass.print_time
  label: start
  time: ${session_time}
require 'time'

class MyClass
  def print_time(label:, time:)
    1.upto(20) do |i|
      sleep 1
      p [label, Time.parse(time)]
    end
  end

  def say_something(order:, animal:)
    puts %Q|#{order} #{animal} said "My favorite number is #{Random.rand(10)}"|
  end
end
/var/folders/3s/5cm202m95zsglpy26c6_7j9m0000gn/T/digdag-tempdir6901698574128457563/workspace/1_fuga_2_4_2036456000615838250/scripts/myclass.rb:4: warning: The called method `print_time' is defined here
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
["start", 2020-05-19 13:26:30 +0000]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment