ruby-sfn-local 0.1.5 → 0.1.6
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.
- checksums.yaml +4 -4
- data/lib/sfn/aws_cli.rb +6 -4
- data/lib/sfn/execution_log.rb +14 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fe17e00c8d4e14a4fce01894eb055a416e43abe8bcc9e7c9335a7af385e20af
|
4
|
+
data.tar.gz: d5fbd90070b32dd0c8d3afd1b6c7096842679b97028d8538efd19c0a70d29b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcde4ca78448650c0dfd234c9783a01f7ef9e90e819f3d678a9094a8702a2b3c3affdbcf99bd1450bfc04e74715f1c2e3de98bbe20098826758b71aa10eec79b
|
7
|
+
data.tar.gz: 2fdd25a501f35fd1d9b76198e1a3b71328eddc1b1c9dd470f8cf225655eb41f61271496cd6ba1bc3b0d1890c18be939e6d005d93d5fcf066a7077eec28148a73
|
data/lib/sfn/aws_cli.rb
CHANGED
@@ -13,11 +13,13 @@ module Sfn
|
|
13
13
|
"--#{k}=#{v}"
|
14
14
|
end.join(' ')} \
|
15
15
|
--no-cli-pager"
|
16
|
-
|
16
|
+
if command == 'get-execution-history'
|
17
|
+
stdout = `#{cmd}`
|
18
|
+
else
|
19
|
+
stdout, stderr, _status = Open3.capture3(cmd)
|
20
|
+
raise raise ExecutionError, "#{stderr.strip}\n#{debug_info}" unless stderr.strip.empty?
|
21
|
+
end
|
17
22
|
|
18
|
-
raise raise ExecutionError, "#{stderr.strip}\n#{debug_info}" unless stderr.strip.empty?
|
19
|
-
|
20
|
-
stdout = `#{cmd}` if command == 'get-execution-history'
|
21
23
|
unless key.nil?
|
22
24
|
data = JSON.parse(stdout)
|
23
25
|
return data[key].strip if data.key?(key)
|
data/lib/sfn/execution_log.rb
CHANGED
@@ -15,11 +15,13 @@ module Sfn
|
|
15
15
|
attr_accessor :event
|
16
16
|
|
17
17
|
EVENTS = %w[stateEnteredEventDetails stateExitedEventDetails executionSucceededEventDetails
|
18
|
-
executionFailedEventDetails].freeze
|
18
|
+
executionFailedEventDetails taskScheduledEventDetails].freeze
|
19
|
+
|
19
20
|
def self.parse(execution_arn)
|
20
21
|
profile = {}
|
21
22
|
output = nil
|
22
23
|
error = nil
|
24
|
+
state_name = nil
|
23
25
|
events_json = AwsCli.run('stepfunctions', 'get-execution-history',
|
24
26
|
{ 'execution-arn': execution_arn.to_s, query: "'events[?#{EVENTS.join(' || ')}]'" })
|
25
27
|
JSON.parse(events_json).each do |event|
|
@@ -27,13 +29,17 @@ module Sfn
|
|
27
29
|
|
28
30
|
output ||= parsed_event.output
|
29
31
|
error ||= parsed_event.error(events_json)
|
32
|
+
last_state_name = state_name
|
30
33
|
state_name = parsed_event.state_name
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
unless state_name.nil?
|
36
|
+
profile[state_name] ||= { input: [], output: [], parameters: [] }
|
37
|
+
profile[state_name][:input] << parsed_event.profile[:input] unless parsed_event.profile[:input].nil?
|
38
|
+
profile[state_name][:output] << parsed_event.profile[:output] unless parsed_event.profile[:output].nil?
|
39
|
+
end
|
40
|
+
if !last_state_name.nil? && !parsed_event.profile[:parameters].nil?
|
41
|
+
profile[last_state_name][:parameters] << parsed_event.profile[:parameters]
|
42
|
+
end
|
37
43
|
end
|
38
44
|
[output, profile]
|
39
45
|
end
|
@@ -61,7 +67,8 @@ module Sfn
|
|
61
67
|
def profile
|
62
68
|
{
|
63
69
|
input: try_parse(event.dig('stateEnteredEventDetails', 'input')),
|
64
|
-
output: try_parse(event.dig('stateExitedEventDetails', 'output'))
|
70
|
+
output: try_parse(event.dig('stateExitedEventDetails', 'output')),
|
71
|
+
parameters: try_parse(event.dig('taskScheduledEventDetails', 'parameters'))
|
65
72
|
}.compact
|
66
73
|
end
|
67
74
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-sfn-local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gianni Mazza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-release
|