Skip to content

Commit

Permalink
[Improve] spark-app run state style improvement (#4100)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfboys authored Sep 28, 2024
1 parent e378ea2 commit 37b3b26
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default {
startLog: 'View Spark Start Log',
abort: 'Terminate Job',
copy: 'Copy Job',
remapping: 'Remap Job',
remapping: 'Remapping Job',
deleteTip: 'Are you sure you want to delete this job?',
canceling: 'Current job is stopping',
starting: 'Current job is starting',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ export const stateMap = {
class: 'status-processing-restarting',
},
[AppStateEnum.ACCEPTED]: {
color: '#52c41a',
color: '#13c2c2',
title: t('spark.app.runState.accept'),
class: 'status-processing-running',
class: 'status-processing-restarting',
},
[AppStateEnum.SUCCEEDED]: {
color: '#52c41a',
color: '#1890ff',
title: t('spark.app.runState.success'),
class: 'status-processing-success',
},
[AppStateEnum.RUNNING]: {
color: '#1890ff',
color: '#52c41a',
title: t('spark.app.runState.running'),
class: 'status-processing-failing',
class: 'status-processing-running',
},
[AppStateEnum.FINISHED]: { color: '#52c41a', title: t('spark.app.runState.finished') },
[AppStateEnum.FAILED]: { color: '#f5222d', title: t('spark.app.runState.failed') },
Expand All @@ -73,9 +73,9 @@ export const stateMap = {
},

[AppStateEnum.STOPPING]: {
color: '#f5222d',
color: '#faad14',
title: t('spark.app.runState.stopping'),
class: 'status-processing-initializing',
class: 'status-processing-cancelling',
},
[AppStateEnum.KILLED]: { color: '#8E50FF', title: t('spark.app.runState.killed') },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ export const useSparkAction = (optionApps: Recordable) => {
<Form class="!pt-50px">
<Form.Item
label="Job Name"
labelCol={{ lg: { span: 7 }, sm: { span: 7 } }}
wrapperCol={{ lg: { span: 16 }, sm: { span: 4 } }}
layout="vertical"
baseColProps={{ span: 22, offset: 1 }}
validateStatus={unref(validateStatus)}
help={help}
rules={[{ required: true }]}
Expand Down Expand Up @@ -343,8 +343,8 @@ export const useSparkAction = (optionApps: Recordable) => {
class="!pt-40px"
ref={mappingRef}
name="mappingForm"
labelCol={{ lg: { span: 7 }, sm: { span: 7 } }}
wrapperCol={{ lg: { span: 16 }, sm: { span: 4 } }}
layout="vertical"
baseColProps={{ span: 22, offset: 1 }}
v-model:model={formValue}
>
<Form.Item label="Job Name">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ object SparkShimsProxy extends Logger {
logInfo(s"Add verify sql lib,spark version: $sparkVersion")
VERIFY_SQL_CLASS_LOADER_CACHE.getOrElseUpdate(
s"${sparkVersion.fullVersion}", {
val libUrl = getSparkHomeLib(sparkVersion.sparkHome, "jars", f => !f.getName.startsWith("log4j") && !f.getName.startsWith("slf4j"))
val libUrl = getSparkHomeLib(sparkVersion.sparkHome, "jars")
val shimsUrls = ListBuffer[URL](libUrl: _*)

// TODO If there are compatibility issues with different versions

addShimsUrls(
sparkVersion,
file => {
Expand Down Expand Up @@ -151,9 +150,8 @@ object SparkShimsProxy extends Logger {
SHIMS_CLASS_LOADER_CACHE.getOrElseUpdate(
s"${sparkVersion.fullVersion}", {
// 1) spark/lib
val libUrl = getSparkHomeLib(sparkVersion.sparkHome, "jars", f => !f.getName.startsWith("log4j") && !f.getName.startsWith("slf4j"))
val libUrl = getSparkHomeLib(sparkVersion.sparkHome, "jars")
val shimsUrls = ListBuffer[URL](libUrl: _*)

// 2) add all shims jar
addShimsUrls(
sparkVersion,
Expand All @@ -174,10 +172,18 @@ object SparkShimsProxy extends Logger {
private[this] def getSparkHomeLib(
sparkHome: String,
childDir: String,
filterFun: File => Boolean): List[URL] = {
filterFun: File => Boolean = null): List[URL] = {
val file = new File(sparkHome, childDir)
require(file.isDirectory, s"SPARK_HOME $file does not exist")
file.listFiles.filter(filterFun).map(_.toURI.toURL).toList
file.listFiles
.filter(f => !f.getName.startsWith("log4j") && !f.getName.startsWith("slf4j"))
.filter(f => {
if (filterFun != null) {
filterFun(f)
} else {
true
}
}).map(_.toURI.toURL).toList
}

@throws[Exception]
Expand Down

0 comments on commit 37b3b26

Please sign in to comment.