Sha256: 953288a008b81c6e2e2f3b442ba06842602d528a102ab9c2e220d8c526d7ebe8

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

class Step
  def abort(exception = nil)
    if (pid = info[:pid]) && pid != Process.pid && Misc.pid_alive?(pid)
      Process.kill pid
    else
      while @result && streaming? && stream = self.stream
        stream.abort(exception)
      end
    end
  end

  def recoverable_error?
    self.error? && ! (ScoutException === self.exception)
  end

  def updated?
    return false if self.error? && self.recoverable_error?
    return true if self.done? && ! ENV["SCOUT_UPDATE"]
    newer = rec_dependencies.select{|dep| Path.newer?(self.path, dep.path) }
    newer += input_dependencies.select{|dep| Path.newer?(self.path, dep.path) }

    newer.empty?
  end

  def clean
    @take_stream = nil 
    @result = nil
    @info = nil
    @info_load_time = nil
    Open.rm path if Open.exist?(path)
    Open.rm tmp_path if Open.exist?(tmp_path)
    Open.rm info_file if Open.exist?(info_file)
    Open.rm_rf files_dir if Open.exist?(files_dir)
  end

  def self.clean(file)
    Step.new(file).clean
  end


  def recursive_clean
    dependencies.each do |dep|
      dep.recursive_clean
    end
    clean
  end

  def canfail?
    @compute && @compute.include?(:canfail)
  end

  def started?
    return true if done?
    return false unless Open.exist?(info_file)
    pid = info[:pid]
    return false unless pid
    return Misc.pid_alive?(pid)
  end

  def waiting?
    present? and not started?
  end

  def dirty?
    done? && ! updated?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scout-gear-10.0.1 lib/scout/workflow/step/status.rb
scout-gear-9.1.0 lib/scout/workflow/step/status.rb