From 6366bd4c8901063467865277891ffc22769db1b7 Mon Sep 17 00:00:00 2001 From: tvalentyn Date: Tue, 16 Apr 2024 16:47:50 -0700 Subject: [PATCH] Disable profiling in cythonized code by default. (#30938) * Remove Cython profiling. * Update CHANGES.md --- CHANGES.md | 2 +- sdks/python/apache_beam/coders/coder_impl.pxd | 1 - sdks/python/apache_beam/metrics/monitoring_infos.py | 1 - sdks/python/apache_beam/runners/common.py | 1 - sdks/python/apache_beam/runners/worker/opcounters.py | 1 - sdks/python/apache_beam/runners/worker/operations.py | 1 - sdks/python/apache_beam/runners/worker/statesampler_fast.pyx | 1 - sdks/python/apache_beam/testing/fast_test_utils.pxd | 1 - .../apache_beam/transforms/cy_dataflow_distribution_counter.pxd | 1 - .../apache_beam/transforms/cy_dataflow_distribution_counter.pyx | 1 - sdks/python/apache_beam/utils/counters.pxd | 1 - sdks/python/apache_beam/utils/windowed_value.py | 1 - 12 files changed, 1 insertion(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cf78044ad104..6963d9507cdf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -68,7 +68,7 @@ ## New Features / Improvements -* X feature added (Java/Python) ([#X](https://github.com/apache/beam/issues/X)). +* Profiling of Cythonized code has been disabled by default. This might improve performance for some Python pipelines ([#30938](https://github.com/apache/beam/pull/30938)). * Bigtable enrichment handler now accepts a custom function to build a composite row key. (Python) ([#30974](https://github.com/apache/beam/issues/30975)). ## Breaking Changes diff --git a/sdks/python/apache_beam/coders/coder_impl.pxd b/sdks/python/apache_beam/coders/coder_impl.pxd index 0e6e31d0fc82..52889fa2fd92 100644 --- a/sdks/python/apache_beam/coders/coder_impl.pxd +++ b/sdks/python/apache_beam/coders/coder_impl.pxd @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True cimport cython diff --git a/sdks/python/apache_beam/metrics/monitoring_infos.py b/sdks/python/apache_beam/metrics/monitoring_infos.py index ae12c93a5718..7bc7cced280c 100644 --- a/sdks/python/apache_beam/metrics/monitoring_infos.py +++ b/sdks/python/apache_beam/metrics/monitoring_infos.py @@ -16,7 +16,6 @@ # # cython: language_level=3 -# cython: profile=True # pytype: skip-file diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py index 54d54402312d..82ff939dbaed 100644 --- a/sdks/python/apache_beam/runners/common.py +++ b/sdks/python/apache_beam/runners/common.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# cython: profile=True # cython: language_level=3 """Worker operations executor. diff --git a/sdks/python/apache_beam/runners/worker/opcounters.py b/sdks/python/apache_beam/runners/worker/opcounters.py index 8d9b36a1166f..ba53cbcbce7f 100644 --- a/sdks/python/apache_beam/runners/worker/opcounters.py +++ b/sdks/python/apache_beam/runners/worker/opcounters.py @@ -16,7 +16,6 @@ # # cython: language_level=3 -# cython: profile=True """Counters collect the progress of the Worker for reporting to the service.""" diff --git a/sdks/python/apache_beam/runners/worker/operations.py b/sdks/python/apache_beam/runners/worker/operations.py index bdb16a46aeea..00a652c49e66 100644 --- a/sdks/python/apache_beam/runners/worker/operations.py +++ b/sdks/python/apache_beam/runners/worker/operations.py @@ -16,7 +16,6 @@ # # cython: language_level=3 -# cython: profile=True """Worker operations executor.""" diff --git a/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx b/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx index f0e1e6ccb595..7c082b7a6226 100644 --- a/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx +++ b/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True # cython: language_level=3 """State sampler for tracking time spent in execution steps. diff --git a/sdks/python/apache_beam/testing/fast_test_utils.pxd b/sdks/python/apache_beam/testing/fast_test_utils.pxd index 5b27f8b8d42f..f8868e842b4a 100644 --- a/sdks/python/apache_beam/testing/fast_test_utils.pxd +++ b/sdks/python/apache_beam/testing/fast_test_utils.pxd @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True cimport libc.stdint diff --git a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd index 3df1a85e3a21..deab8bb16d9a 100644 --- a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd +++ b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd @@ -14,7 +14,6 @@ # limitations under the License. # -# cython: profile=True """ For internal use only. No backwards compatibility guarantees.""" diff --git a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx index 6fa32c6fd5d9..c1b32356ed1f 100644 --- a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx +++ b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx @@ -14,7 +14,6 @@ # limitations under the License. # -# cython: profile=True # cython: language_level=3 """ For internal use only. No backwards compatibility guarantees.""" diff --git a/sdks/python/apache_beam/utils/counters.pxd b/sdks/python/apache_beam/utils/counters.pxd index dc38bfa61581..bb6788da8858 100644 --- a/sdks/python/apache_beam/utils/counters.pxd +++ b/sdks/python/apache_beam/utils/counters.pxd @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True # cython: overflowcheck=True cdef class Counter(object): diff --git a/sdks/python/apache_beam/utils/windowed_value.py b/sdks/python/apache_beam/utils/windowed_value.py index 7bee17eb154e..fb15d3778a6a 100644 --- a/sdks/python/apache_beam/utils/windowed_value.py +++ b/sdks/python/apache_beam/utils/windowed_value.py @@ -22,7 +22,6 @@ # editing this file as WindowedValues are created for every element for # every step in a Beam pipeline. -# cython: profile=True # cython: language_level=3 # pytype: skip-file