예제 #1
0
def test_valid_job_format(kubeconfig, docker_image, image_pull_policy):  # pylint: disable=redefined-outer-name
    run_id = uuid.uuid4().hex
    environment_dict = load_yaml_from_path(
        os.path.join(environments_path(), 'env.yaml'))
    pipeline_name = 'demo_pipeline'
    run = PipelineRun.create_empty_run(pipeline_name, run_id, environment_dict)
    run_launcher = K8sRunLauncher(
        image_pull_policy=image_pull_policy,
        image_pull_secrets=[{
            'name': 'element-dev-key'
        }],
        service_account_name='dagit-admin',
        instance_config_map='dagster-instance',
        job_image=docker_image,
        load_kubeconfig=True,
        kubeconfig_file=kubeconfig,
    )

    job = run_launcher.construct_job(run)

    assert (yaml.dump(
        remove_none_recursively(job.to_dict()),
        default_flow_style=False).strip() == EXPECTED_JOB_SPEC.format(
            run_id=run_id,
            job_image=docker_image,
            image_pull_policy=image_pull_policy,
            dagster_version=dagster_version,
        ).strip())
예제 #2
0
def run_launcher(helm_chart, docker_image):  # pylint: disable=redefined-outer-name,unused-argument
    return K8sRunLauncher(
        postgres_host='dagster-postgresql',
        postgres_port='5432',
        image_pull_secrets=[{'name': 'element-dev-key'}],
        service_account_name='dagit-admin',
        job_image=docker_image,
        load_kubeconfig=True,
        kubeconfig_file=KUBECONFIG_FILE,
    )
예제 #3
0
def run_launcher(helm_chart, docker_image, kubeconfig_file, image_pull_policy):  # pylint: disable=redefined-outer-name,unused-argument
    return K8sRunLauncher(
        image_pull_secrets=[{
            'name': 'element-dev-key'
        }],
        service_account_name='dagit-admin',
        instance_config_map='dagster-instance',
        job_image=docker_image,
        load_kubeconfig=True,
        kubeconfig_file=kubeconfig_file,
        image_pull_policy=image_pull_policy,
    )
예제 #4
0
def run_launcher(
    helm_chart, docker_image, kubeconfig_file, image_pull_policy
):  # pylint: disable=redefined-outer-name,unused-argument
    return K8sRunLauncher(
        image_pull_secrets=[{'name': 'element-dev-key'}],
        service_account_name='dagit-admin',
        instance_config_map='dagster-instance',
        postgres_password_secret='dagster-postgresql-secret',
        dagster_home='/opt/dagster/dagster_home',
        job_image=docker_image,
        load_kubeconfig=True,
        kubeconfig_file=kubeconfig_file,
        image_pull_policy=image_pull_policy,
        job_namespace='dagster-test',
        env_config_maps=['dagster-job-runner-env', 'test-env-configmap'],
        env_secrets=['test-env-secret'],
    )
예제 #5
0
def run_launcher(cluster_provider, helm_namespace):  # pylint: disable=redefined-outer-name,unused-argument

    return K8sRunLauncher(
        image_pull_secrets=[{
            'name': 'element-dev-key'
        }],
        service_account_name='dagit-admin',
        instance_config_map='dagster-instance',
        postgres_password_secret='dagster-postgresql-secret',
        dagster_home='/opt/dagster/dagster_home',
        job_image=test_project_docker_image(),
        load_incluster_config=False,
        kubeconfig_file=cluster_provider.kubeconfig_file,
        image_pull_policy=image_pull_policy(),
        job_namespace=helm_namespace,
        env_config_maps=['dagster-pipeline-env', 'test-env-configmap'],
        env_secrets=['test-env-secret'],
    )
예제 #6
0
파일: conftest.py 프로젝트: hmcp22/dagster
def run_launcher(cluster_provider, helm_namespace_for_k8s_run_launcher):  # pylint: disable=redefined-outer-name,unused-argument

    return K8sRunLauncher(
        image_pull_secrets=[{
            "name": "element-dev-key"
        }],
        service_account_name="dagit-admin",
        instance_config_map="dagster-instance",
        postgres_password_secret="dagster-postgresql-secret",
        dagster_home="/opt/dagster/dagster_home",
        job_image=get_test_project_docker_image(),
        load_incluster_config=False,
        kubeconfig_file=cluster_provider.kubeconfig_file,
        image_pull_policy=image_pull_policy(),
        job_namespace=helm_namespace_for_k8s_run_launcher,
        env_config_maps=["dagster-pipeline-env", "test-env-configmap"],
        env_secrets=["test-env-secret"],
    )