Sha256: d1a8acac24ac70b2a1d7b25b8fdc220ba5f7266b8b9d1811507ddf74582b0bcb
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
module Eco module API class Session class BatchJobs < API::Common::Session::BaseSession attr_reader :name def initialize(e, name:) super(e) @name = name reset end def reset @jobs = {} @callbacks = {} end def [](name) @jobs[name] end def exists?(name) @jobs.key?(name) end def new(name, type:, sets:) fatal "Can't create job named '#{name}' because it already exists." if exists?(name) job = BatchJob.new(enviro, name: name, type: type, sets: sets) @jobs[name] = job @callbacks[job] = Proc.new if block_given? job end def pending? @jobs.keys.any? do |key| @jobs[key].pending? end end def launch(simulate: false) group_status = {} @jobs.each do |name, job| group_status[job] = job_status = job.launch(simulate: simulate) callback = @callbacks[job] callback.call(job, job_status) if callback end return group_status end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
eco-helpers-0.6.17 | lib/eco/api/session/batch_jobs.rb |
eco-helpers-0.6.16 | lib/eco/api/session/batch_jobs.rb |
eco-helpers-0.6.15 | lib/eco/api/session/batch_jobs.rb |