This is an automated email from the ASF dual-hosted git repository.
yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new bc42bb9d3ef Create MemoryMonitorOptions class for GC thrashing
parameter (#27867)
bc42bb9d3ef is described below
commit bc42bb9d3ef985c2790a3f3477b634bcc7fae4d3
Author: Bruno Volpato <[email protected]>
AuthorDate: Tue Aug 8 16:00:20 2023 -0400
Create MemoryMonitorOptions class for GC thrashing parameter (#27867)
* Create a separate class MemoryMonitorOptions for
GCThrashingPercentagePerPeriod
* Fix typo
* Remove unnecessary MemoryMonitorOptions in the context here
---
.../options/DataflowPipelineDebugOptions.java | 4 ++-
.../beam/sdk/options/MemoryMonitorOptions.java | 39 ++++++++++++++++++++++
.../apache/beam/sdk/options/SdkHarnessOptions.java | 18 +---------
3 files changed, 43 insertions(+), 18 deletions(-)
diff --git
a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowPipelineDebugOptions.java
b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowPipelineDebugOptions.java
index 3cebd3eb653..709009f8c80 100644
---
a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowPipelineDebugOptions.java
+++
b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowPipelineDebugOptions.java
@@ -28,6 +28,7 @@ import org.apache.beam.sdk.options.DefaultValueFactory;
import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.options.ExperimentalOptions;
import org.apache.beam.sdk.options.Hidden;
+import org.apache.beam.sdk.options.MemoryMonitorOptions;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.util.InstanceBuilder;
@@ -39,7 +40,8 @@ import org.apache.beam.sdk.util.InstanceBuilder;
"[Internal] Options used to control execution of the Dataflow SDK for "
+ "debugging and testing purposes.")
@Hidden
-public interface DataflowPipelineDebugOptions extends ExperimentalOptions,
PipelineOptions {
+public interface DataflowPipelineDebugOptions
+ extends ExperimentalOptions, MemoryMonitorOptions, PipelineOptions {
/**
* The root URL for the Dataflow API. {@code dataflowEndpoint} can override
this value if it
diff --git
a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/MemoryMonitorOptions.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/MemoryMonitorOptions.java
new file mode 100644
index 00000000000..fc9bd3bc800
--- /dev/null
+++
b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/MemoryMonitorOptions.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.options;
+
+/** Options that are used to control the Memory Monitor. */
+@Description("Options that are used to control the Memory Monitor.")
+public interface MemoryMonitorOptions extends PipelineOptions {
+
+ /**
+ * The GC thrashing threshold percentage. A given period of time is
considered "thrashing" if this
+ * percentage of CPU time is spent in garbage collection. Harness will force
fail tasks after
+ * sustained periods of thrashing.
+ *
+ * <p>If {@literal 100} is given as the value, MemoryMonitor will be
disabled.
+ */
+ @Description(
+ "The GC thrashing threshold percentage. A given period of time is
considered \"thrashing\" if this "
+ + "percentage of CPU time is spent in garbage collection. Dataflow
will force fail tasks after "
+ + "sustained periods of thrashing.")
+ @Default.Double(50.0)
+ Double getGCThrashingPercentagePerPeriod();
+
+ void setGCThrashingPercentagePerPeriod(Double value);
+}
diff --git
a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/SdkHarnessOptions.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/SdkHarnessOptions.java
index d1ccaa22c85..5d0c52e8a65 100644
---
a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/SdkHarnessOptions.java
+++
b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/SdkHarnessOptions.java
@@ -35,7 +35,7 @@ import org.checkerframework.checker.index.qual.NonNegative;
/** Options that are used to control configuration of the SDK harness. */
@Description("Options that are used to control configuration of the SDK
harness.")
-public interface SdkHarnessOptions extends PipelineOptions {
+public interface SdkHarnessOptions extends PipelineOptions,
MemoryMonitorOptions {
/** The set of log levels that can be used in the SDK harness. */
enum LogLevel {
/** Special level used to turn off logging. */
@@ -193,22 +193,6 @@ public interface SdkHarnessOptions extends PipelineOptions
{
void setMaxCacheMemoryUsageMbClass(Class<? extends MaxCacheMemoryUsageMb>
kls);
- /**
- * The GC thrashing threshold percentage. A given period of time is
considered "thrashing" if this
- * percentage of CPU time is spent in garbage collection. Harness will force
fail tasks after
- * sustained periods of thrashing.
- *
- * <p>If {@literal 100} is given as the value, MemoryMonitor will be
disabled.
- */
- @Description(
- "The GC thrashing threshold percentage. A given period of time is
considered \"thrashing\" if this "
- + "percentage of CPU time is spent in garbage collection. Dataflow
will force fail tasks after "
- + "sustained periods of thrashing.")
- @Default.Double(50.0)
- Double getGCThrashingPercentagePerPeriod();
-
- void setGCThrashingPercentagePerPeriod(Double value);
-
/**
* A {@link DefaultValueFactory} which constructs an instance of the class
specified by {@link
* #getMaxCacheMemoryUsageMbClass maxCacheMemoryUsageMbClass} to compute the
maximum amount of