triglav-agent-hdfs 1.0.0.rc1-java → 1.0.0.rc2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/triglav/agent/hdfs/monitor.rb +13 -17
- data/lib/triglav/agent/hdfs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a91b6b3c3c5eaed6e47873427df60d5cd527035
|
4
|
+
data.tar.gz: 03e5d911634698e925262c56dce8410fc2ecebd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10942b411143434c33d50dbcb675a5780db045f5010d5be544414cecd4bb96cb48645b2e50c538bc2d951139f39bb525a1100596bf1cc55d1657f93cad64d01b
|
7
|
+
data.tar.gz: 4e61d0f7dcbfd67f7fdf87e7955e2e0977824d2a20a3bf0548af6b1a71c5cb3911ba831cce640e98d6f9371923e19182389e6d2d0dc77a55484270f46653edb2
|
@@ -29,7 +29,6 @@ module Triglav::Agent
|
|
29
29
|
$logger.warn { "Broken resource: #{resource.to_s}" }
|
30
30
|
return nil
|
31
31
|
end
|
32
|
-
|
33
32
|
$logger.debug { "Start process #{resource.uri}" }
|
34
33
|
|
35
34
|
events, new_last_modification_times = get_events
|
@@ -45,9 +44,9 @@ module Triglav::Agent
|
|
45
44
|
private
|
46
45
|
|
47
46
|
def get_events
|
48
|
-
|
47
|
+
new_last_modification_times = get_new_last_modification_times
|
48
|
+
latest_files = select_latest_files(new_last_modification_times)
|
49
49
|
events = build_events(latest_files)
|
50
|
-
new_last_modification_times = build_last_modification_times(latest_files)
|
51
50
|
[events, new_last_modification_times]
|
52
51
|
rescue => e
|
53
52
|
$logger.warn { "#{e.class} #{e.message} #{e.backtrace.join("\n ")}" }
|
@@ -135,32 +134,29 @@ module Triglav::Agent
|
|
135
134
|
@paths = paths
|
136
135
|
end
|
137
136
|
|
138
|
-
def
|
139
|
-
|
137
|
+
def get_new_last_modification_times
|
138
|
+
new_last_modification_times = {}
|
140
139
|
paths.each do |path, date_hour|
|
141
140
|
latest_file = connection.get_latest_file_under(path.to_s)
|
142
141
|
unless latest_file
|
143
142
|
$logger.debug { "get_latest_file_under(\"#{path.to_s}\") #=> does not exist" }
|
144
143
|
next
|
145
144
|
end
|
146
|
-
|
147
|
-
$logger.debug { "get_latest_file_under(\"#{path.to_s}\") #=> latest_modification_time:#{latest_file.modification_time}, is_newer:#{is_newer}" }
|
148
|
-
next unless is_newer
|
149
|
-
latest_files[path.to_sym] = latest_file
|
145
|
+
new_last_modification_times[path.to_sym] = latest_file.modification_time
|
150
146
|
end
|
151
|
-
|
147
|
+
new_last_modification_times
|
152
148
|
end
|
153
149
|
|
154
|
-
def
|
155
|
-
|
156
|
-
|
157
|
-
|
150
|
+
def select_latest_files(new_last_modification_times)
|
151
|
+
new_last_modification_times.select do |path, new_last_modification_time|
|
152
|
+
is_newer = new_last_modification_time > (last_modification_times[path] || 0)
|
153
|
+
$logger.debug { "#{path.to_s} #=> last_modification_time:#{new_last_modification_time}, is_newer:#{is_newer}" }
|
154
|
+
is_newer
|
158
155
|
end
|
159
|
-
last_modification_times
|
160
156
|
end
|
161
157
|
|
162
158
|
def build_events(latest_files)
|
163
|
-
latest_files.map do |path,
|
159
|
+
latest_files.map do |path, last_modification_time|
|
164
160
|
date, hour = date_hour = paths[path]
|
165
161
|
{
|
166
162
|
uuid: SecureRandom.uuid,
|
@@ -168,7 +164,7 @@ module Triglav::Agent
|
|
168
164
|
resource_unit: resource.unit,
|
169
165
|
resource_time: date_hour_to_i(date, hour, resource.timezone),
|
170
166
|
resource_timezone: resource.timezone,
|
171
|
-
payload: {path:
|
167
|
+
payload: {path: path.to_s, modification_time: last_modification_time}.to_json, # msec
|
172
168
|
}
|
173
169
|
end
|
174
170
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: triglav-agent-hdfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Triglav Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|