glider 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/examples/activity.rb +1 -1
- data/glider.gemspec +2 -2
- data/lib/glider/activities.rb +24 -19
- data/lib/glider/workflows.rb +8 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c292fcb2cd2e9d5c19fadb681c6d251fe323f63
|
4
|
+
data.tar.gz: 11d350b7239ef1f60fa75d81212bf4faa32ec06f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3b7d5739559fd0982c66ac41e01a4cbf023623768ba4ad6a40ef210bc5e6e52a6f1e2e26f44dd6ca7d3cbdc646db98374ec9c0683707431d1e0e0b4ece49a59
|
7
|
+
data.tar.gz: df0d2bd7ee79b7a62f1062c63d8e70500e3bce764e824cf638448338ce8924c9c9a01549f96523137cf77dddcee70120e68c0dc5e9e09bf2431f1fd381815f3c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/examples/activity.rb
CHANGED
@@ -8,7 +8,7 @@ class MySWF < Glider::Component
|
|
8
8
|
register_activity :hello_world, '1.5'
|
9
9
|
|
10
10
|
def hello_world(input)
|
11
|
-
task.fail! reason: "BECAUSE!" and return
|
11
|
+
task.fail! reason: "BECAUSE!" and task.fail! and return
|
12
12
|
$logger.warn "Executing hello_world."
|
13
13
|
sleep 2
|
14
14
|
$logger.warn "Completed hello_world."
|
data/glider.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glider 0.1.
|
5
|
+
# stub: glider 0.1.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glider"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["David Pelaez"]
|
data/lib/glider/activities.rb
CHANGED
@@ -52,30 +52,35 @@ module Glider
|
|
52
52
|
$0 = "ruby #{activity_type.name}-#{activity_type.version}"
|
53
53
|
signal_handling
|
54
54
|
Glider.logger.info "Startig worker for #{activity_type.name} activity (pid #{Process.pid})"
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
55
|
+
loop do
|
56
|
+
begin
|
57
|
+
domain.activity_tasks.poll activity_type.name do |activity_task|
|
58
|
+
task_lock! do
|
59
|
+
begin
|
60
|
+
workflow_id = activity_task.workflow_execution.workflow_id
|
61
|
+
Glider.logger.info "Executing activity=#{activity_type.name} workflow_id=#{workflow_id}"
|
62
|
+
target_instance = self.new activity_task
|
63
|
+
input = process_input(activity_task.input)
|
64
|
+
activity_result = target_instance.send activity_type.name, input
|
65
|
+
|
65
66
|
activity_task.complete! result: activity_result.to_s unless activity_task.responded?
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
|
68
|
+
rescue AWS::SimpleWorkflow::ActivityTask::CancelRequestedError
|
69
|
+
# cleanup after ourselves
|
70
|
+
activity_task.cancel!
|
69
71
|
end
|
70
|
-
rescue AWS::SimpleWorkflow::ActivityTask::CancelRequestedError
|
71
|
-
# cleanup after ourselves
|
72
|
-
activity_task.cancel!
|
73
72
|
end
|
74
73
|
end
|
74
|
+
rescue AWS::SimpleWorkflow::Errors::UnknownResourceFault
|
75
|
+
$logger.error "An action relating to an expired workflow was sent. Probably the activity took longer than the execution timeout span."
|
76
|
+
rescue RuntimeError => e
|
77
|
+
if e.to_s == "already responded"
|
78
|
+
# this error sometimes appear if failing and completing happen very close in time and SWF doesn't report correctly the responded? status
|
79
|
+
Glider.logger.warn "Ignoring error responding to activity task failed. Most likely caused because your task failed the activity already."
|
80
|
+
else
|
81
|
+
raise e
|
82
|
+
end
|
75
83
|
end
|
76
|
-
rescue AWS::SimpleWorkflow::Errors::UnknownResourceFault
|
77
|
-
$logger.error "An action relating to an expired workflow was sent. Probably the activity took longer than the execution timeout span. Killing activity process."
|
78
|
-
exit 1
|
79
84
|
end
|
80
85
|
end
|
81
86
|
end
|
data/lib/glider/workflows.rb
CHANGED
@@ -138,15 +138,16 @@ module Glider
|
|
138
138
|
$0 = "ruby #{workflow_type.name}-#{workflow_type.version}"
|
139
139
|
signal_handling
|
140
140
|
Glider.logger.info "Startig worker for #{workflow_type.name} (pid #{Process.pid})"
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
141
|
+
loop do
|
142
|
+
begin
|
143
|
+
domain.decision_tasks.poll workflow_type.name do |decision_task|
|
144
|
+
task_lock! do
|
145
|
+
process_decision_task workflow_type, decision_task
|
146
|
+
end
|
145
147
|
end
|
148
|
+
rescue AWS::SimpleWorkflow::Errors::UnknownResourceFault
|
149
|
+
$logger.error "An action relating to an expired decision was sent. Probably the decider took longer than the decision timeout span."
|
146
150
|
end
|
147
|
-
rescue AWS::SimpleWorkflow::Errors::UnknownResourceFault
|
148
|
-
$logger.error "An action relating to an expired decision was sent. Probably the decider took longer than the decision timeout span. Killing decider process."
|
149
|
-
exit 1
|
150
151
|
end
|
151
152
|
end
|
152
153
|
end
|