ntswf 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/ntswf/activity_worker.rb +2 -2
- data/lib/ntswf/base.rb +7 -4
- data/lib/ntswf/client.rb +2 -2
- data/lib/ntswf/decision_worker.rb +2 -1
- data/lib/ntswf/errors.rb +12 -0
- data/lib/ntswf.rb +1 -0
- metadata +4 -3
data/README.md
CHANGED
@@ -48,8 +48,8 @@ module Ntswf
|
|
48
48
|
protected
|
49
49
|
|
50
50
|
def activity_task_list
|
51
|
-
activity_task_lists[default_unit] or
|
52
|
-
|
51
|
+
activity_task_lists[default_unit] or raise Errors::InvalidArgument.new(
|
52
|
+
"Missing activity task list configuration for default unit '#{default_unit}'")
|
53
53
|
end
|
54
54
|
|
55
55
|
def process_single_task(activity_task)
|
data/lib/ntswf/base.rb
CHANGED
@@ -24,7 +24,7 @@ module Ntswf
|
|
24
24
|
# Development option.
|
25
25
|
# A random ID is stored at the given path, and appended to all task list names.
|
26
26
|
# @option config [String] :unit This worker/client's activity task list key
|
27
|
-
# @raise If a task list name is invalid
|
27
|
+
# @raise [Errors::InvalidArgument] If a task list name is invalid
|
28
28
|
def configure(config)
|
29
29
|
@config = OpenStruct.new(config)
|
30
30
|
autocomplete_task_list_names!
|
@@ -64,7 +64,8 @@ module Ntswf
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def decision_task_list
|
67
|
-
@config.decision_task_list or raise
|
67
|
+
@config.decision_task_list or raise Errors::InvalidArgument.new(
|
68
|
+
"Missing decision task list configuration")
|
68
69
|
end
|
69
70
|
|
70
71
|
def default_unit
|
@@ -123,10 +124,12 @@ module Ntswf
|
|
123
124
|
atl_values = activity_task_lists.values if activity_task_lists
|
124
125
|
[*atl_values, *@config.decision_task_list].each do |task_list|
|
125
126
|
if task_list.include?(separator)
|
126
|
-
raise
|
127
|
+
raise Errors::InvalidArgument.new(
|
128
|
+
"Invalid config '#{task_list}': Separator '#{separator}' is reserved for internal use.")
|
127
129
|
end
|
128
130
|
if task_list.count(". ") > 0
|
129
|
-
raise
|
131
|
+
raise Errors::InvalidArgument.new(
|
132
|
+
"Invalid config '#{task_list}': Dots and spaces not allowed.")
|
130
133
|
end
|
131
134
|
end
|
132
135
|
end
|
data/lib/ntswf/client.rb
CHANGED
@@ -25,7 +25,7 @@ module Ntswf
|
|
25
25
|
# @option options [Numeric] :version
|
26
26
|
# Optional minimum version of the client. The task may be rescheduled by older clients.
|
27
27
|
# @return (see #find)
|
28
|
-
# @raise [
|
28
|
+
# @raise [Errors::AlreadyStarted]
|
29
29
|
def start_execution(options)
|
30
30
|
workflow_execution = start_swf_workflow_execution(options)
|
31
31
|
execution_details(workflow_execution).merge!(
|
@@ -38,7 +38,7 @@ module Ntswf
|
|
38
38
|
# @param ids [Hash] Identifies the queried execution
|
39
39
|
# @option ids [String] :workflow_id Workflow ID
|
40
40
|
# @option ids [String] :run_id Run ID
|
41
|
-
# @raise [
|
41
|
+
# @raise [Errors::NotFound]
|
42
42
|
# @return [Hash]
|
43
43
|
# Execution properties.
|
44
44
|
# :exception:: Exception message for an unexpectedly failed execution
|
@@ -96,7 +96,8 @@ module Ntswf
|
|
96
96
|
options = parse_input(input)
|
97
97
|
app_in_charge = options['unit'] || guess_app_from(data_providing_event)
|
98
98
|
task_list = activity_task_lists[app_in_charge]
|
99
|
-
raise
|
99
|
+
raise Errors::InvalidArgument.new(
|
100
|
+
"Missing activity task list config for #{app_in_charge.inspect}") unless task_list
|
100
101
|
|
101
102
|
task.schedule_activity_task(activity_type, {
|
102
103
|
heartbeat_timeout: :none,
|
data/lib/ntswf/errors.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module Ntswf
|
2
|
+
module Errors
|
3
|
+
# @see Client#start_execution
|
4
|
+
AlreadyStarted = AWS::SimpleWorkflow::Errors::WorkflowExecutionAlreadyStartedFault
|
5
|
+
|
6
|
+
# @see Base#configure
|
7
|
+
InvalidArgument = Class.new(RuntimeError)
|
8
|
+
|
9
|
+
# @see Client#find
|
10
|
+
NotFound = AWS::SimpleWorkflow::Errors::UnknownResourceFault
|
11
|
+
end
|
12
|
+
end
|
data/lib/ntswf.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ntswf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- LICENSE
|
54
54
|
- lib/ntswf/decision_worker.rb
|
55
55
|
- lib/ntswf/utils.rb
|
56
|
+
- lib/ntswf/errors.rb
|
56
57
|
- lib/ntswf/activity_worker.rb
|
57
58
|
- lib/ntswf/instance.rb
|
58
59
|
- lib/ntswf/worker.rb
|
@@ -61,7 +62,7 @@ files:
|
|
61
62
|
- lib/ntswf.rb
|
62
63
|
homepage: https://github.com/infopark/ntswf
|
63
64
|
licenses:
|
64
|
-
-
|
65
|
+
- LGPL-3.0
|
65
66
|
post_install_message:
|
66
67
|
rdoc_options: []
|
67
68
|
require_paths:
|