Skip to content
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

Clean up py38 targets #33510

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .test-infra/jenkins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions .test-infra/jenkins/metrics_report/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}
17 changes: 3 additions & 14 deletions sdks/python/apache_beam/testing/synthetic_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import logging
import math
import os
import sys
import time
from random import Random
from typing import Optional
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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_

Expand Down Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion sdks/python/test-suites/tox/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"]
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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,...}
Expand Down
5 changes: 0 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading