Class: Logical::Naf::JobFetcher
- Inherits:
-
Object
- Object
- Logical::Naf::JobFetcher
- Includes:
- Af::Application::SafeProxy
- Defined in:
- app/models/logical/naf/job_fetcher.rb
Instance Attribute Summary collapse
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
Instance Method Summary collapse
- #fetch_next_job ⇒ Object
-
#initialize(machine) ⇒ JobFetcher
constructor
A new instance of JobFetcher.
Constructor Details
#initialize(machine) ⇒ JobFetcher
Returns a new instance of JobFetcher.
8 9 10 |
# File 'app/models/logical/naf/job_fetcher.rb', line 8 def initialize(machine) @machine = machine end |
Instance Attribute Details
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
6 7 8 |
# File 'app/models/logical/naf/job_fetcher.rb', line 6 def machine @machine end |
Instance Method Details
#fetch_next_job ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/logical/naf/job_fetcher.rb', line 12 def fetch_next_job fetch_possible_jobs.each do |possible_job| running_job = nil ::Naf::HistoricalJob.lock_for_job_queue do running_job = start_job(possible_job) end if running_job.present? # Update tags running_job.historical_job.([::Naf::HistoricalJob::SYSTEM_TAGS[:pre_work]]) running_job.historical_job.([::Naf::HistoricalJob::SYSTEM_TAGS[:work]]) # found a job parse_log_level(running_job) return running_job end end # no jobs found return nil end |