testcontainers / testcontainers/testcontainers-python

New Container: Spark Connect

オープン
#825 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

🚀 enhancement
主要言語
Python
スター
2.3k
フォーク
386
平均マージ
4時間 40分
マージ済み PR(30日)
1

説明

What is the new container you'd like to have?

Spark connect introduces a decoupled client-server architecture to allow remote connectivity to spark server, official documentation is here.

It's used by data engineers to distribute data transformation jobs into multiple clusters. Spark connect is an addition to spark with leverages the jvm.

Benefits of having this in container would enable data engineers:

  • to be able to tests their workflows without having to go through a cloud provider like Databricks
  • prevent the manual setup of jvm which can be quite cumbersome

The most commonly used docker image is apache/spark.

Why not just use a generic container for this?

The implementation of the spark connect server with DockerContainer would expose extra configurations. On corporate projects, the following implementation is required

    kwargs = {
        "entrypoint": "/opt/spark/sbin/start-connect-server.sh org.apache.spark.deploy.master.Master --packages org.apache.spark:spark-connect_2.12:3.5.2,io.delta:delta-core_2.12:2.3.0 --conf spark.driver.extraJavaOptions='-Divy.cache.dir=/tmp -Divy.home=/tmp' --conf spark.connect.grpc.binding.port=8081",
    }
with (
        DockerContainer(
            "apache/spark",
        )
        .with_bind_ports(8081, 8081)
        .with_env("SPARK_NO_DAEMONIZE", "True")
        .with_volume_mapping(pytest_tmp_dir, pytest_tmp_dir, "rw")
        .with_kwargs(**kwargs) as container
    ):
        _ = wait_for_logs(container, "SparkConnectServer: Spark Connect server started at")
        yield container

The added complexity is due to configuration of the entrypoint, one would need to have expertise in spark connect to launch the server and ensure the proper port exports. There is a compatibility versions to guarantee between spark and the delta-core jar package.

Other references:

Some resources here

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、既存のコンテナ統合と、例で使用されている DockerContainer API を見つけます。apache/spark イメージ、Spark Connect のエントリーポイント、ポート 8081、wait_for_logs の使用方法を確認します。必要な設定で Spark Connect コンテナを起動でき、その起動を確実に検出できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, python, spark
領域
data-engineering, devops
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。