active_encode 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c48246966ba7a638b2aeb33b34d5d77d25181f4
4
- data.tar.gz: ec276e87d6861f7286798b29224153bce94a8e3a
3
+ metadata.gz: bd86726dd90f3ffec25407a1450a80fdb606cdea
4
+ data.tar.gz: aa31a70f81428b410bb5103c99a13a68ae90de19
5
5
  SHA512:
6
- metadata.gz: 4643a6ac8983e6a9090792f57784ca5621c37140ca53f2c90f8d075a95274ce867606529c9615ba98f9f698411b16477230d60857de459695a8b16b4eb0c56b3
7
- data.tar.gz: e6ab83906ccfaa2538500c92e66b756cebb15977d23e3170b9c66e9e281d9074c09dcc568a7eb7b360319c3f6bf5243698f725ad2559f2c2ca445e8ae9c0d564
6
+ metadata.gz: 0790ea34a31d9749268475dd1a8416f1b63bbc55559194fa5eba0348a740490c9d910d3b9c549ace98cf92e2e35be9f41ae92e9ef0fc50e206efec699b1abad3
7
+ data.tar.gz: 818e6db3eb2508b65653269f53dc660de3d078eb497d68e490d54f8c05f525b7f829105ad2d7e0472fe7bfc147368c0f2296b5bb2af9703385f20ff608b30380
@@ -86,6 +86,9 @@ module ActiveEncode
86
86
  encode.state = convert_state(workflow)
87
87
  encode.current_operations = convert_current_operations(workflow)
88
88
  encode.percent_complete = calculate_percent_complete(workflow)
89
+ encode.created_at = convert_created_at(workflow)
90
+ encode.updated_at = convert_updated_at(workflow)
91
+ encode.finished_at = convert_finished_at(workflow) unless encode.running?
89
92
  encode.output = convert_output(workflow, encode.options)
90
93
  encode.errors = convert_errors(workflow)
91
94
  encode.tech_metadata = convert_tech_metadata(workflow)
@@ -141,6 +144,21 @@ module ActiveEncode
141
144
  workflow.xpath('//errors/error/text()').map(&:to_s)
142
145
  end
143
146
 
147
+ def convert_created_at(workflow)
148
+ created_at = workflow.xpath('mediapackage/@start').last.to_s
149
+ created_at.present? ? Time.parse(created_at).iso8601 : nil
150
+ end
151
+
152
+ def convert_updated_at(workflow)
153
+ updated_at = workflow.xpath('//operation[@state!="INSTANTIATED"]/completed/text()').last.to_s
154
+ updated_at.present? ? Time.strptime(updated_at, "%Q").utc.iso8601 : nil
155
+ end
156
+
157
+ def convert_finished_at(workflow)
158
+ finished_at = workflow.xpath('//operation[@state!="INSTANTIATED"]/completed/text()').last.to_s
159
+ finished_at.present? ? Time.strptime(finished_at, "%Q").utc.iso8601 : nil
160
+ end
161
+
144
162
  def convert_options(workflow)
145
163
  options = {}
146
164
  options[:preset] = workflow.xpath('template/text()').to_s
@@ -46,6 +46,9 @@ module ActiveEncode
46
46
  progress = job_progress(encode.id)
47
47
  encode.current_operations = convert_current_operations(progress)
48
48
  encode.percent_complete = convert_percent_complete(progress, job_details)
49
+ encode.created_at = job_details.body["job"]["created_at"]
50
+ encode.updated_at = job_details.body["job"]["updated_at"]
51
+ encode.finished_at = job_details.body["job"]["finished_at"]
49
52
  encode.output = convert_output(job_details)
50
53
  encode.errors = convert_errors(job_details)
51
54
  encode.tech_metadata = convert_tech_metadata(job_details.body["job"]["input_media_file"])
@@ -46,6 +46,9 @@ module ActiveEncode
46
46
  job_progress = get_job_progress(encode.id)
47
47
  encode.current_operations = convert_current_operations(job_progress)
48
48
  encode.percent_complete = convert_percent_complete(job_progress, job_details)
49
+ encode.created_at = job_details.body["job"]["created_at"]
50
+ encode.updated_at = job_details.body["job"]["updated_at"]
51
+ encode.finished_at = job_details.body["job"]["finished_at"]
49
52
  encode.output = convert_output(job_details)
50
53
  encode.errors = convert_errors(job_details)
51
54
  encode.tech_metadata = convert_tech_metadata(job_details.body["job"]["input_media_file"])
@@ -7,12 +7,13 @@ module ActiveEncode
7
7
  included do
8
8
  # Current state of the encoding process
9
9
  attr_accessor :state
10
-
11
10
  attr_accessor :current_operations
12
-
13
11
  attr_accessor :percent_complete
14
-
15
12
  attr_accessor :errors
13
+
14
+ attr_accessor :created_at
15
+ attr_accessor :finished_at
16
+ attr_accessor :updated_at
16
17
  end
17
18
 
18
19
  def created?
@@ -1,3 +1,3 @@
1
1
  module ActiveEncode
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -28,6 +28,9 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
28
28
  its(:current_operations) { is_expected.to be_empty }
29
29
  its(:percent_complete) { is_expected.to eq 0 }
30
30
  its(:errors) { is_expected.to be_empty }
31
+ its(:created_at) { is_expected.to eq '2015-04-24T15:44:47Z' }
32
+ its(:updated_at) { is_expected.to be_nil }
33
+ its(:finished_at) { is_expected.to be_nil }
31
34
  its(:tech_metadata) { is_expected.to be_empty }
32
35
  end
33
36
 
@@ -46,6 +49,9 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
46
49
  its(:current_operations) { is_expected.to include("Hold for workflow selection") }
47
50
  its(:percent_complete) { is_expected.to eq 0.43478260869565216 }
48
51
  its(:errors) { is_expected.to be_empty }
52
+ its(:created_at) { is_expected.to eq '2015-04-20T17:58:43Z' }
53
+ its(:updated_at) { is_expected.to eq '2015-04-21T18:38:50Z' }
54
+ its(:finished_at) { is_expected.to be_nil }
49
55
  its(:tech_metadata) { is_expected.to be_empty }
50
56
  end
51
57
  context "a cancelled encode" do
@@ -61,6 +67,9 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
61
67
  its(:current_operations) { is_expected.to include("Tagging dublin core catalogs for publishing") }
62
68
  its(:percent_complete) { is_expected.to eq 1.7391304347826086 }
63
69
  its(:errors) { is_expected.to be_empty }
70
+ its(:created_at) { is_expected.to eq '2015-04-20T18:01:57Z' }
71
+ its(:updated_at) { is_expected.to eq '2015-04-21T18:46:05Z' }
72
+ its(:finished_at) { is_expected.to eq '2015-04-21T18:46:05Z' }
64
73
  its(:tech_metadata) { is_expected.to be_empty }
65
74
  end
66
75
  context "a completed encode" do
@@ -78,6 +87,9 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
78
87
  its(:current_operations) { is_expected.to include("Cleaning up") }
79
88
  its(:percent_complete) { is_expected.to eq 100 }
80
89
  its(:errors) { is_expected.to be_empty }
90
+ its(:created_at) { is_expected.to eq '2015-04-21T18:08:00Z' }
91
+ its(:updated_at) { is_expected.to eq '2015-04-21T18:14:18Z' }
92
+ its(:finished_at) { is_expected.to eq '2015-04-21T18:14:18Z' }
81
93
  its(:tech_metadata) { is_expected.to be_empty }
82
94
  end
83
95
  context "a failed encode" do
@@ -95,6 +107,9 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
95
107
  its(:current_operations) { is_expected.to include("Cleaning up after failure") }
96
108
  its(:percent_complete) { is_expected.to eq 56.666666666666664 }
97
109
  its(:errors) { is_expected.to include failed_errors }
110
+ its(:created_at) { is_expected.to eq '2015-04-09T16:12:00Z' }
111
+ its(:updated_at) { is_expected.to eq '2015-04-09T16:14:06Z' }
112
+ its(:finished_at) { is_expected.to eq '2015-04-09T16:14:06Z' }
98
113
  its(:tech_metadata) { is_expected.to include failed_tech_metadata }
99
114
  end
100
115
  end
@@ -166,6 +181,9 @@ describe ActiveEncode::EngineAdapters::MatterhornAdapter do
166
181
  its(:current_operations) { is_expected.to include("Hold for workflow selection") }
167
182
  its(:percent_complete) { is_expected.to eq 0.43478260869565216 }
168
183
  its(:errors) { is_expected.to be_empty }
184
+ its(:created_at) { is_expected.to eq '2015-04-20T17:58:43Z' }
185
+ its(:updated_at) { is_expected.to eq '2015-04-21T18:38:50Z' }
186
+ its(:finished_at) { is_expected.to be_nil }
169
187
  its(:tech_metadata) { is_expected.to be_empty }
170
188
  end
171
189
 
@@ -36,6 +36,9 @@ describe ActiveEncode::EngineAdapters::ShingoncoderAdapter do
36
36
  its(:current_operations) { is_expected.to be_empty }
37
37
  its(:percent_complete) { is_expected.to eq 0 }
38
38
  its(:errors) { is_expected.to be_empty }
39
+ its(:created_at) { is_expected.to eq '2015-06-10T14:38:47Z' }
40
+ its(:updated_at) { is_expected.to eq '2015-06-10T14:38:47Z' }
41
+ its(:finished_at) { is_expected.to be_nil }
39
42
  its(:tech_metadata) { is_expected.to be_empty }
40
43
  end
41
44
 
@@ -59,6 +62,9 @@ describe ActiveEncode::EngineAdapters::ShingoncoderAdapter do
59
62
  its(:current_operations) { is_expected.to be_empty }
60
63
  its(:percent_complete) { is_expected.to eq 30.0 }
61
64
  its(:errors) { is_expected.to be_empty }
65
+ its(:created_at) { is_expected.to eq '2015-06-09T16:18:26Z' }
66
+ its(:updated_at) { is_expected.to eq '2015-06-09T16:18:28Z' }
67
+ its(:finished_at) { is_expected.to be_nil }
62
68
  its(:tech_metadata) { is_expected.to eq running_tech_metadata }
63
69
  end
64
70
 
@@ -73,6 +79,9 @@ describe ActiveEncode::EngineAdapters::ShingoncoderAdapter do
73
79
  its(:current_operations) { is_expected.to be_empty }
74
80
  its(:percent_complete) { is_expected.to eq 0 }
75
81
  its(:errors) { is_expected.to be_empty }
82
+ its(:created_at) { is_expected.to eq '2015-06-08T20:43:23Z' }
83
+ its(:updated_at) { is_expected.to eq '2015-06-08T20:43:26Z' }
84
+ its(:finished_at) { is_expected.to eq '2015-06-08T20:43:26Z' }
76
85
  its(:tech_metadata) { is_expected.to be_empty }
77
86
  end
78
87
 
@@ -90,6 +99,9 @@ describe ActiveEncode::EngineAdapters::ShingoncoderAdapter do
90
99
  its(:current_operations) { is_expected.to be_empty }
91
100
  its(:percent_complete) { is_expected.to eq 100 }
92
101
  its(:errors) { is_expected.to be_empty }
102
+ its(:created_at) { is_expected.to eq '2015-06-08T18:13:53Z' }
103
+ its(:updated_at) { is_expected.to eq '2015-06-08T18:14:06Z' }
104
+ its(:finished_at) { is_expected.to eq '2015-06-08T18:14:06Z' }
93
105
  its(:tech_metadata) { is_expected.to eq completed_tech_metadata }
94
106
  end
95
107
 
@@ -106,6 +118,9 @@ describe ActiveEncode::EngineAdapters::ShingoncoderAdapter do
106
118
  its(:current_operations) { is_expected.to be_empty }
107
119
  its(:percent_complete) { is_expected.to eq 0 }
108
120
  its(:errors) { is_expected.to include failed_errors }
121
+ its(:created_at) { is_expected.to eq '2015-06-09T20:52:57Z' }
122
+ its(:updated_at) { is_expected.to eq '2015-06-09T20:53:00Z' }
123
+ its(:finished_at) { is_expected.to eq '2015-06-09T20:53:00Z' }
109
124
  its(:tech_metadata) { is_expected.to be_empty }
110
125
  end
111
126
  end
@@ -147,6 +162,9 @@ describe ActiveEncode::EngineAdapters::ShingoncoderAdapter do
147
162
  its(:current_operations) { is_expected.to be_empty }
148
163
  its(:percent_complete) { is_expected.to eq 30.0 }
149
164
  its(:errors) { is_expected.to be_empty }
165
+ its(:created_at) { is_expected.to eq '2015-06-09T16:18:26Z' }
166
+ its(:updated_at) { is_expected.to eq '2015-06-09T16:18:28Z' }
167
+ its(:finished_at) { is_expected.to be_nil }
150
168
  its(:tech_metadata) { is_expected.to eq reload_tech_metadata }
151
169
  end
152
170
  end
@@ -36,6 +36,9 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
36
36
  its(:current_operations) { is_expected.to be_empty }
37
37
  its(:percent_complete) { is_expected.to eq 0 }
38
38
  its(:errors) { is_expected.to be_empty }
39
+ its(:created_at) { is_expected.to eq '2015-06-10T14:38:47Z' }
40
+ its(:updated_at) { is_expected.to eq '2015-06-10T14:38:47Z' }
41
+ its(:finished_at) { is_expected.to be_nil }
39
42
  its(:tech_metadata) { is_expected.to be_empty }
40
43
  end
41
44
 
@@ -59,6 +62,9 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
59
62
  its(:current_operations) { is_expected.to be_empty }
60
63
  its(:percent_complete) { is_expected.to eq 30.0 }
61
64
  its(:errors) { is_expected.to be_empty }
65
+ its(:created_at) { is_expected.to eq '2015-06-09T16:18:26Z' }
66
+ its(:updated_at) { is_expected.to eq '2015-06-09T16:18:28Z' }
67
+ its(:finished_at) { is_expected.to be_nil }
62
68
  its(:tech_metadata) { is_expected.to eq running_tech_metadata }
63
69
  end
64
70
 
@@ -73,6 +79,9 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
73
79
  its(:current_operations) { is_expected.to be_empty }
74
80
  its(:percent_complete) { is_expected.to eq 0 }
75
81
  its(:errors) { is_expected.to be_empty }
82
+ its(:created_at) { is_expected.to eq '2015-06-08T20:43:23Z' }
83
+ its(:updated_at) { is_expected.to eq '2015-06-08T20:43:26Z' }
84
+ its(:finished_at) { is_expected.to eq '2015-06-08T20:43:26Z' }
76
85
  its(:tech_metadata) { is_expected.to be_empty }
77
86
  end
78
87
 
@@ -90,6 +99,9 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
90
99
  its(:current_operations) { is_expected.to be_empty }
91
100
  its(:percent_complete) { is_expected.to eq 100 }
92
101
  its(:errors) { is_expected.to be_empty }
102
+ its(:created_at) { is_expected.to eq '2015-06-08T18:13:53Z' }
103
+ its(:updated_at) { is_expected.to eq '2015-06-08T18:14:06Z' }
104
+ its(:finished_at) { is_expected.to eq '2015-06-08T18:14:06Z' }
93
105
  its(:tech_metadata) { is_expected.to eq completed_tech_metadata }
94
106
  end
95
107
 
@@ -106,6 +118,9 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
106
118
  its(:current_operations) { is_expected.to be_empty }
107
119
  its(:percent_complete) { is_expected.to eq 0 }
108
120
  its(:errors) { is_expected.to include failed_errors }
121
+ its(:created_at) { is_expected.to eq '2015-06-09T20:52:57Z' }
122
+ its(:updated_at) { is_expected.to eq '2015-06-09T20:53:00Z' }
123
+ its(:finished_at) { is_expected.to eq '2015-06-09T20:53:00Z' }
109
124
  its(:tech_metadata) { is_expected.to be_empty }
110
125
  end
111
126
  end
@@ -147,6 +162,9 @@ describe ActiveEncode::EngineAdapters::ZencoderAdapter do
147
162
  its(:current_operations) { is_expected.to be_empty }
148
163
  its(:percent_complete) { is_expected.to eq 30.0 }
149
164
  its(:errors) { is_expected.to be_empty }
165
+ its(:created_at) { is_expected.to eq '2015-06-09T16:18:26Z' }
166
+ its(:updated_at) { is_expected.to eq '2015-06-09T16:18:28Z' }
167
+ its(:finished_at) { is_expected.to be_nil }
150
168
  its(:tech_metadata) { is_expected.to eq reload_tech_metadata }
151
169
  end
152
170
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_encode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein, Chris Colvard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.4.7
178
+ rubygems_version: 2.5.1
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Declare encode job classes that can be run by a variety of encoding services