module SWF

Constants

SLOT_TIME

Public Instance Methods

domain() click to toggle source
# File lib/swf/swf.rb, line 40
def domain
  # if we need a new domain, make it in the aws console
  raise UnknownSWFDomain, "#{domain_name} is not a valid SWF domain" unless domain_exists?(domain_name)
  swf.domains[domain_name]
end
domain_exists?(d) click to toggle source
# File lib/swf/swf.rb, line 28
def domain_exists?(d)
  collision = 0
  begin
    swf.domains[d].exists?
  rescue => e
    collision += 1 if collision < 10
    max_slot_delay = 2**collision - 1
    sleep(SLOT_TIME * rand(0 .. max_slot_delay))
    retry
  end
end
domain_name() click to toggle source
# File lib/swf/swf.rb, line 15
def domain_name
  raise UndefinedDomainName, "domain name not defined" unless @domain_name
  @domain_name
end
domain_name=(d) click to toggle source

in the runner context, where domain_name comes from ENV settings we call SWF.domain_name = MyApp::Settings.swf_domain

# File lib/swf/swf.rb, line 22
def domain_name=(d)
  @domain_name = d
end
swf() click to toggle source
# File lib/swf/swf.rb, line 11
def swf
  @swf ||= AWS::SimpleWorkflow.new
end
task_list() click to toggle source
# File lib/swf/swf.rb, line 50
def task_list
  @task_list or raise UndefinedTaskList, "task_list must be defined via SWF.task_list = <task_list>"
end
task_list=(tl) click to toggle source
# File lib/swf/swf.rb, line 46
def task_list=(tl)
  @task_list = tl
end