module Fluere

Constants

VERSION

Public Class Methods

activities() click to toggle source
# File lib/fluere.rb, line 26
def self.activities
  @activities ||= []
end
activities_task_list() click to toggle source
# File lib/fluere.rb, line 22
def self.activities_task_list
  Fluere.prefixed_task_list('activities')
end
assert_stubbed() click to toggle source
# File lib/fluere.rb, line 92
def self.assert_stubbed
  raise StubbedPathOnlyError.new unless stubbed?
end
configure() { |Config| ... } click to toggle source
# File lib/fluere.rb, line 10
def self.configure(&block)
  yield Fluere::Config
end
decisions_task_list() click to toggle source
# File lib/fluere.rb, line 18
def self.decisions_task_list
  Fluere.prefixed_task_list('decisions')
end
default_activity_options() click to toggle source
# File lib/fluere.rb, line 50
def self.default_activity_options
  {
    default_task_schedule_to_close_timeout: 60 * 60 * 2,
    default_task_schedule_to_start_timeout: 60 * 60 * 2,
    default_task_start_to_close_timeout: 60 * 60 * 2,
  }
end
default_workflow_options() click to toggle source
# File lib/fluere.rb, line 42
def self.default_workflow_options
  {
    default_execution_start_to_close_timeout: 60 * 60 * 2,
    default_task_start_to_close_timeout: 60 * 60 * 2,
    default_child_policy: :terminate,
  }
end
domain() click to toggle source
# File lib/fluere.rb, line 34
def self.domain
  swf.domains[Config.domain]
end
flush!() click to toggle source
# File lib/fluere.rb, line 76
def self.flush!
  domain.workflow_executions.with_status(:open).map { |we| we.terminate }
end
ignore_executions() { || ... } click to toggle source
# File lib/fluere.rb, line 104
def self.ignore_executions
  raise "only allowed to ignore executions when stubbed!" unless stubbed?
  @ignore_executions = true
  yield
ensure
  @ignore_executions = false
end
ignore_executions?() click to toggle source
# File lib/fluere.rb, line 100
def self.ignore_executions?
  @ignore_executions
end
info(msg) click to toggle source
# File lib/fluere.rb, line 72
def self.info(msg)
  Fluere::Config.logger.info(msg)
end
perform_executions?() click to toggle source
# File lib/fluere.rb, line 96
def self.perform_executions?
  !ignore_executions?
end
prefixed_task_list(task_list) click to toggle source
# File lib/fluere.rb, line 38
def self.prefixed_task_list(task_list)
  [Fluere::Config.task_list_prefix, task_list].join('-')
end
start_execution(klass, *args) click to toggle source
# File lib/fluere.rb, line 58
def self.start_execution(klass, *args)
  if stubbed?
    if perform_executions?
      info("Performing a stubbed execution, calling #{klass} decider block with args: #{args.inspect}")
      klass.decider_class.new.send(Fluere::Workflow::EXECUTION_METHOD, *args)
    else
      info("Skipped workflow execution for #{klass}")
    end
  else
    info("Requesting a workflow execution for #{klass}")
    klass.workflow_client.start_execution(*args)
  end
end
stub!() click to toggle source
# File lib/fluere.rb, line 84
def self.stub!
  @stubbed = true
end
stubbed?() click to toggle source
# File lib/fluere.rb, line 80
def self.stubbed?
  @stubbed
end
swf() click to toggle source
# File lib/fluere.rb, line 30
def self.swf
  @swf ||= AWS::SimpleWorkflow.new
end
unstub!() click to toggle source
# File lib/fluere.rb, line 88
def self.unstub!
  @stubbed = false
end
workflows() click to toggle source
# File lib/fluere.rb, line 14
def self.workflows
  @workflows ||= []
end