Created
March 5, 2020 01:20
-
-
Save blairanderson/f0b49fb84abfb56e32f13395ddba0196 to your computer and use it in GitHub Desktop.
idea for rails ETL with ActiveStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HighAvailabilityETL < RailsFoo | |
has_one_attached :input | |
has_one_attached :translate_step1 | |
has_one_attached :translate_step2 | |
has_one_attached :translate_step3 | |
has_one_attached :output | |
def runner | |
step1_errors = input_to_translate_step1! unless input.attached? | |
step2_errors = step1_to_step2! unless translate_step1.attached? | |
step3_errors = step2_to_step3! unless translate_step2.attached? | |
final_errors = step3_to_final! unless translate_step3.attached? | |
return { | |
:input => input.attached?, | |
:translate_step1 => translate_step1.attached?, | |
:translate_step1_errors => step1_errors, | |
:translate_step2 => translate_step2.attached?, | |
:translate_step2_errors => step2_errors, | |
:translate_step3 => translate_step3.attached?, | |
:translate_step3_errors => step3_errors, | |
:output => output.attached?, | |
:output_errors => final_errors | |
} | |
end | |
def input_to_translate_step1! | |
end | |
def step1_to_step2! | |
end | |
def step2_to_step3! | |
end | |
def step3_to_final! | |
return "sorry there was a failure" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment