コード例 #1
0
def test_no_outputs_no_inputs_config_schema():
    assert create_environment_config(no_input_no_output_pipeline())

    with pytest.raises(PipelineConfigEvaluationError) as exc_context:
        create_environment_config(no_input_no_output_pipeline(), {'solids': {'return_one': {}}})

    assert len(exc_context.value.errors) == 1
    assert 'Error 1: Undefined field "return_one" at path root:solids' in exc_context.value.message
コード例 #2
0
def test_basic_json_misnamed_output_config_schema():
    with pytest.raises(PipelineConfigEvaluationError) as exc_context:
        create_environment_config(
            single_int_named_output_pipeline(),
            {
                'solids': {
                    'return_named_one': {'outputs': [{'wrong_name': {'json': {'path': 'foo'}}}]}
                }
            },
        )

    assert len(exc_context.value.errors) == 1
    assert 'Error 1: Undefined field "wrong_name"' in exc_context.value.message
    assert 'at path root:solids:return_named_one:outputs[0]' in exc_context.value.message
コード例 #3
0
def test_basic_json_default_output_config_schema():
    env = create_environment_config(
        single_int_output_pipeline(),
        {
            'solids': {
                'return_one': {
                    'outputs': [{
                        'result': {
                            'json': {
                                'path': 'foo'
                            }
                        }
                    }]
                }
            }
        },
    )

    assert env.solids['return_one']
    assert env.solids['return_one'].outputs == [{
        'result': {
            'json': {
                'path': 'foo'
            }
        }
    }]
コード例 #4
0
def test_no_outputs_one_input_config_schema():
    assert create_environment_config(
        one_input_no_output_pipeline(),
        {'solids': {'take_input_return_nothing': {'inputs': {'dummy': {'value': 'value'}}}}},
    )

    with pytest.raises(PipelineConfigEvaluationError) as exc_context:
        create_environment_config(
            one_input_no_output_pipeline(),
            {
                'solids': {
                    'take_input_return_nothing': {
                        'inputs': {'dummy': {'value': 'value'}},
                        'outputs': {},
                    }
                }
            },
        )

    assert len(exc_context.value.errors) == 1
    exp_msg = 'Error 1: Undefined field "outputs" at path root:solids:take_input_return_nothing'
    assert exp_msg in exc_context.value.message
コード例 #5
0
ファイル: test.py プロジェクト: wslulciuc/dagster
def create_test_pipeline_execution_context(loggers=None,
                                           resources=None,
                                           tags=None):
    run_id = str(uuid.uuid4())
    pipeline_def = PipelineDefinition(name='test_legacy_context', solids=[])
    return construct_pipeline_execution_context(
        execution_metadata=ExecutionMetadata(run_id,
                                             tags=tags,
                                             loggers=loggers),
        pipeline=pipeline_def,
        execution_context=ExecutionContext(),
        resources=resources,
        environment_config=create_environment_config(pipeline_def),
    )
コード例 #6
0
ファイル: test.py プロジェクト: zorrock/dagster
def create_test_pipeline_execution_context(loggers=None,
                                           resources=None,
                                           tags=None):
    run_id = str(uuid.uuid4())
    pipeline_def = PipelineDefinition(name='test_legacy_context', solids=[])
    return construct_pipeline_execution_context(
        run_config=RunConfig(run_id, tags=tags, loggers=loggers),
        pipeline=pipeline_def,
        execution_context=ExecutionContext(),
        resources=resources,
        environment_config=create_environment_config(pipeline_def),
        run_storage=InMemoryRunStorage(),
        intermediates_manager=InMemoryIntermediatesManager(),
    )