Module: Kiba::Extend::Job

Defined in:
lib/kiba/extend/job.rb

Overview

Convenience methods callable on a given job

Class Method Summary collapse

Class Method Details

.output?(jobkey) ⇒ true, false

Parameters:

  • jobkey (Symbol)

    registry entry for job with namespace

Returns:

  • (true)

    if output file already exists when run, or when running job results in 1 or more rows being written

  • (false)

    if jobkey is not defined, or if job results in 0 rows when run

Since:

  • 4.0.0



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/kiba/extend/job.rb', line 16

def output?(jobkey)
  begin
    reg = Kiba::Extend.registry.resolve(jobkey)
  rescue Dry::Container::KeyError
    return false
  end
  return true if File.exist?(reg.path)

  res = Kiba::Extend::Command::Run.job(jobkey)
  return false unless res

  !(res.outrows == 0)
end