Skip to content

ci: run python tests#1873

Merged
abhizer merged 7 commits intomainfrom
ci_py_test
Jul 1, 2024
Merged

ci: run python tests#1873
abhizer merged 7 commits intomainfrom
ci_py_test

Conversation

@abhizer
Copy link
Copy Markdown
Contributor

@abhizer abhizer commented Jun 14, 2024

Is this a user-visible change (yes/no): no

Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
abhizer added 3 commits June 25, 2024 16:51
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
@abhizer abhizer mentioned this pull request Jun 25, 2024
16 tasks
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
@abhizer abhizer marked this pull request as ready for review June 26, 2024 13:39
@abhizer abhizer requested review from gz and snkas June 26, 2024 13:39
Copy link
Copy Markdown
Contributor

@snkas snkas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Only note I have is that there is only one environment variable which gets used for both internal variables. There could be two used, with the pipeline one falling back to the script one if it is not defined.

"requests",
"pandas",
"typing-extensions",
"numpy<2",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curiosity: which features of NumPy 2+ are non-compatible? As I see it has been recently released.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


if KAFKA_URL:
KAFKA_SERVER = KAFKA_URL
KAFKA_URL_FROM_PIPELINE = KAFKA_URL
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistent naming of PIPELINE_TO_KAFKA_SERVER


# if the Kafka URL is set in the environment, use it
# useful for running tests in CI
KAFKA_URL = os.environ.get("KAFKA_URL")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say KAFKA_SERVER is more accurate as there is no scheme.

Earthfile Outdated
sleep 10 && \
(./pipeline-manager --bind-address=0.0.0.0 --api-server-working-directory=/working-dir --compiler-working-directory=/working-dir --runner-working-directory=/working-dir --sql-compiler-home=/dbsp/sql-to-dbsp-compiler --dbsp-override-path=/dbsp --db-connection-string=postgresql://postgres:postgres@localhost:5432 --compilation-profile=unoptimized &) && \
sleep 5 && \
docker run --name redpanda -p 9092:9092 --rm -itd docker.redpanda.com/vectorized/redpanda:v23.2.3 redpanda start --smp 2 && \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gz , is there a downside to running the container this way as opposed to how we do it elsewhere in Earthfile, using docker compose, e.g.:

test-debezium-jdbc-sink:
    FROM earthly/dind:alpine
    COPY deploy/docker-compose.yml .
    COPY deploy/docker-compose-jdbc.yml .
    ENV FELDERA_VERSION=latest
    WITH DOCKER --pull docker.redpanda.com/vectorized/redpanda:v23.2.3 \
                --pull debezium/example-postgres:2.3 \
                --load ghcr.io/feldera/pipeline-manager:latest=+build-pipeline-manager-container \
                --load ghcr.io/feldera/demo-container:latest=+build-demo-container \
                --load ghcr.io/feldera/kafka-connect:latest=+build-kafka-connect-container
        RUN COMPOSE_HTTP_TIMEOUT=120 RUST_LOG=debug,tokio_postgres=info docker-compose -f docker-compose.yml -f docker-compose-jdbc.yml --profile debezium up --force-recreate --exit-code-from debezium-jdbc-demo
    END

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm not too familiar with earthly+docjer.. maybe @lalithsuresh knows why it was done that way in the file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never dealt with Debezium, so I don't know. This does look odd. Worth rewriting it to be consistent with the other forms if it's quick to do.

Copy link
Copy Markdown
Contributor

@gz gz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my only question is why we need to test the python API with kafka in the loop

Earthfile Outdated
COPY +install-python-deps/wheels wheels
COPY demo/demo_notebooks/requirements.txt requirements.txt
COPY --dir python ./
RUN pip install --upgrade pip
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you need this? IMO this upgrades pip non-deterministically?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's related to pyproject.toml not being (well) supported with out-of-the-box Ubuntu 22.04 (issue)
An alternative would be to either switch to legacy setup.py temporarily or to have both (will have to how that resolves though).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm I thought we're already on 24.04 I swear I did the earthly upgrade at some point but it's not in main :( .. that's probably the right move for it

Earthfile Outdated
sleep 10 && \
(./pipeline-manager --bind-address=0.0.0.0 --api-server-working-directory=/working-dir --compiler-working-directory=/working-dir --runner-working-directory=/working-dir --sql-compiler-home=/dbsp/sql-to-dbsp-compiler --dbsp-override-path=/dbsp --db-connection-string=postgresql://postgres:postgres@localhost:5432 --compilation-profile=unoptimized &) && \
sleep 5 && \
docker run --name redpanda -p 9092:9092 --rm -itd docker.redpanda.com/vectorized/redpanda:v23.2.3 redpanda start --smp 2 && \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm not too familiar with earthly+docjer.. maybe @lalithsuresh knows why it was done that way in the file

@abhizer
Copy link
Copy Markdown
Contributor Author

abhizer commented Jun 28, 2024

I guess my only question is why we need to test the python API with kafka in the loop

There's a couple tests that require Kafka:

def test_kafka(self):

And,
def test_avro_format(self):

COPY --dir python ./
RUN pip install --upgrade pip
RUN pip wheel -r requirements.txt --wheel-dir=wheels
RUN pip wheel -r python/tests/requirements.txt --wheel-dir=wheels
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be reading this wrong, but aren't we installing the same requirements again in the next action below?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We install it to the wheel directory here, and then next, install it via the wheel directory.
Just followed the pattern we use for requirements in demo_notebooks.

Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
@abhizer abhizer merged commit 45add7c into main Jul 1, 2024
@abhizer abhizer deleted the ci_py_test branch July 1, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants