full360-sequencer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/full360-sequencer.rb +20 -14
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 11689f8562fd17688883eca48d0e173a573d3823
|
4
|
+
data.tar.gz: 2328c3194fc48a4333bfeb4b7300dc839a9539a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 163c12b36137fd5a09c96851fe43315f50f191afd793e14b32817fd5dc6fd260b1afdf05e2a694ca4c942883fcf6bf7bf902332552e168cf97c5c86986661cfd
|
7
|
+
data.tar.gz: e5ef1c88f6cad5d4c4c37f435b7e3be01b1460bdeb7c8cf1b84ad3b7f98eba5ec25968aff1af19162235f92faf972b82fd456be82a24ca7d60e21a78a7228f18
|
data/lib/full360-sequencer.rb
CHANGED
@@ -9,18 +9,18 @@ module Full360
|
|
9
9
|
class Runner
|
10
10
|
attr_accessor :sleep_between_checks
|
11
11
|
attr_accessor :config
|
12
|
-
|
12
|
+
|
13
13
|
def initialize(logger = nil)
|
14
14
|
@logger = logger ? logger : Logger.new(STDOUT)
|
15
15
|
|
16
16
|
# default 5 seconds between completed? checks
|
17
17
|
@sleep_between_checks = 5
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def config_from_file(yaml_path)
|
21
21
|
@config = parse_config_file(yaml_path)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def run_task_class(task_type_string)
|
25
25
|
case task_type_string
|
26
26
|
when 'ecs_task' then Full360::Sequencer::RunECSTask
|
@@ -47,25 +47,25 @@ module Full360
|
|
47
47
|
e.backtrace.each { |r| @logger.error(r) }
|
48
48
|
raise e
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
def task_name(params)
|
52
52
|
params.keys.first
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
def parse_config_file(yaml_path)
|
56
56
|
YAML.load_file(yaml_path)
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
def config_valid?(config)
|
60
60
|
return false unless config.is_a? Array
|
61
61
|
true
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
class RunTaskBase
|
66
66
|
attr_reader :success
|
67
67
|
attr_reader :exit_code
|
68
|
-
|
68
|
+
|
69
69
|
def run_task; end
|
70
70
|
def completed?; end
|
71
71
|
def kill_task; end #will be used for timeout
|
@@ -79,7 +79,7 @@ module Full360
|
|
79
79
|
@params = keys_to_symbol(@params)
|
80
80
|
@cluster = @params[:cluster]
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
def keys_to_symbol(params)
|
84
84
|
# replaces string keys with symbol keys
|
85
85
|
# required by AWS SDK
|
@@ -96,7 +96,7 @@ module Full360
|
|
96
96
|
@task_arn = resp.tasks[0].task_arn
|
97
97
|
@logger.info("#{@task_name} task created #{@task_arn} on cluster #{@cluster}")
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def ecs_run_task
|
101
101
|
@logger.debug("creating AWS client for ECS task #{@task_name}...")
|
102
102
|
@ecs_client = ::Aws::ECS::Client.new
|
@@ -119,8 +119,9 @@ module Full360
|
|
119
119
|
}
|
120
120
|
)
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
def completed?
|
124
|
+
retries ||= 0
|
124
125
|
resp = ecs_describe_tasks
|
125
126
|
status = last_task_status(resp)
|
126
127
|
@logger.info("#{@task_name} : #{@task_arn} current status: #{status}")
|
@@ -128,20 +129,25 @@ module Full360
|
|
128
129
|
@logger.info("#{@task_name} completed in #{Time.new - @start_time} seconds")
|
129
130
|
# parse exit_code(s) and return completion
|
130
131
|
@success = determine_success(resp)
|
131
|
-
return true
|
132
|
+
return true
|
132
133
|
end
|
133
134
|
false
|
134
135
|
rescue => e
|
136
|
+
@logger.warn(e.message)
|
137
|
+
@logger.warn("task completion check failed, trying again ##{ retries }")
|
138
|
+
sleep 10*retries
|
139
|
+
retry if (retries += 1) < 3
|
140
|
+
|
135
141
|
@logger.error('SEQUENCER_ERROR')
|
136
142
|
@logger.error(e.message)
|
137
143
|
e.backtrace.each { |r| @logger.error(r) }
|
138
144
|
end
|
139
|
-
|
145
|
+
|
140
146
|
# parses last status from aws API response
|
141
147
|
def last_task_status(resp)
|
142
148
|
resp.tasks[0].last_status
|
143
149
|
end
|
144
|
-
|
150
|
+
|
145
151
|
# success is determined by all containers having zero exit code
|
146
152
|
def determine_success(resp)
|
147
153
|
success = true
|
metadata
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: full360-sequencer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pankaj batra
|
8
8
|
- jeremy winters
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2017-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
name: logger
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
18
|
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
20
|
version: '1.2'
|
20
|
-
name: logger
|
21
|
-
prerelease: false
|
22
21
|
type: :runtime
|
22
|
+
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
+
name: aws-sdk
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
32
|
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: '2.9'
|
34
|
-
name: aws-sdk
|
35
|
-
prerelease: false
|
36
35
|
type: :runtime
|
36
|
+
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2.9'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
+
name: minitest
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
46
|
- - "~>"
|
46
47
|
- !ruby/object:Gem::Version
|
47
48
|
version: '5.9'
|
48
|
-
name: minitest
|
49
|
-
prerelease: false
|
50
49
|
type: :development
|
50
|
+
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
@@ -66,7 +66,7 @@ homepage: https://www.full360.com
|
|
66
66
|
licenses:
|
67
67
|
- MIT
|
68
68
|
metadata: {}
|
69
|
-
post_install_message:
|
69
|
+
post_install_message:
|
70
70
|
rdoc_options: []
|
71
71
|
require_paths:
|
72
72
|
- lib
|
@@ -81,9 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
rubyforge_project:
|
84
|
+
rubyforge_project:
|
85
85
|
rubygems_version: 2.6.11
|
86
|
-
signing_key:
|
86
|
+
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: full360 sequencer utility
|
89
89
|
test_files: []
|