Page MenuHomePhabricator

solid_subset example
ActivePublic

Authored by alangenfeld on Oct 28 2019, 4:20 PM.
def test_toggle_pipeline_2():
@lambda_solid
def generate_a():
return ['A']
@lambda_solid
def generate_b():
return ['B']
@lambda_solid
def input_mux(a, b):
if a and b:
return a + b
elif b:
return b
return a
@lambda_solid
def do_stuff(selected_in):
return len(selected_in)
@pipeline
def selective_pipeline():
# A simpler example but you get the gist
a = generate_a()
b = generate_b()
selected = input_mux(a, b)
do_stuff(selected)
# execute a few different selections
execute_pipeline(
selective_pipeline.build_sub_pipeline(solid_subset=['do_stuff', 'input_mux', 'generate_a']),
environment_dict={
# We need to provide values via config for the missing inputs, this is kind of annoying and
# points at an improvement to the system that should happen.
'solids': {'input_mux': {'inputs': {'b': {'value': None}}}}
},
)
execute_pipeline(
selective_pipeline.build_sub_pipeline(solid_subset=['do_stuff', 'input_mux', 'generate_b']),
environment_dict={'solids': {'input_mux': {'inputs': {'a': {'value': None}}}}},
)

Event Timeline

alangenfeld changed the visibility from "All Users" to "Public (No Login Required)".
alangenfeld edited the content of this paste. (Show Details)