Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
77384b2b
Unverified
Commit
77384b2b
authored
Jan 05, 2024
by
Zzm0809
Committed by
GitHub
Jan 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimization][admin] optimize task delete logical (#2917)
* optimize task delete logical * Spotless Apply --------- Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
4d116ec3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
0 deletions
+26
-0
CatalogueServiceImpl.java
...ain/java/org/dinky/service/impl/CatalogueServiceImpl.java
+20
-0
Status.java
dinky-common/src/main/java/org/dinky/data/enums/Status.java
+2
-0
messages_en_US.properties
...-common/src/main/resources/i18n/messages_en_US.properties
+2
-0
messages_zh_CN.properties
...-common/src/main/resources/i18n/messages_zh_CN.properties
+2
-0
No files found.
dinky-admin/src/main/java/org/dinky/service/impl/CatalogueServiceImpl.java
View file @
77384b2b
...
@@ -25,7 +25,9 @@ import org.dinky.assertion.Asserts;
...
@@ -25,7 +25,9 @@ import org.dinky.assertion.Asserts;
import
org.dinky.config.Dialect
;
import
org.dinky.config.Dialect
;
import
org.dinky.data.dto.CatalogueTaskDTO
;
import
org.dinky.data.dto.CatalogueTaskDTO
;
import
org.dinky.data.enums.JobLifeCycle
;
import
org.dinky.data.enums.JobLifeCycle
;
import
org.dinky.data.enums.JobStatus
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.exception.BusException
;
import
org.dinky.data.model.Catalogue
;
import
org.dinky.data.model.Catalogue
;
import
org.dinky.data.model.Metrics
;
import
org.dinky.data.model.Metrics
;
import
org.dinky.data.model.Task
;
import
org.dinky.data.model.Task
;
...
@@ -185,6 +187,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
...
@@ -185,6 +187,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
/**
/**
* check catalogue task name is exist
* check catalogue task name is exist
*
* @param name name
* @param name name
* @param id id
* @param id id
* @return true if exist , otherwise false
* @return true if exist , otherwise false
...
@@ -199,6 +202,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
...
@@ -199,6 +202,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
/**
/**
* init some value
* init some value
*
* @param catalogueTask {@link CatalogueTaskDTO}
* @param catalogueTask {@link CatalogueTaskDTO}
* @return {@link Task}
* @return {@link Task}
*/
*/
...
@@ -457,6 +461,22 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
...
@@ -457,6 +461,22 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
// doing: cascade delete jobInstance && jobHistory && history && statement
// doing: cascade delete jobInstance && jobHistory && history && statement
// 获取 task 表中的作业
// 获取 task 表中的作业
Task
task
=
taskService
.
getById
(
catalogue
.
getTaskId
());
Task
task
=
taskService
.
getById
(
catalogue
.
getTaskId
());
if
(
task
!=
null
)
{
if
(
task
.
getStep
().
equals
(
JobLifeCycle
.
PUBLISH
.
getValue
()))
{
throw
new
BusException
(
Status
.
TASK_IS_PUBLISH_CANNOT_DELETE
);
}
if
(
task
.
getJobInstanceId
()
!=
null
)
{
// 获取前 先强制刷新一下, 避免获取任务信息状态不准确
jobInstanceService
.
refreshJobInfoDetail
(
task
.
getJobInstanceId
(),
true
);
// 获取当前 job instance
JobInstance
currentJobInstance
=
jobInstanceService
.
getById
(
task
.
getJobInstanceId
());
if
(
currentJobInstance
!=
null
&&
currentJobInstance
.
getStatus
().
equals
(
JobStatus
.
RUNNING
.
getValue
()))
{
throw
new
BusException
(
Status
.
TASK_IS_RUNNING_CANNOT_DELETE
);
}
}
}
// 获取 metrics 表中的监控数据
// 获取 metrics 表中的监控数据
List
<
Metrics
>
metricListByTaskId
=
monitorService
.
getMetricsLayoutByTaskId
(
catalogue
.
getTaskId
());
List
<
Metrics
>
metricListByTaskId
=
monitorService
.
getMetricsLayoutByTaskId
(
catalogue
.
getTaskId
());
...
...
dinky-common/src/main/java/org/dinky/data/enums/Status.java
View file @
77384b2b
...
@@ -186,6 +186,8 @@ public enum Status {
...
@@ -186,6 +186,8 @@ public enum Status {
TASK_UPDATE_FAILED
(
12008
,
"task.update.failed"
),
TASK_UPDATE_FAILED
(
12008
,
"task.update.failed"
),
TASK_IS_ONLINE
(
12009
,
"task.is.online"
),
TASK_IS_ONLINE
(
12009
,
"task.is.online"
),
TASK_IS_EXIST
(
12010
,
"task.is.existed"
),
TASK_IS_EXIST
(
12010
,
"task.is.existed"
),
TASK_IS_PUBLISH_CANNOT_DELETE
(
12011
,
"task.is.publish.cannot.delete"
),
TASK_IS_RUNNING_CANNOT_DELETE
(
12012
,
"task.is.running.cannot.delete"
),
/**
/**
* alert instance
* alert instance
...
...
dinky-common/src/main/resources/i18n/messages_en_US.properties
View file @
77384b2b
...
@@ -104,6 +104,8 @@ added.failed=Added Failed
...
@@ -104,6 +104,8 @@ added.failed=Added Failed
task.not.exist
=
Task Not Exist
task.not.exist
=
Task Not Exist
task.is.online
=
Task is online, modification is prohibited
task.is.online
=
Task is online, modification is prohibited
task.is.existed
=
Task is existed
task.is.existed
=
Task is existed
task.is.publish.cannot.delete
=
Task is published, cannot delete
task.is.running.cannot.delete
=
Task is running, cannot delete, please stop the task first
cluster.instance.deploy
=
Deploy Success
cluster.instance.deploy
=
Deploy Success
clear.failed
=
Clear Failed
clear.failed
=
Clear Failed
rename.success
=
Rename Successfully
rename.success
=
Rename Successfully
...
...
dinky-common/src/main/resources/i18n/messages_zh_CN.properties
View file @
77384b2b
...
@@ -104,6 +104,8 @@ added.failed=新增失败
...
@@ -104,6 +104,8 @@ added.failed=新增失败
task.not.exist
=
任务不存在
task.not.exist
=
任务不存在
task.is.online
=
任务已上线,禁止修改
task.is.online
=
任务已上线,禁止修改
task.is.existed
=
作业已存在
task.is.existed
=
作业已存在
task.is.publish.cannot.delete
=
作业已发布,无法删除,请先下线
task.is.running.cannot.delete
=
作业正在运行,无法删除,请先停止
cluster.instance.deploy
=
部署完成
cluster.instance.deploy
=
部署完成
clear.failed
=
清除失败
clear.failed
=
清除失败
rename.success
=
重命名成功
rename.success
=
重命名成功
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment