Ejemplo n.º 1
0
def execute_test_a_plus_b_final_subdag():
    results = execute_solids(
        part_fourteen_step_one_pipeline,
        ['a_plus_b', 'final'],
        inputs={
            'a_plus_b': {
                'num1': 2,
                'num2': 4
            },
            'final': {
                'num2': 6
            }
        },
    )

    assert results['a_plus_b'].result_value() == 6
    assert results['final'].result_value() == 36
Ejemplo n.º 2
0
def test_subset_with_mode_definitions():

    called = {'a': 0, 'b': 0}

    @resource
    def resource_a(_init_context):
        return 1

    @solid(resources={'a'})
    def requires_a(context):
        called['a'] += 1
        assert context.resources.a == 1

    @resource
    def resource_b(_init_context):
        return 2

    @solid(resources={'b'})
    def requires_b(context):
        called['b'] += 1
        assert context.resources.b == 2

    pipeline_def = PipelineDefinition(
        name='subset_test',
        solids=[requires_a, requires_b],
        mode_definitions=[
            ModeDefinition(resources={
                'a': resource_a,
                'b': resource_b
            })
        ],
    )

    assert execute_pipeline(pipeline_def).success is True

    assert called == {'a': 1, 'b': 1}

    assert execute_solids(
        pipeline_def, solid_names=['requires_a'])['requires_a'].success is True

    assert called == {'a': 2, 'b': 1}