Class: Woods::Operator::StatusReporter
- Inherits:
-
Object
- Object
- Woods::Operator::StatusReporter
- Defined in:
- lib/woods/operator/status_reporter.rb
Overview
Reports pipeline status by reading extraction output metadata.
Constant Summary collapse
- STALE_THRESHOLD =
24 hours
86_400
Instance Method Summary collapse
-
#initialize(output_dir:) ⇒ StatusReporter
constructor
A new instance of StatusReporter.
-
#report ⇒ Hash
Generate a pipeline status report.
Constructor Details
#initialize(output_dir:) ⇒ StatusReporter
Returns a new instance of StatusReporter.
20 21 22 |
# File 'lib/woods/operator/status_reporter.rb', line 20 def initialize(output_dir:) @output_dir = output_dir end |
Instance Method Details
#report ⇒ Hash
Generate a pipeline status report.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/woods/operator/status_reporter.rb', line 27 def report manifest = read_manifest return not_extracted_report if manifest.nil? staleness = compute_staleness(manifest['extracted_at']) { status: staleness < STALE_THRESHOLD ? :ok : :stale, extracted_at: manifest['extracted_at'], total_units: manifest['total_units'] || 0, counts: manifest['counts'] || {}, git_sha: manifest['git_sha'], git_branch: manifest['git_branch'], staleness_seconds: staleness } end |