|
22 | 22 | /** Constants used in the Spark Kubernetes Operator. */ |
23 | 23 | @SuppressWarnings("PMD.DataClass") |
24 | 24 | public class Constants { |
| 25 | + /** The API group for Spark K8s Operator CRD resources. */ |
25 | 26 | public static final String API_GROUP = "spark.apache.org"; |
| 27 | + |
| 28 | + /** The API version for Spark K8s Operator CRD resources. */ |
26 | 29 | public static final String API_VERSION = "v1"; |
| 30 | + |
| 31 | + /** The label for the Spark Application name. */ |
27 | 32 | public static final String LABEL_SPARK_APPLICATION_NAME = "spark.operator/spark-app-name"; |
| 33 | + |
| 34 | + /** The label for the Spark Cluster name. */ |
28 | 35 | public static final String LABEL_SPARK_CLUSTER_NAME = "spark.operator/spark-cluster-name"; |
| 36 | + |
| 37 | + /** The label for the Spark Operator name. */ |
29 | 38 | public static final String LABEL_SPARK_OPERATOR_NAME = "spark.operator/name"; |
| 39 | + |
| 40 | + /** The label for a sentinel resource. */ |
30 | 41 | public static final String LABEL_SENTINEL_RESOURCE = "spark.operator/sentinel"; |
| 42 | + |
| 43 | + /** The label for the resource name. */ |
31 | 44 | public static final String LABEL_RESOURCE_NAME = "app.kubernetes.io/name"; |
| 45 | + |
| 46 | + /** The label for the component name. */ |
32 | 47 | public static final String LABEL_COMPONENT_NAME = "app.kubernetes.io/component"; |
| 48 | + |
| 49 | + /** The label for the Spark role name. */ |
33 | 50 | public static final String LABEL_SPARK_ROLE_NAME = "spark-role"; |
| 51 | + |
| 52 | + /** The value for the Spark driver role label. */ |
34 | 53 | public static final String LABEL_SPARK_ROLE_DRIVER_VALUE = "driver"; |
| 54 | + |
| 55 | + /** The value for the Spark executor role label. */ |
35 | 56 | public static final String LABEL_SPARK_ROLE_EXECUTOR_VALUE = "executor"; |
| 57 | + |
| 58 | + /** The value for the Spark cluster role label. */ |
36 | 59 | public static final String LABEL_SPARK_ROLE_CLUSTER_VALUE = "cluster"; |
| 60 | + |
| 61 | + /** The value for the Spark master role label. */ |
37 | 62 | public static final String LABEL_SPARK_ROLE_MASTER_VALUE = "master"; |
| 63 | + |
| 64 | + /** The value for the Spark worker role label. */ |
38 | 65 | public static final String LABEL_SPARK_ROLE_WORKER_VALUE = "worker"; |
| 66 | + |
| 67 | + /** The label for the Spark version. */ |
39 | 68 | public static final String LABEL_SPARK_VERSION_NAME = "spark-version"; |
| 69 | + |
| 70 | + /** A dummy field for sentinel resources. */ |
40 | 71 | public static final String SENTINEL_RESOURCE_DUMMY_FIELD = "sentinel.dummy.number"; |
41 | 72 |
|
| 73 | + /** The property key for the driver Spark container name. */ |
42 | 74 | public static final String DRIVER_SPARK_CONTAINER_PROP_KEY = |
43 | 75 | "spark.kubernetes.driver.podTemplateContainerName"; |
| 76 | + |
| 77 | + /** The property key for the driver Spark pod template file. */ |
44 | 78 | public static final String DRIVER_SPARK_TEMPLATE_FILE_PROP_KEY = |
45 | 79 | "spark.kubernetes.driver.podTemplateFile"; |
| 80 | + |
| 81 | + /** The property key for the executor Spark pod template file. */ |
46 | 82 | public static final String EXECUTOR_SPARK_TEMPLATE_FILE_PROP_KEY = |
47 | 83 | "spark.kubernetes.executor.podTemplateFile"; |
48 | 84 |
|
49 | 85 | // Default state messages |
| 86 | + /** Message indicating that the driver has been requested from the resource scheduler. */ |
50 | 87 | public static final String DRIVER_REQUESTED_MESSAGE = "Requested driver from resource scheduler."; |
| 88 | + |
| 89 | + /** Message indicating that the Spark application completed successfully. */ |
51 | 90 | public static final String DRIVER_COMPLETED_MESSAGE = "Spark application completed successfully."; |
| 91 | + |
| 92 | + /** |
| 93 | + * Message indicating that the driver container terminated before SparkContext/SparkSession |
| 94 | + * initialization. |
| 95 | + */ |
52 | 96 | public static final String DRIVER_TERMINATED_BEFORE_INITIALIZATION_MESSAGE = |
53 | 97 | "Driver container is terminated without SparkContext / SparkSession initialization."; |
| 98 | + |
| 99 | + /** Message indicating that the driver has failed init container(s). */ |
54 | 100 | public static final String DRIVER_FAILED_INIT_CONTAINERS_MESSAGE = |
55 | 101 | "Driver has failed init container(s). Refer last observed status for details."; |
| 102 | + |
| 103 | + /** Message indicating that the driver has one or more failed critical container(s). */ |
56 | 104 | public static final String DRIVER_FAILED_MESSAGE = |
57 | 105 | "Driver has one or more failed critical container(s), refer last observed status for " |
58 | 106 | + "details."; |
| 107 | + |
| 108 | + /** Message indicating that the driver's critical container(s) exited with 0. */ |
59 | 109 | public static final String DRIVER_SUCCEEDED_MESSAGE = |
60 | 110 | "Driver has critical container(s) exited with 0."; |
| 111 | + |
| 112 | + /** Message indicating that the driver's critical container(s) restarted unexpectedly. */ |
61 | 113 | public static final String DRIVER_RESTARTED_MESSAGE = |
62 | 114 | "Driver has one or more critical container(s) restarted unexpectedly, refer last " |
63 | 115 | + "observed status for details."; |
| 116 | + |
| 117 | + /** Message indicating that the Spark application has been shut down as requested. */ |
64 | 118 | public static final String APP_CANCELLED_MESSAGE = |
65 | 119 | "Spark application has been shutdown as requested."; |
| 120 | + |
| 121 | + /** |
| 122 | + * Message indicating that Spark application resources were released after exceeding the |
| 123 | + * configured retain duration. |
| 124 | + */ |
66 | 125 | public static final String APP_EXCEEDED_RETAIN_DURATION_MESSAGE = |
67 | 126 | "Spark application resources released after exceeding the configured retain duration."; |
| 127 | + |
| 128 | + /** Message indicating that the driver was unexpectedly removed. */ |
68 | 129 | public static final String DRIVER_UNEXPECTED_REMOVED_MESSAGE = |
69 | 130 | "Driver removed. This could caused by 'exit' called in driver process with non-zero " |
70 | 131 | + "code, involuntary disruptions or unintentional destroy behavior, check " |
71 | 132 | + "Kubernetes events for more details."; |
| 133 | + |
| 134 | + /** |
| 135 | + * Message indicating that the driver has not responded to the initial health check request within |
| 136 | + * the allotted start-up time. |
| 137 | + */ |
72 | 138 | public static final String DRIVER_LAUNCH_TIMEOUT_MESSAGE = |
73 | 139 | "The driver has not responded to the initial health check request within the " |
74 | 140 | + "allotted start-up time. This can be configured by setting " |
75 | 141 | + ".spec.applicationTolerations.applicationTimeoutConfig."; |
| 142 | + |
| 143 | + /** Message indicating that the driver has started running. */ |
76 | 144 | public static final String DRIVER_RUNNING_MESSAGE = "Driver has started running."; |
| 145 | + |
| 146 | + /** Message indicating that the driver has reached a ready state. */ |
77 | 147 | public static final String DRIVER_READY_MESSAGE = "Driver has reached ready state."; |
| 148 | + |
| 149 | + /** Message indicating that the Spark application has been created on the Kubernetes Cluster. */ |
78 | 150 | public static final String SUBMITTED_STATE_MESSAGE = |
79 | 151 | "Spark application has been created on Kubernetes Cluster."; |
| 152 | + |
| 153 | + /** Message indicating that the application status cannot be processed. */ |
80 | 154 | public static final String UNKNOWN_STATE_MESSAGE = "Cannot process application status."; |
| 155 | + |
| 156 | + /** Message indicating that the maximum number of restart attempts has been exceeded. */ |
81 | 157 | public static final String EXCEED_MAX_RETRY_ATTEMPT_MESSAGE = |
82 | 158 | "The maximum number of restart attempts (%d) has been exceeded."; |
| 159 | + |
| 160 | + /** Message indicating a failure to request the driver from the scheduler backend. */ |
83 | 161 | public static final String SCHEDULE_FAILURE_MESSAGE = |
84 | 162 | "Failed to request driver from scheduler backend."; |
| 163 | + |
| 164 | + /** Message indicating that the application is running healthy. */ |
85 | 165 | public static final String RUNNING_HEALTHY_MESSAGE = "Application is running healthy."; |
| 166 | + |
| 167 | + /** |
| 168 | + * Message indicating that the application is running with less than the minimal number of |
| 169 | + * requested initial executors. |
| 170 | + */ |
86 | 171 | public static final String INITIALIZED_WITH_BELOW_THRESHOLD_EXECUTORS_MESSAGE = |
87 | 172 | "The application is running with less than minimal number of requested initial executors."; |
| 173 | + |
| 174 | + /** |
| 175 | + * Message indicating that the Spark application is running with less than the minimal number of |
| 176 | + * requested executors. |
| 177 | + */ |
88 | 178 | public static final String RUNNING_WITH_BELOW_THRESHOLD_EXECUTORS_MESSAGE = |
89 | 179 | "The Spark application is running with less than minimal number of requested executors."; |
| 180 | + |
| 181 | + /** |
| 182 | + * Message indicating that the Spark application failed to get enough executors in the given time |
| 183 | + * threshold. |
| 184 | + */ |
90 | 185 | public static final String EXECUTOR_LAUNCH_TIMEOUT_MESSAGE = |
91 | 186 | "The Spark application failed to get enough executors in the given time threshold."; |
92 | 187 |
|
93 | 188 | // Spark Cluster Messages |
| 189 | + /** Message indicating a failure to request the Spark cluster from the scheduler backend. */ |
94 | 190 | public static final String CLUSTER_SCHEDULE_FAILURE_MESSAGE = |
95 | 191 | "Failed to request Spark cluster from scheduler backend."; |
| 192 | + |
| 193 | + /** Message indicating that the Spark cluster has been submitted to the Kubernetes Cluster. */ |
96 | 194 | public static final String CLUSTER_SUBMITTED_STATE_MESSAGE = |
97 | 195 | "Spark cluster has been submitted to Kubernetes Cluster."; |
| 196 | + |
| 197 | + /** Message indicating that the cluster has reached a ready state. */ |
98 | 198 | public static final String CLUSTER_READY_MESSAGE = "Cluster has reached ready state."; |
| 199 | + |
| 200 | + /** Message indicating that the cluster status cannot be processed. */ |
99 | 201 | public static final String UNKNOWN_CLUSTER_STATE_MESSAGE = "Cannot process cluster status."; |
100 | 202 | } |
0 commit comments