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
e30f4bc6
Unverified
Commit
e30f4bc6
authored
Apr 11, 2024
by
gaoyan
Committed by
GitHub
Apr 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bug]Fix prejob status is UNKNOWN (#3384)
parent
9bdaa221
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
JobRefreshHandler.java
...rc/main/java/org/dinky/job/handler/JobRefreshHandler.java
+18
-13
No files found.
dinky-admin/src/main/java/org/dinky/job/handler/JobRefreshHandler.java
View file @
e30f4bc6
...
@@ -34,6 +34,7 @@ import org.dinky.data.flink.config.FlinkJobConfigInfo;
...
@@ -34,6 +34,7 @@ import org.dinky.data.flink.config.FlinkJobConfigInfo;
import
org.dinky.data.flink.exceptions.FlinkJobExceptionsDetail
;
import
org.dinky.data.flink.exceptions.FlinkJobExceptionsDetail
;
import
org.dinky.data.flink.job.FlinkJobDetailInfo
;
import
org.dinky.data.flink.job.FlinkJobDetailInfo
;
import
org.dinky.data.flink.watermark.FlinkJobNodeWaterMark
;
import
org.dinky.data.flink.watermark.FlinkJobNodeWaterMark
;
import
org.dinky.data.model.ClusterInstance
;
import
org.dinky.data.model.ext.JobInfoDetail
;
import
org.dinky.data.model.ext.JobInfoDetail
;
import
org.dinky.data.model.job.JobInstance
;
import
org.dinky.data.model.job.JobInstance
;
import
org.dinky.gateway.Gateway
;
import
org.dinky.gateway.Gateway
;
...
@@ -48,6 +49,7 @@ import org.dinky.utils.TimeUtil;
...
@@ -48,6 +49,7 @@ import org.dinky.utils.TimeUtil;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Optional
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -111,18 +113,23 @@ public class JobRefreshHandler {
...
@@ -111,18 +113,23 @@ public class JobRefreshHandler {
CopyOptions
.
create
().
ignoreNullValue
());
CopyOptions
.
create
().
ignoreNullValue
());
if
(
Asserts
.
isNull
(
jobDataDto
.
getJob
())
||
jobDataDto
.
isError
())
{
if
(
Asserts
.
isNull
(
jobDataDto
.
getJob
())
||
jobDataDto
.
isError
())
{
// If the job fails to get it, the default Finish Time is the current time
Optional
<
JobStatus
>
jobStatus
=
getJobStatus
(
jobInfoDetail
);
jobInstance
.
setStatus
(
JobStatus
.
RECONNECTING
.
getValue
());
if
(
jobStatus
.
isPresent
()
&&
JobStatus
.
isDone
(
jobStatus
.
get
().
getValue
()))
{
jobInstance
.
setError
(
jobDataDto
.
getErrorMsg
());
jobInstance
.
setStatus
(
jobStatus
.
get
().
getValue
());
jobInfoDetail
.
getJobDataDto
().
setError
(
true
);
}
else
{
jobInfoDetail
.
getJobDataDto
().
setErrorMsg
(
jobDataDto
.
getErrorMsg
());
// If the job fails to get it, the default Finish Time is the current time
jobInstance
.
setStatus
(
JobStatus
.
RECONNECTING
.
getValue
());
jobInstance
.
setError
(
jobDataDto
.
getErrorMsg
());
jobInfoDetail
.
getJobDataDto
().
setError
(
true
);
jobInfoDetail
.
getJobDataDto
().
setErrorMsg
(
jobDataDto
.
getErrorMsg
());
}
if
(
jobInstance
.
getFinishTime
()
==
null
||
TimeUtil
.
localDateTimeToLong
(
jobInstance
.
getFinishTime
())
<
1
)
{
if
(
jobInstance
.
getFinishTime
()
==
null
||
TimeUtil
.
localDateTimeToLong
(
jobInstance
.
getFinishTime
())
<
1
)
{
jobInstance
.
setFinishTime
(
LocalDateTime
.
now
());
jobInstance
.
setFinishTime
(
LocalDateTime
.
now
());
}
}
}
else
{
}
else
{
jobInfoDetail
.
setJobDataDto
(
jobDataDto
);
jobInfoDetail
.
setJobDataDto
(
jobDataDto
);
FlinkJobDetailInfo
flinkJobDetailInfo
=
jobDataDto
.
getJob
();
FlinkJobDetailInfo
flinkJobDetailInfo
=
jobDataDto
.
getJob
();
jobInstance
.
setStatus
(
getJobStatus
(
jobInfoDetail
).
getValu
e
());
jobInstance
.
setStatus
(
flinkJobDetailInfo
.
getStat
e
());
jobInstance
.
setDuration
(
flinkJobDetailInfo
.
getDuration
());
jobInstance
.
setDuration
(
flinkJobDetailInfo
.
getDuration
());
jobInstance
.
setCreateTime
(
TimeUtil
.
toLocalDateTime
(
flinkJobDetailInfo
.
getStartTime
()));
jobInstance
.
setCreateTime
(
TimeUtil
.
toLocalDateTime
(
flinkJobDetailInfo
.
getStartTime
()));
// if the job is still running the end-time is -1
// if the job is still running the end-time is -1
...
@@ -257,12 +264,12 @@ public class JobRefreshHandler {
...
@@ -257,12 +264,12 @@ public class JobRefreshHandler {
* @param jobInfoDetail The job info detail.
* @param jobInfoDetail The job info detail.
* @return The job status.
* @return The job status.
*/
*/
private
static
JobStatus
getJobStatus
(
JobInfoDetail
jobInfoDetail
)
{
private
static
Optional
<
JobStatus
>
getJobStatus
(
JobInfoDetail
jobInfoDetail
)
{
ClusterConfigurationDTO
clusterCfg
=
jobInfoDetail
.
getClusterConfiguration
();
ClusterConfigurationDTO
clusterCfg
=
jobInfoDetail
.
getClusterConfiguration
();
ClusterInstance
clusterInstance
=
jobInfoDetail
.
getClusterInstance
();
if
(!
Asserts
.
isNull
(
clusterCfg
)
if
(!
Asserts
.
isNull
(
clusterCfg
)
&&
GatewayType
.
YARN_PER_JOB
.
getLongValue
().
equals
(
cluster
Cfg
.
getType
()))
{
&&
GatewayType
.
YARN_PER_JOB
.
getLongValue
().
equals
(
cluster
Instance
.
getType
()))
{
try
{
try
{
String
appId
=
jobInfoDetail
.
getClusterInstance
().
getName
();
String
appId
=
jobInfoDetail
.
getClusterInstance
().
getName
();
...
@@ -273,15 +280,13 @@ public class JobRefreshHandler {
...
@@ -273,15 +280,13 @@ public class JobRefreshHandler {
.
setJobName
(
jobInfoDetail
.
getInstance
().
getName
());
.
setJobName
(
jobInfoDetail
.
getInstance
().
getName
());
Gateway
gateway
=
Gateway
.
build
(
gatewayConfig
);
Gateway
gateway
=
Gateway
.
build
(
gatewayConfig
);
return
gateway
.
getJobStatusById
(
appId
);
return
Optional
.
of
(
gateway
.
getJobStatusById
(
appId
)
);
}
catch
(
NotSupportGetStatusException
ignored
)
{
}
catch
(
NotSupportGetStatusException
ignored
)
{
// if the gateway does not support get status, then use the api to get job status
// if the gateway does not support get status, then use the api to get job status
// ignore to do something here
// ignore to do something here
}
}
}
}
JobDataDto
jobDataDto
=
jobInfoDetail
.
getJobDataDto
();
return
Optional
.
empty
();
String
status
=
jobDataDto
.
getJob
().
getState
();
return
JobStatus
.
get
(
status
);
}
}
/**
/**
...
...
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