Skip to content

Commit

Permalink
Add language api class init
Browse files Browse the repository at this point in the history
Fix python args

Fix a typo for python tasks

Fix a typo for python printing

Fix a typo for python printing
  • Loading branch information
KentFujii committed Apr 17, 2022
1 parent 37a7765 commit 9628381
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/python_initialize.dig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
_export:
py:
require: tasks.initialize.InstanceVariable
arg1: var1
arg2: var2

+step1:
py>: tasks.initialize.InstanceVariable.step1

+step2:
py>: tasks.initialize.InstanceVariable.step2
11 changes: 11 additions & 0 deletions examples/ruby_initialize.dig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
_export:
rb:
require: 'tasks/initialize'
arg1: var1
arg2: var2

+step1:
rb>: InstanceVariable.step1

+step2:
rb>: InstanceVariable.step2
17 changes: 17 additions & 0 deletions examples/tasks/initialize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import digdag

class InstanceVariable:
def __init__(self, arg1):
self.arg1 = arg1

def step1(self):
print(self.arg1)
print(digdag.env.params['arg1'])
print(digdag.env.params['arg2'])
print('self.arg1 is modified!!!')
self.arg1 = 'var3'
print(self.arg1)

def step2(self):
print('Instance variables is initialized by each tasks.')
print(self.arg1)
19 changes: 19 additions & 0 deletions examples/tasks/initialize.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class InstanceVariable
def initialize(arg1)
@var = arg1
end

def step1
puts @var
puts Digdag.env.params['arg1']
puts Digdag.env.params['arg2']
puts '@var is modified!!!'
@var = 'var3'
puts @var
end

def step2
puts "Instance variables is initialized by each tasks."
puts @var
end
end

0 comments on commit 9628381

Please sign in to comment.