Module: Fluere
- Defined in:
- lib/fluere.rb,
lib/fluere/config.rb,
lib/fluere/worker.rb,
lib/fluere/version.rb,
lib/fluere/workflow.rb,
lib/fluere/exceptions.rb
Defined Under Namespace
Modules: Worker, Workflow
Classes: Config, StubbedPathOnlyError
Constant Summary
collapse
- VERSION =
"0.0.3"
Class Method Summary
collapse
Class Method Details
.activities ⇒ Object
26
27
28
|
# File 'lib/fluere.rb', line 26
def self.activities
@activities ||= []
end
|
.activities_task_list ⇒ Object
.assert_stubbed ⇒ Object
84
85
86
|
# File 'lib/fluere.rb', line 84
def self.assert_stubbed
raise StubbedPathOnlyError.new unless stubbed?
end
|
10
11
12
|
# File 'lib/fluere.rb', line 10
def self.configure(&block)
yield Fluere::Config
end
|
.decisions_task_list ⇒ Object
.default_activity_options ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/fluere.rb', line 50
def self.default_activity_options
{
default_task_schedule_to_close_timeout: 60 * 2,
default_task_schedule_to_start_timeout: 60 * 2,
default_task_start_to_close_timeout: 60 * 2,
}
end
|
.default_workflow_options ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/fluere.rb', line 42
def self.default_workflow_options
{
default_execution_start_to_close_timeout: 60 * 2,
default_task_start_to_close_timeout: 60 * 2,
default_child_policy: :terminate,
}
end
|
.domain ⇒ Object
34
35
36
|
# File 'lib/fluere.rb', line 34
def self.domain
swf.domains[Config.domain]
end
|
.flush! ⇒ Object
68
69
70
|
# File 'lib/fluere.rb', line 68
def self.flush!
domain.workflow_executions.with_status(:open).map { |we| we.terminate }
end
|
.ignore_executions ⇒ Object
96
97
98
99
100
101
102
|
# File 'lib/fluere.rb', line 96
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? ⇒ Boolean
92
93
94
|
# File 'lib/fluere.rb', line 92
def self.ignore_executions?
@ignore_executions
end
|
88
89
90
|
# File 'lib/fluere.rb', line 88
def self.perform_executions?
!ignore_executions?
end
|
.prefixed_task_list(task_list) ⇒ Object
.start_execution(klass, *args) ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'lib/fluere.rb', line 58
def self.start_execution(klass, *args)
if stubbed?
if perform_executions?
klass.decider_class.new.send(Fluere::Workflow::EXECUTION_METHOD, *args)
end
else
klass.workflow_client.start_execution(*args)
end
end
|
.stub! ⇒ Object
76
77
78
|
# File 'lib/fluere.rb', line 76
def self.stub!
@stubbed = true
end
|
.stubbed? ⇒ Boolean
72
73
74
|
# File 'lib/fluere.rb', line 72
def self.stubbed?
@stubbed
end
|
.swf ⇒ Object
30
31
32
|
# File 'lib/fluere.rb', line 30
def self.swf
@swf ||= AWS::SimpleWorkflow.new
end
|
.unstub! ⇒ Object
80
81
82
|
# File 'lib/fluere.rb', line 80
def self.unstub!
@stubbed = false
end
|
.workflows ⇒ Object
14
15
16
|
# File 'lib/fluere.rb', line 14
def self.workflows
@workflows ||= []
end
|