How to use the dagit.app.RepositoryContainer function in dagit

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_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'),
                        },
github dagster-io / dagster / python_modules / dagster-airflow / dagster_airflow / dagster_plugin.py View on Github external
def make_python_callable(cls, dag_id, pipeline, env_config, step_keys):
        try:
            from dagster import RepositoryDefinition
            from dagit.app import RepositoryContainer
            from dagit.cli import execute_query_from_cli
        except ImportError:
            raise AirflowException(
                'To use the DagsterPythonOperator, dagster and dagit must be installed in your '
                'Airflow environment.'
            )
        repository = RepositoryDefinition('<>', {dag_id: lambda: pipeline})
        repository_container = RepositoryContainer(repository=repository)

        def python_callable(**kwargs):
            run_id = kwargs.get('dag_run').run_id
            query = QUERY_TEMPLATE.format(
                config=env_config,
                run_id=run_id,
                step_keys=json.dumps(step_keys),
                pipeline_name=pipeline.name,
            )
            return json.loads(execute_query_from_cli(repository_container, query, variables=None))

        return python_callable