Skip to content

Add skipping alert functionality #29

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.dataflint.example

import org.apache.spark.sql.SparkSession

object SchedulingSmallTasksSkipAlerts extends App {
val spark = SparkSession
.builder()
.appName("SchedulingSmallTasks")
.config("spark.plugins", "io.dataflint.spark.SparkDataflintPlugin")
.config("spark.dataflint.telemetry.enabled", false)
.config("spark.ui.port", "10000")
.config("spark.dataflint.telemetry.enabled", value = false)
.config("spark.sql.maxMetadataStringLength", "10000")
.config("spark.dataflint.alert.disabled", "smallTasks,idleCoresTooHigh")
.master("local[*]")
.getOrCreate()

val numbers = spark.range(0, 10000).repartition(10000).count()

println(s"count numbers to 10000: $numbers")

scala.io.StdIn.readLine()
spark.stop()
}
1 change: 1 addition & 0 deletions spark-ui/src/interfaces/AppStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export interface ConfigEntry {
export type ConfigEntries = ConfigEntry[];

export interface ConfigStore {
alertDisabled: string | undefined;
resourceControlType: ResourceMode;
configs: ConfigEntries;
executorMemoryBytes: number;
Expand Down
6 changes: 4 additions & 2 deletions spark-ui/src/reducers/AlertsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { reduceSQLInputOutputAlerts } from "./Alerts/MemorySQLInputOutputAlerts"
import { reducePartitionSkewAlert } from "./Alerts/PartitionSkewAlert";
import { reduceSmallTasksAlert } from "./Alerts/SmallTasksAlert";
import { reduceWastedCoresAlerts } from "./Alerts/WastedCoresAlertsReducer";
import { parseAlertDisabledConfig } from "../utils/ConfigParser";

export function reduceAlerts(
sqlStore: SparkSQLStore,
Expand All @@ -39,8 +40,9 @@ export function reduceAlerts(
reduceJoinToBroadcastAlert(sqlStore, alerts);
reduceLargeCrossJoinScanAlert(sqlStore, alerts);
reduceMaxPartitionToBigAlert(sqlStore, stageStore, alerts);

const disabledAlerts = parseAlertDisabledConfig(config.alertDisabled);
const filteredAlerts = alerts.filter(alert => !disabledAlerts.has(alert.name));
return {
alerts: alerts,
alerts: filteredAlerts,
};
}
2 changes: 2 additions & 0 deletions spark-ui/src/reducers/ConfigReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export function extractConfig(
const resourceControlType = findResourceControlType(sparkPropertiesObj);

const appName = sparkPropertiesObj["spark.app.name"];
const alertDisabled = sparkPropertiesObj["spark.dataflint.alert.disabled"] || undefined;
const config: ConfigEntries = [
{
name: "app name",
Expand Down Expand Up @@ -381,6 +382,7 @@ export function extractConfig(
return [
appName,
{
alertDisabled: alertDisabled,
resourceControlType: resourceControlType,
configs: config,
executorMemoryOverheadViaConfigString: memoryOverheadViaConfigString,
Expand Down
5 changes: 5 additions & 0 deletions spark-ui/src/utils/ConfigParser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Utility to parse the spark.dataflint.alert.disabled config
export function parseAlertDisabledConfig(config: string | undefined): Set<string> {
if (!config) return new Set();
return new Set(config.split(',').map(x => x.trim()).filter(Boolean));
}