frozen_string_literal: true
Force the task
to be executed even if it should otherwise be
ignored due to reasons: :noref
, :multi
, or
:nonmulti
. Other reasons to ignore a task are not affected by
metadata forcing
# File lib/miga/dataset/result/ignore.rb, line 131 def force_task?(task) !!metadata["run_#{task}"] end
Ignore task
by type
of
dataset, one of: :noref
, :multi
, or
:nonmulti
, :nomarkers
# File lib/miga/dataset/result/ignore.rb, line 107 def ignore_by_type?(task, type) return false if force_task?(task) test, list = case type.to_sym when :noref [:ref?, self.class.EXCLUDE_NOREF_TASKS] when :multi [:multi?, self.class.ONLY_MULTI_TASKS] when :nonmulti [:nonmulti?, self.class.ONLY_NONMULTI_TASKS] when :nomarkers [:markers?, self.class.EXCLUDE_NOMARKER_TASKS] else raise "Unexpected error, unknown type reason: #{type}" end list.include?(task) && !send(test) end
Ignore task
because it's already
done
# File lib/miga/dataset/result/ignore.rb, line 45 def ignore_complete?(task) !get_result(task).nil? end
Ignore any task because the dataset is empty
(_task
is ignored)
# File lib/miga/dataset/result/ignore.rb, line 57 def ignore_empty?(_task) first_preprocessing.nil? end
Ignore task
because the metadata
says so
# File lib/miga/dataset/result/ignore.rb, line 70 def ignore_force?(task) !(metadata["run_#{task}"].nil? || metadata["run_#{task}"]) end
Ignore any task because the dataset is inactive
(_task
is ignored)
# File lib/miga/dataset/result/ignore.rb, line 51 def ignore_inactive?(_task) !active? end
Ignore task
because it's not a
multi dataset
# File lib/miga/dataset/result/ignore.rb, line 88 def ignore_multi?(task) ignore_by_type?(task, :multi) end
Ignore task
because it's not a
markers dataset
# File lib/miga/dataset/result/ignore.rb, line 100 def ignore_nomarkers?(task) ignore_by_type?(task, :nomarkers) end
Ignore task
because it's not a
nonmulti dataset
# File lib/miga/dataset/result/ignore.rb, line 94 def ignore_nonmulti?(task) ignore_by_type?(task, :nonmulti) end
Ignore task
because it's not a
reference dataset
# File lib/miga/dataset/result/ignore.rb, line 82 def ignore_noref?(task) ignore_by_type?(task, :noref) end
Ignore task
because the project is
not compatible
# File lib/miga/dataset/result/ignore.rb, line 76 def ignore_project?(task) task == :taxonomy && project.option(:ref_project).nil? end
Returns an array of symbols indicating all the possible reasons why a given task migh be ignored:
empty: the dataset has no data
inactive: the dataset is inactive
upstream: the task is upstream from dataset's input
force: forced to ignore by metadata
project: incompatible project
noref: incompatible dataset, only for reference
multi: incompatible dataset, only for multi
nomarkers: incompatible dataset, only for markers
nonmulti: incompatible dataset, only for nonmulti
complete: the task is already complete
# File lib/miga/dataset/result/ignore.rb, line 23 def ignore_reasons %[ empty inactive upstream force project noref multi nonmulti nomarkers complete ] end
Should I ignore task
for this dataset?
# File lib/miga/dataset/result/ignore.rb, line 6 def ignore_task?(task) why_ignore(task) != :execute end
Ignore task
because it's
upstream from the entry point
# File lib/miga/dataset/result/ignore.rb, line 63 def ignore_upstream?(task) self.class.PREPROCESSING_TASKS.index(task) < self.class.PREPROCESSING_TASKS.index(first_preprocessing) end
Return a code explaining why a task is ignored (see
ignore_reasons
) or the symbol :execute
(do not
ignore, execute the task)
# File lib/miga/dataset/result/ignore.rb, line 33 def why_ignore(task) # Find a reason to ignore it ignore_reasons.each do |i| return i if send(:"ignore_#{i}?", task) end # Otherwise, execute return :execute end