Skip to content

Commit 2eec938

Browse files
committed
feat: Add mode param to Job.output?
1 parent dd71081 commit 2eec938

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/kiba/extend/job.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ def output_fields(jobkey)
2626
end
2727

2828
# @param jobkey [Symbol] registry entry for job with namespace
29+
# @param mode [:warn, :agnostic] use :agnostic in dynamic code where not
30+
# all jobs tried are expected to actually exist
2931
# @return [true] if output file already exists when run, or when running
3032
# job results in 1 or more rows being written
3133
# @return [false] if jobkey is not defined, or if job results in 0 rows
3234
# when run
3335
# @since 4.0.0
34-
def output?(jobkey)
36+
def output?(jobkey, mode: :warn_if_unregistered)
3537
begin
3638
reg = Kiba::Extend::Registry.entry_for(jobkey)
3739
rescue Kiba::Extend::JobNotRegisteredError => err
38-
puts "#{Kiba::Extend.warning_label}: #{err.message}"
40+
puts "#{Kiba::Extend.warning_label}: #{err.message}" if mode == :warn
3941
return false
4042
end
4143
return true if File.exist?(reg.path)

0 commit comments

Comments
 (0)