triglav-agent 1.0.0.pre2 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/docs/Triglav.html +1 -1
  4. data/docs/Triglav/Agent.html +2 -2
  5. data/docs/Triglav/Agent/ApiClient.html +82 -20
  6. data/docs/Triglav/Agent/ApiClient/AuthenticationError.html +1 -1
  7. data/docs/Triglav/Agent/ApiClient/ConnectionError.html +1 -1
  8. data/docs/Triglav/Agent/ApiClient/Error.html +1 -1
  9. data/docs/Triglav/Agent/Base.html +1 -1
  10. data/docs/Triglav/Agent/Base/CLI.html +21 -19
  11. data/docs/Triglav/Agent/Base/Connection.html +92 -6
  12. data/docs/Triglav/Agent/Base/Monitor.html +1 -1
  13. data/docs/Triglav/Agent/Base/Processor.html +22 -30
  14. data/docs/Triglav/Agent/Base/Setting.html +65 -63
  15. data/docs/Triglav/Agent/Base/Worker.html +1 -1
  16. data/docs/Triglav/Agent/Configuration.html +1 -1
  17. data/docs/Triglav/Agent/Error.html +1 -1
  18. data/docs/Triglav/Agent/HashUtil.html +1 -1
  19. data/docs/Triglav/Agent/LogFormatter.html +1 -1
  20. data/docs/Triglav/Agent/Logger.html +1 -1
  21. data/docs/Triglav/Agent/StorageFile.html +1 -1
  22. data/docs/Triglav/Agent/Timer.html +1 -1
  23. data/docs/Triglav/Agent/TooManyError.html +1 -1
  24. data/docs/_index.html +1 -1
  25. data/docs/file.LICENSE.html +2 -2
  26. data/docs/file.README.html +1 -1
  27. data/docs/index.html +1 -1
  28. data/docs/method_list.html +50 -34
  29. data/docs/top-level-namespace.html +1 -1
  30. data/lib/triglav/agent.rb +1 -0
  31. data/lib/triglav/agent/base/cli.rb +4 -2
  32. data/lib/triglav/agent/base/processor.rb +4 -1
  33. data/lib/triglav/agent/base/setting.rb +4 -2
  34. data/lib/triglav/agent/base/worker.rb +7 -0
  35. data/lib/triglav/agent/status.rb +68 -0
  36. data/lib/triglav/agent/storage_file.rb +20 -0
  37. data/lib/triglav/agent/version.rb +1 -1
  38. data/triglav-agent.gemspec +2 -2
  39. metadata +5 -4
@@ -1,5 +1,6 @@
1
1
  require 'triglav/agent/hash_util'
2
2
  require 'yaml'
3
+ require 'set'
3
4
 
4
5
  module Triglav::Agent
5
6
  # Thread and inter-process safe YAML file storage
@@ -140,5 +141,24 @@ module Triglav::Agent
140
141
  def dump(hash)
141
142
  File.write(@fp.path, YAML.dump(hash))
142
143
  end
144
+
145
+ # Keep specified keys, and remove others
146
+ #
147
+ # @param [String] path
148
+ # @param [Array] parent keys of hash
149
+ # @param [Array] keys
150
+ def self.select!(path, parents = [], keys)
151
+ open(path) do |fp|
152
+ params = fp.load
153
+ if dig = (parents.empty? ? params : params.dig(*parents))
154
+ removes = dig.keys - keys
155
+ unless removes.empty?
156
+ $logger.info { "Remove from status: #{{parent_keys: parents, keys: removes}}" }
157
+ removes.each {|k| dig.delete(k) }
158
+ end
159
+ end
160
+ fp.dump(params)
161
+ end
162
+ end
143
163
  end
144
164
  end
@@ -1,5 +1,5 @@
1
1
  module Triglav
2
2
  module Agent
3
- VERSION = "1.0.0.pre2"
3
+ VERSION = "1.0.0.rc1"
4
4
  end
5
5
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Triglav Team"]
10
10
  spec.email = ["triglav_admin_my@dena.jp"]
11
11
 
12
- spec.summary = %q{Agent framework of triglav, data-driven workflow tool.}
13
- spec.description = %q{Agent framework of triglav, data-driven workflow tool.}
12
+ spec.summary = %q{Agent framework for triglav, data-driven workflow tool.}
13
+ spec.description = %q{Agent framework for triglav, data-driven workflow tool.}
14
14
  spec.homepage = "https://github.com/triglav-dataflow/triglav-agent-framework-ruby"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triglav-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre2
4
+ version: 1.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Triglav Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-08 00:00:00.000000000 Z
11
+ date: 2017-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serverengine
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- description: Agent framework of triglav, data-driven workflow tool.
153
+ description: Agent framework for triglav, data-driven workflow tool.
154
154
  email:
155
155
  - triglav_admin_my@dena.jp
156
156
  executables: []
@@ -219,6 +219,7 @@ files:
219
219
  - lib/triglav/agent/error.rb
220
220
  - lib/triglav/agent/hash_util.rb
221
221
  - lib/triglav/agent/logger.rb
222
+ - lib/triglav/agent/status.rb
222
223
  - lib/triglav/agent/storage_file.rb
223
224
  - lib/triglav/agent/timer.rb
224
225
  - lib/triglav/agent/version.rb
@@ -246,5 +247,5 @@ rubyforge_project:
246
247
  rubygems_version: 2.5.2
247
248
  signing_key:
248
249
  specification_version: 4
249
- summary: Agent framework of triglav, data-driven workflow tool.
250
+ summary: Agent framework for triglav, data-driven workflow tool.
250
251
  test_files: []