コード例 #1
0
def test_cli_execute_failure():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    # with pytest.raises(DagsterExecutionStepExecutionError) as e_info:
    cwd = os.getcwd()
    try:

        os.chdir(file_relative_path(__file__, '../..'))

        result = do_execute_command(
            pipeline_def=pandas_hello_world_fails,
            env_file_list=[
                file_relative_path(
                    __file__,
                    '../../dagster_pandas/examples/pandas_hello_world/*.yaml')
            ],
        )
        failures = [
            event for event in result.step_event_list if event.is_failure
        ]
    finally:
        # restore cwd
        os.chdir(cwd)

    assert len(failures) == 1
    assert 'I am a programmer and I make error' in failures[
        0].step_failure_data.error.message
コード例 #2
0
def test_cli_execute_failure():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    # with pytest.raises(DagsterExecutionStepExecutionError) as e_info:
    cwd = os.getcwd()
    try:

        os.chdir(file_relative_path(__file__, "../.."))
        with instance_for_test() as instance:
            result = do_execute_command(
                pipeline=ReconstructablePipeline.for_module(
                    "dagster_pandas.examples",
                    "pandas_hello_world_fails_test",
                ),
                instance=instance,
                config=[
                    file_relative_path(
                        __file__,
                        "../../dagster_pandas/examples/pandas_hello_world/*.yaml"
                    )
                ],
            )
        failures = [
            event for event in result.step_event_list if event.is_failure
        ]
    finally:
        # restore cwd
        os.chdir(cwd)

    assert len(failures) == 1
    assert "I am a programmer and I make error" in failures[
        0].step_failure_data.error.cause.message
コード例 #3
0
def test_cli_execute():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    cwd = os.getcwd()
    try:

        os.chdir(script_relative_path('../..'))

        do_execute_command(
            define_success_pipeline(),
            script_relative_path('../../pandas_hello_world/env.yml'),
            lambda *_args, **_kwargs: None,
        )
    finally:
        # restore cwd
        os.chdir(cwd)
コード例 #4
0
def test_cli_execute():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    cwd = os.getcwd()
    try:

        os.chdir(script_relative_path('../..'))

        do_execute_command(
            pipeline=pandas_hello_world,
            env_file_list=[
                script_relative_path('../../dagster_pandas/examples/pandas_hello_world/*.yaml')
            ],
        )
    finally:
        # restore cwd
        os.chdir(cwd)
コード例 #5
0
def test_cli_execute_failure():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    with pytest.raises(Exception, match='I am a programmer and I make error'):
        cwd = os.getcwd()
        try:

            os.chdir(script_relative_path('../..'))

            do_execute_command(
                define_failure_pipeline(),
                script_relative_path('../../pandas_hello_world/env.yml'),
                lambda *_args, **_kwargs: None,
            )
        finally:
            # restore cwd
            os.chdir(cwd)
コード例 #6
0
def test_cli_execute_failure():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    with pytest.raises(DagsterExecutionStepExecutionError) as e_info:
        cwd = os.getcwd()
        try:

            os.chdir(script_relative_path('../..'))

            do_execute_command(
                pipeline=pandas_hello_world_fails,
                env_file_list=[
                    script_relative_path('../../dagster_pandas/examples/pandas_hello_world/*.yaml')
                ],
            )
        finally:
            # restore cwd
            os.chdir(cwd)
    assert 'I am a programmer and I make error' in str(e_info.value.__cause__)
コード例 #7
0
def test_cli_execute():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    cwd = os.getcwd()
    try:

        os.chdir(file_relative_path(__file__, '../..'))

        do_execute_command(
            pipeline=ReconstructablePipeline.for_module(
                'dagster_pandas.examples.pandas_hello_world.pipeline',
                'pandas_hello_world'),
            env_file_list=[
                file_relative_path(
                    __file__,
                    '../../dagster_pandas/examples/pandas_hello_world/*.yaml')
            ],
        )
    finally:
        # restore cwd
        os.chdir(cwd)
コード例 #8
0
def test_cli_execute():

    # currently paths in env files have to be relative to where the
    # script has launched so we have to simulate that
    cwd = os.getcwd()
    try:

        os.chdir(file_relative_path(__file__, "../.."))
        with instance_for_test() as instance:
            do_execute_command(
                pipeline=ReconstructablePipeline.for_module(
                    "dagster_pandas.examples", "pandas_hello_world_test"),
                instance=instance,
                config=[
                    file_relative_path(
                        __file__,
                        "../../dagster_pandas/examples/pandas_hello_world/*.yaml"
                    )
                ],
            )
    finally:
        # restore cwd
        os.chdir(cwd)