-
Notifications
You must be signed in to change notification settings - Fork 6.7k
chore(dataflow/gemma): update dependencies and format code #14321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ba30940
7534737
69d6720
504120a
2277601
6c27719
2a177ee
7e30d08
9cd6455
f5880f3
1068b8a
2715542
f023da9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,19 +34,23 @@ | |
|
|
||
| OPTION B: Run tests with nox | ||
| pip install nox | ||
| nox -s py-3.10 | ||
| nox -s py-3.11 | ||
|
|
||
| NOTE: For the tests to find the conftest in the testing infrastructure, | ||
| TODO(developer): For the tests to find the conftest in the testing infrastructure, | ||
| add the PYTHONPATH to the "env" in your noxfile_config.py file. | ||
| """ | ||
|
|
||
| from collections.abc import Callable, Iterator | ||
|
|
||
| import conftest # python-docs-samples/dataflow/conftest.py | ||
| from conftest import Utils | ||
|
|
||
| import pytest | ||
|
|
||
| DATAFLOW_MACHINE_TYPE = "g2-standard-4" | ||
| DATAFLOW_MACHINE_TYPE = "g2-standard-8" | ||
| # TODO(developer): For local testing, ensure the 'gemma_2b_en' directory is uploaded | ||
| # to a GCS bucket you manage. Update the constant below to point to | ||
| # the root path of this uploaded directory (e.g., 'gs://your-bucket-name/path/to/gemma_2b'). | ||
| GEMMA_GCS = "gs://perm-dataflow-gemma-example-testdata/gemma_2b" | ||
| NAME = "dataflow/gemma/streaming" | ||
|
|
||
|
|
@@ -70,8 +74,9 @@ def messages_topic(pubsub_topic: Callable[[str], str]) -> str: | |
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def messages_subscription(pubsub_subscription: Callable[[str, str], str], | ||
| messages_topic: str) -> str: | ||
| def messages_subscription( | ||
| pubsub_subscription: Callable[[str, str], str], messages_topic: str | ||
| ) -> str: | ||
| return pubsub_subscription("messages", messages_topic) | ||
|
|
||
|
|
||
|
|
@@ -81,20 +86,21 @@ def responses_topic(pubsub_topic: Callable[[str], str]) -> str: | |
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def responses_subscription(pubsub_subscription: Callable[[str, str], str], | ||
| responses_topic: str) -> str: | ||
| def responses_subscription( | ||
| pubsub_subscription: Callable[[str, str], str], responses_topic: str | ||
| ) -> str: | ||
| return pubsub_subscription("responses", responses_topic) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def dataflow_job( | ||
| project: str, | ||
| bucket_name: str, | ||
| location: str, | ||
| unique_name: str, | ||
| container_image: str, | ||
| messages_subscription: str, | ||
| responses_topic: str, | ||
| project: str, | ||
| bucket_name: str, | ||
| location: str, | ||
| unique_name: str, | ||
| container_image: str, | ||
| messages_subscription: str, | ||
| responses_topic: str, | ||
| ) -> Iterator[str]: | ||
| # Launch the streaming Dataflow pipeline. | ||
| conftest.run_cmd( | ||
|
|
@@ -108,6 +114,7 @@ def dataflow_job( | |
| f"--temp_location=gs://{bucket_name}/temp", | ||
| f"--region={location}", | ||
| f"--machine_type={DATAFLOW_MACHINE_TYPE}", | ||
| "--disk_size_gb=100", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a specific reason for hardcoding the disk size, rather than passing it as a parameter?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think there is a need to change this value any more, it was set to 100gb because the default is 30gb and was throwing error due to disk size limitation. 100 gb should be more than enough for now and in the future. |
||
| f"--sdk_container_image=gcr.io/{project}/{container_image}", | ||
| "--dataflow_service_options=worker_accelerator=type:nvidia-l4;count:1;install-nvidia-driver:5xx", | ||
| "--requirements_cache=skip", | ||
|
|
@@ -127,20 +134,18 @@ def dataflow_job( | |
|
|
||
| @pytest.mark.timeout(3600) | ||
| def test_pipeline_dataflow( | ||
| project: str, | ||
| location: str, | ||
| dataflow_job: str, | ||
| messages_topic: str, | ||
| responses_subscription: str, | ||
| project: str, | ||
| location: str, | ||
| dataflow_job: str, | ||
| messages_topic: str, | ||
| responses_subscription: str, | ||
| ) -> None: | ||
| print(f"Waiting for the Dataflow workers to start: {dataflow_job}") | ||
| conftest.wait_until( | ||
| lambda: conftest.dataflow_num_workers(project, location, dataflow_job) | ||
| > 0, | ||
| lambda: conftest.dataflow_num_workers(project, location, dataflow_job) > 0, | ||
| "workers are running", | ||
| ) | ||
| num_workers = conftest.dataflow_num_workers(project, location, | ||
| dataflow_job) | ||
| num_workers = conftest.dataflow_num_workers(project, location, dataflow_job) | ||
| print(f"Dataflow job num_workers: {num_workers}") | ||
|
|
||
| messages = ["This is a test for a Python sample."] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| google-cloud-aiplatform==1.49.0 | ||
| google-cloud-dataflow-client==0.8.10 | ||
| google-cloud-storage==2.16.0 | ||
| pytest==9.0.3; python_version >= "3.10" | ||
| pytest-timeout==2.3.1 | ||
| google-cloud-aiplatform==1.158.0 | ||
| google-cloud-dataflow-client==0.14.0 | ||
| google-cloud-storage==3.12.0 | ||
| pytest==9.0.3 | ||
| pytest-timeout==2.4.0 | ||
|
XrossFox marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| apache_beam[gcp]==2.54.0 | ||
| protobuf==4.25.0 | ||
| keras_nlp==0.8.2 | ||
| keras==3.0.5 | ||
| protobuf==6.33.6 | ||
| apache_beam[gcp]==2.74.0 | ||
| keras==3.14.1 | ||
| keras_nlp==0.29.1 | ||
| pyOpenSSL==25.3.0 | ||
|
XrossFox marked this conversation as resolved.
|
||
Uh oh!
There was an error while loading. Please reload this page.