Example #1
0
def test_run_cloud():
    events = []

    def _event_callback(ev):
        events.append(ev)

    result = execute_pipeline(
        define_resource_test_pipeline(),
        environment={
            'context': {
                'cloud': {
                    'resources': {
                        'store': {'config': {'username': '******', 'password': '******'}}
                    }
                }
            },
            'solids': {'add_ints': {'inputs': {'num_one': {'value': 2}, 'num_two': {'value': 6}}}},
        },
        reentrant_info=ReentrantInfo(event_callback=_event_callback),
    )

    assert result.success
    assert result.result_for_solid('add_ints').transformed_value() == 8

    assert not has_message(events, 'Setting key=add value=8 in memory')
    assert has_message(events, 'Setting key=add value=8 in cloud')
Example #2
0
def test_run_local():
    events = []

    def _event_callback(ev):
        events.append(ev)

    result = execute_pipeline(
        define_resource_test_pipeline(),
        environment_dict={
            'context': {
                'local': {}
            },
            'solids': {
                'add_ints': {
                    'inputs': {
                        'num_one': {
                            'value': 2
                        },
                        'num_two': {
                            'value': 3
                        }
                    }
                }
            },
        },
        execution_metadata=ExecutionMetadata(event_callback=_event_callback),
    )

    assert result.success
    assert result.result_for_solid('add_ints').transformed_value() == 5

    assert has_message(events, 'Setting key=add value=5 in memory')
    assert not has_message(events, 'Setting key=add value=5 in cloud')