How to use dagit - 10 common examples

To help you get started, we’ve selected a few dagit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dagster-io / dagster / python_modules / dagit / dagit / dagit_tests / test_smoke.py View on Github external
def test_smoke_app():
    repository_container = app.RepositoryContainer(repository=define_example_repository())
    pipeline_run_storage = PipelineRunStorage()
    flask_app = app.create_app(repository_container, pipeline_run_storage)
    client = flask_app.test_client()

    result = client.post('/graphql', data={'query': 'query { pipelines { nodes { name }}}'})

    data = json.loads(result.data.decode('utf-8'))

    assert data == {"data": {"pipelines": {"nodes": [{"name": "pandas_hello_world"}]}}}
github dagster-io / dagster / examples / dagster_examples_tests / intro_tutorial_tests / test_cli_invocations.py View on Github external
def load_dagit_for_repo_cli_args(n_pipelines=1, **kwargs):
    handle = handle_for_repo_cli_args(kwargs)

    app = create_app(handle, DagsterInstance.ephemeral())

    client = app.test_client()

    res = client.get('/graphql?query={query_string}'.format(query_string=PIPELINES_OR_ERROR_QUERY))
    json_res = json.loads(res.data.decode('utf-8'))
    assert 'data' in json_res
    assert 'pipelinesOrError' in json_res['data']
    assert 'nodes' in json_res['data']['pipelinesOrError']
    assert len(json_res['data']['pipelinesOrError']['nodes']) == n_pipelines

    return res
github dagster-io / dagster / examples / dagster_examples_tests / tutorial_tests / test_cli_invocations.py View on Github external
def load_dagit_for_repo_cli_args(n_pipelines=1, **kwargs):
    handle = handle_for_repo_cli_args(kwargs)

    app = create_app(handle, DagsterInstance.ephemeral())

    client = app.test_client()

    res = client.get('/graphql?query={query_string}'.format(query_string=PIPELINES_OR_ERROR_QUERY))
    json_res = json.loads(res.data.decode('utf-8'))
    assert 'data' in json_res
    assert 'pipelinesOrError' in json_res['data']
    assert 'nodes' in json_res['data']['pipelinesOrError']
    assert len(json_res['data']['pipelinesOrError']['nodes']) == n_pipelines

    return res
github dagster-io / dagster / python_modules / dagit / dagit / dagit_tests / test_smoke.py View on Github external
def test_smoke_app():
    repository_container = app.RepositoryContainer(repository=define_example_repository())
    pipeline_run_storage = PipelineRunStorage()
    flask_app = app.create_app(repository_container, pipeline_run_storage)
    client = flask_app.test_client()

    result = client.post('/graphql', data={'query': 'query { pipelines { nodes { name }}}'})

    data = json.loads(result.data.decode('utf-8'))

    assert len(data['data']['pipelines']['nodes']) == 2

    assert set([node_data['name'] for node_data in data['data']['pipelines']['nodes']]) == set(
        ['pandas_hello_world', 'pandas_hello_world_fails']
    )
github dagster-io / dagster / python_modules / dagit / dagit_tests / test_app.py View on Github external
def test_notebook_view():
    notebook_path = script_relative_path('render_uuid_notebook.ipynb')

    with create_app(
        ExecutionTargetHandle.for_repo_yaml(script_relative_path('./repository.yaml')),
        DagsterInstance.ephemeral(),
    ).test_client() as client:
        res = client.get('/dagit/notebook?path={}'.format(notebook_path))

    assert res.status_code == 200
    # This magic guid is hardcoded in the notebook
    assert b'6cac0c38-2c97-49ca-887c-4ac43f141213' in res.data
github dagster-io / dagster / python_modules / dagit / dagit / dagit_tests / test_smoke.py View on Github external
def test_smoke_app():
    repository_container = app.RepositoryContainer(repository=define_example_repository())
    pipeline_run_storage = PipelineRunStorage()
    flask_app = app.create_app(repository_container, pipeline_run_storage)
    client = flask_app.test_client()

    result = client.post('/graphql', data={'query': 'query { pipelines { nodes { name }}}'})

    data = json.loads(result.data.decode('utf-8'))

    assert data == {"data": {"pipelines": {"nodes": [{"name": "pandas_hello_world"}]}}}
github dagster-io / dagster / python_modules / dagit / dagit / dagit_tests / test_smoke.py View on Github external
def test_smoke_app():
    repository_container = app.RepositoryContainer(repository=define_example_repository())
    pipeline_run_storage = PipelineRunStorage()
    flask_app = app.create_app(repository_container, pipeline_run_storage)
    client = flask_app.test_client()

    result = client.post('/graphql', data={'query': 'query { pipelines { nodes { name }}}'})

    data = json.loads(result.data.decode('utf-8'))

    assert len(data['data']['pipelines']['nodes']) == 2

    assert set([node_data['name'] for node_data in data['data']['pipelines']['nodes']]) == set(
        ['pandas_hello_world', 'pandas_hello_world_fails']
    )
github dagster-io / dagster / python_modules / dagit / dagit / dagit_tests / test_multiprocessing.py View on Github external
def test_failing():
    run_id = 'run-1'
    repository_container = RepositoryContainer(
        RepositoryTargetInfo(
            repository_yaml=None,
            python_file=None,
            fn_name='define_failing_pipeline',
            module_name='dagit.dagit_tests.test_multiprocessing',
        )
    )
    pipeline = define_failing_pipeline()
    env_config = {
        'solids': {
            'sum_solid': {
                'inputs': {
                    'num': {
                        'csv': {
                            'path': script_relative_path('num.csv'),
                        },
github dagster-io / dagster / python_modules / dagit / dagit / dagit_tests / test_multiprocessing.py View on Github external
def test_execution_crash():
    run_id = 'run-1'
    repository_container = RepositoryContainer(
        RepositoryTargetInfo(
            repository_yaml=None,
            python_file=None,
            fn_name='define_crashy_pipeline',
            module_name='dagit.dagit_tests.test_multiprocessing',
        )
    )
    pipeline = define_crashy_pipeline()
    env_config = {
        'solids': {
            'sum_solid': {
                'inputs': {
                    'num': {
                        'csv': {
                            'path': script_relative_path('num.csv'),
                        },
github dagster-io / dagster / python_modules / dagit / dagit / dagit_tests / test_multiprocessing.py View on Github external
def test_running():
    run_id = 'run-1'
    repository_container = RepositoryContainer(
        RepositoryTargetInfo(
            repository_yaml=None,
            python_file=None,
            fn_name='define_passing_pipeline',
            module_name='dagit.dagit_tests.test_multiprocessing',
        )
    )
    pipeline = define_passing_pipeline()
    env_config = {
        'solids': {
            'sum_solid': {
                'inputs': {
                    'num': {
                        'csv': {
                            'path': script_relative_path('num.csv'),
                        },