Module: Ductr::Store::PipelineSerializer

Includes:
JobSerializer
Included in:
PipelineStore
Defined in:
lib/ductr/store/pipeline_serializer.rb

Overview

Convert pipelines and steps into active job serializable structs.

Defined Under Namespace

Classes: SerializedPipeline, SerializedPipelineStep

Instance Method Summary collapse

Methods included from JobSerializer

#serialize_job

Instance Method Details

#serialize_pipeline(pipeline) ⇒ SerializedPipeline

Convert the given pipeline and its steps into ‘SerializedPipeline` and `SerializedPipelineStep` structs.

Parameters:

  • pipeline (Pipeline)

    The pipeline to serialize

Returns:



95
96
97
98
99
100
101
102
103
# File 'lib/ductr/store/pipeline_serializer.rb', line 95

def serialize_pipeline(pipeline)
  serialized_steps = pipeline.runner.steps.map do |step|
    jobs = step.jobs.map { |j| serialize_job(j) }

    SerializedPipelineStep.new(jobs, step.done?)
  end

  SerializedPipeline.new(pipeline.job_id, pipeline.status, pipeline.error, serialized_steps)
end