Class: Bosh::Director::Jobs::FetchLogs
- Includes:
- LockHelper
- Defined in:
- lib/bosh/director/jobs/fetch_logs.rb
Instance Attribute Summary
Attributes inherited from BaseJob
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(instance_id, options = {}) ⇒ FetchLogs
constructor
A new instance of FetchLogs.
- #perform ⇒ Object
Methods included from LockHelper
#with_compile_lock, #with_deployment_lock, #with_release_lock, #with_release_locks, #with_stemcell_lock
Methods inherited from BaseJob
#begin_stage, #event_log, #logger, perform, #result_file, #single_step_stage, #task_cancelled?, #task_checkpoint, #track_and_log
Constructor Details
#initialize(instance_id, options = {}) ⇒ FetchLogs
Returns a new instance of FetchLogs.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bosh/director/jobs/fetch_logs.rb', line 12 def initialize(instance_id, = {}) @instance_id = instance_id @log_type = ["type"] || "job" @filters = ["filters"] @instance_manager = Api::InstanceManager.new blobstore = .fetch(:blobstore) { App.instance.blobstores.blobstore } log_bundles_cleaner = LogBundlesCleaner.new(blobstore, 60 * 60 * 24 * 10, logger) # 10 days @logs_fetcher = LogsFetcher.new(event_log, @instance_manager, log_bundles_cleaner, logger) end |
Class Method Details
.job_type ⇒ Object
8 9 10 |
# File 'lib/bosh/director/jobs/fetch_logs.rb', line 8 def self.job_type :fetch_logs end |
Instance Method Details
#perform ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bosh/director/jobs/fetch_logs.rb', line 23 def perform instance = @instance_manager.find_instance(@instance_id) desc = "#{instance.job}/#{instance.index}" deployment = instance.deployment if deployment.nil? raise InstanceDeploymentMissing, "`#{desc}' doesn't belong to any deployment" end with_deployment_lock(deployment) do @logs_fetcher.fetch(instance, @log_type, @filter) end end |