Module: Bj::Table::Job::ClassMethods

Defined in:
lib/bj/table.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) submit(jobs, options = {}, &block)



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/bj/table.rb', line 128

def submit jobs, options = {}, &block
  jobs = Joblist.for jobs, options
  returned = []
  transaction do
    jobs.each do |job|
      job = create_hash_for(job.reverse_merge(submit_defaults))
      job = create! job 
      returned << (block ? block.call(job) : job)
    end
  end
  returned
end

- (Object) submit_defaults



141
142
143
144
145
146
147
148
149
150
# File 'lib/bj/table.rb', line 141

def submit_defaults
  {
    :state => "pending",
    :priority => 0,
    :tag => "",
    :is_restartable => true,
    :submitter => Bj.hostname,
    :submitted_at => Time.now, 
  }
end