diff --git a/.test-infra/jenkins/build.gradle b/.test-infra/jenkins/build.gradle index df43717e2fc3..862e8756c6d7 100644 --- a/.test-infra/jenkins/build.gradle +++ b/.test-infra/jenkins/build.gradle @@ -36,11 +36,11 @@ task generateMetricsReport { doLast { exec { executable 'sh' - args '-c', ". ${envdir}/bin/activate && tox -e py38-test -c ${toxConfigFilePath}" + args '-c', ". ${envdir}/bin/activate && tox -e py39-test -c ${toxConfigFilePath}" } exec { executable 'sh' - args '-c', ". ${envdir}/bin/activate && tox -e py38-generate-report -c ${toxConfigFilePath} -- --influx-db=${influxDb} --influx-host=${influxHost} --influx-port=${influxPort} --output-file=${generateMetricsReportPath}" + args '-c', ". ${envdir}/bin/activate && tox -e py39-generate-report -c ${toxConfigFilePath} -- --influx-db=${influxDb} --influx-host=${influxHost} --influx-port=${influxPort} --output-file=${generateMetricsReportPath}" } logger.info('Create metrics report file {}', generateMetricsReportPath) } diff --git a/.test-infra/jenkins/metrics_report/tox.ini b/.test-infra/jenkins/metrics_report/tox.ini index d143a0dcf59c..5126b337afcc 100644 --- a/.test-infra/jenkins/metrics_report/tox.ini +++ b/.test-infra/jenkins/metrics_report/tox.ini @@ -25,12 +25,12 @@ commands_pre = pip --version pip check -[testenv:py38-test] +[testenv:py39-test] deps = -r requirements.txt passenv = WORKSPACE,INFLUXDB_USER,INFLUXDB_USER_PASSWORD commands = python -m unittest dashboards_parser.py -[testenv:py38-generate-report] +[testenv:py39-generate-report] deps = -r requirements.txt passenv = WORKSPACE,INFLUXDB_USER,INFLUXDB_USER_PASSWORD,GITHUB_WORKSPACE commands = python report_generator.py {posargs} diff --git a/sdks/python/apache_beam/testing/synthetic_pipeline.py b/sdks/python/apache_beam/testing/synthetic_pipeline.py index 4e3a1f48554d..b18de244e3f8 100644 --- a/sdks/python/apache_beam/testing/synthetic_pipeline.py +++ b/sdks/python/apache_beam/testing/synthetic_pipeline.py @@ -39,7 +39,6 @@ import logging import math import os -import sys import time from random import Random from typing import Optional @@ -81,15 +80,6 @@ class _Random(Random): # for compatibility reasons. random_sample = Random.random - # TODO(yathu) just use builtin rand_bytes when drop py38 support - def rand_bytes(self, length): - """Returns random bytes. - - Args: - length (int): Number of random bytes. - """ - return self.getrandbits(length * 8).to_bytes(length, sys.byteorder) - def get_generator(seed: Optional[int] = None, algorithm: Optional[str] = None): if algorithm is None or algorithm == 'builtin': @@ -478,10 +468,10 @@ def _gen_kv_pair(self, generator, index): # with equal probability. generator_hot = get_generator( seed=index % self._num_hot_keys, algorithm=self.gen_algo) - bytes_ = generator_hot.rand_bytes(self._key_size), generator.rand_bytes( + bytes_ = generator_hot.randbytes(self._key_size), generator.randbytes( self._value_size) else: - bytes_ = generator.rand_bytes(self.element_size) + bytes_ = generator.randbytes(self.element_size) bytes_ = bytes_[:self._key_size], bytes_[self._key_size:] return bytes_ @@ -611,8 +601,7 @@ def process( r = get_generator(algorithm=element.get('algorithm', None), seed=cur) time.sleep(element['sleep_per_input_record_sec']) yield ( - r.rand_bytes(element['key_size']), - r.rand_bytes(element['value_size'])) + r.randbytes(element['key_size']), r.randbytes(element['value_size'])) cur += 1 diff --git a/sdks/python/test-suites/tox/common.gradle b/sdks/python/test-suites/tox/common.gradle index 01265a6eeff5..75a12cdcf4cb 100644 --- a/sdks/python/test-suites/tox/common.gradle +++ b/sdks/python/test-suites/tox/common.gradle @@ -32,7 +32,7 @@ test.dependsOn "testPy${pythonVersionSuffix}ML" // toxTask "testPy${pythonVersionSuffix}Dask", "py${pythonVersionSuffix}-dask", "${posargs}" // test.dependsOn "testPy${pythonVersionSuffix}Dask" project.tasks.register("preCommitPy${pythonVersionSuffix}") { - // Since codecoverage reports will always be generated for py38, + // Since codecoverage reports will always be generated for py39, // all tests will be exercised. // dependsOn = ["testPy${pythonVersionSuffix}Cloud", "testPython${pythonVersionSuffix}"] dependsOn = ["testPy${pythonVersionSuffix}Cloud", "testPython${pythonVersionSuffix}"] diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini index 68ac15ced70d..ed1f723d6d4d 100644 --- a/sdks/python/tox.ini +++ b/sdks/python/tox.ini @@ -396,7 +396,7 @@ commands = # Allow exit code 5 (no tests run) so that we can run this command safely on arbitrary subdirectories. /bin/sh -c 'pytest -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 -m uses_pytorch {posargs}; ret=$?; [ $ret = 5 ] && exit 0 || exit $ret' -# TODO(https://github.com/apache/beam/issues/25796) - uncomment onnx tox task in tox/py38/build.gradle once onnx supports protobuf 4.x.x +# TODO(https://github.com/apache/beam/issues/25796) - uncomment onnx tox task in tox/py39/build.gradle once onnx supports protobuf 4.x.x [testenv:py{39,310}-onnx-113] # TODO(https://github.com/apache/beam/issues/25443) # apparently tox has problem when substitution key has single value. Change back to -onnx-{113,...} diff --git a/settings.gradle.kts b/settings.gradle.kts index 6cce1ec0a506..a1f85a452bcb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -278,32 +278,27 @@ include(":sdks:python") include(":sdks:python:apache_beam:testing:load_tests") include(":sdks:python:apache_beam:testing:benchmarks:nexmark") include(":sdks:python:container") -include(":sdks:python:container:py38") include(":sdks:python:container:py39") include(":sdks:python:container:py310") include(":sdks:python:container:py311") include(":sdks:python:container:py312") include(":sdks:python:expansion-service-container") include(":sdks:python:test-suites:dataflow") -include(":sdks:python:test-suites:dataflow:py38") include(":sdks:python:test-suites:dataflow:py39") include(":sdks:python:test-suites:dataflow:py310") include(":sdks:python:test-suites:dataflow:py311") include(":sdks:python:test-suites:dataflow:py312") include(":sdks:python:test-suites:direct") -include(":sdks:python:test-suites:direct:py38") include(":sdks:python:test-suites:direct:py39") include(":sdks:python:test-suites:direct:py310") include(":sdks:python:test-suites:direct:py311") include(":sdks:python:test-suites:direct:py312") include(":sdks:python:test-suites:direct:xlang") -include(":sdks:python:test-suites:portable:py38") include(":sdks:python:test-suites:portable:py39") include(":sdks:python:test-suites:portable:py310") include(":sdks:python:test-suites:portable:py311") include(":sdks:python:test-suites:portable:py312") include(":sdks:python:test-suites:tox:pycommon") -include(":sdks:python:test-suites:tox:py38") include(":sdks:python:test-suites:tox:py39") include(":sdks:python:test-suites:tox:py310") include(":sdks:python:test-suites:tox:py311")