Example #1
0
def dagster_instance_for_daemon(helm_postgres_url_for_daemon, run_launcher):  # pylint: disable=redefined-outer-name
    tempdir = DagsterInstance.temp_storage()

    with DagsterInstance(
            instance_type=InstanceType.EPHEMERAL,
            local_artifact_storage=LocalArtifactStorage(tempdir),
            run_storage=PostgresRunStorage(helm_postgres_url_for_daemon),
            event_storage=PostgresEventLogStorage(
                helm_postgres_url_for_daemon),
            schedule_storage=PostgresScheduleStorage(
                helm_postgres_url_for_daemon),
            compute_log_manager=NoOpComputeLogManager(),
            run_coordinator=QueuedRunCoordinator(),
            run_launcher=run_launcher,
            scheduler=DagsterDaemonScheduler(),
    ) as instance:
        yield instance
Example #2
0
def dagster_instance_for_k8s_run_launcher(
    helm_postgres_url_for_k8s_run_launcher,
):  # pylint: disable=redefined-outer-name
    tempdir = DagsterInstance.temp_storage()

    instance_ref = InstanceRef.from_dir(tempdir)

    with DagsterInstance(
        instance_type=InstanceType.PERSISTENT,
        local_artifact_storage=LocalArtifactStorage(tempdir),
        run_storage=PostgresRunStorage(helm_postgres_url_for_k8s_run_launcher),
        event_storage=PostgresEventLogStorage(helm_postgres_url_for_k8s_run_launcher),
        schedule_storage=PostgresScheduleStorage(helm_postgres_url_for_k8s_run_launcher),
        compute_log_manager=NoOpComputeLogManager(),
        run_coordinator=DefaultRunCoordinator(),
        run_launcher=ExplodingRunLauncher(),
        ref=instance_ref,
    ) as instance:
        yield instance

        check_export_runs(instance)
Example #3
0
def dagster_instance_for_daemon(helm_namespace_for_daemon, run_launcher):  # pylint: disable=redefined-outer-name
    tempdir = DagsterInstance.temp_storage()

    with local_port_forward_postgres(
            namespace=helm_namespace_for_daemon) as local_forward_port:
        postgres_url = "postgresql://*****:*****@localhost:{local_forward_port}/test".format(
            local_forward_port=local_forward_port)
        print("Local Postgres forwarding URL: ", postgres_url)

        instance = DagsterInstance(
            instance_type=InstanceType.EPHEMERAL,
            local_artifact_storage=LocalArtifactStorage(tempdir),
            run_storage=PostgresRunStorage(postgres_url),
            event_storage=PostgresEventLogStorage(postgres_url),
            schedule_storage=PostgresScheduleStorage(postgres_url),
            compute_log_manager=NoOpComputeLogManager(),
            run_coordinator=QueuedRunCoordinator(),
            run_launcher=run_launcher,
            scheduler=DagsterDaemonScheduler(),
        )
        yield instance
Example #4
0
def dagster_instance_for_k8s_run_launcher(helm_namespace_for_k8s_run_launcher, run_launcher):
    tempdir = DagsterInstance.temp_storage()

    with local_port_forward_postgres(
        namespace=helm_namespace_for_k8s_run_launcher
    ) as local_forward_port:
        postgres_url = "postgresql://*****:*****@localhost:{local_forward_port}/test".format(
            local_forward_port=local_forward_port
        )
        print("Local Postgres forwarding URL: ", postgres_url)

        instance = DagsterInstance(
            instance_type=InstanceType.EPHEMERAL,
            local_artifact_storage=LocalArtifactStorage(tempdir),
            run_storage=PostgresRunStorage(postgres_url),
            event_storage=PostgresEventLogStorage(postgres_url),
            schedule_storage=PostgresScheduleStorage(postgres_url),
            compute_log_manager=NoOpComputeLogManager(),
            run_launcher=run_launcher,
        )
        yield instance