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
f43dfff5
Unverified
Commit
f43dfff5
authored
Jan 19, 2024
by
ZackYoung
Committed by
GitHub
Jan 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bug] [Flink] Optimize flink yarn submission (#3027)
parent
71f6bb92
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
21 deletions
+51
-21
pom.xml
dinky-admin/pom.xml
+20
-0
FlinkAppUtil.java
...p-base/src/main/java/org/dinky/app/util/FlinkAppUtil.java
+0
-1
YarnGateway.java
...way/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
+29
-18
index.tsx
dinky-web/src/components/Flink/FlinkDag/index.tsx
+1
-1
pom.xml
pom.xml
+1
-1
No files found.
dinky-admin/pom.xml
View file @
f43dfff5
...
...
@@ -51,6 +51,12 @@
<dependency>
<groupId>
cn.dev33
</groupId>
<artifactId>
sa-token-jwt
</artifactId>
<exclusions>
<exclusion>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-jwt
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
...
...
@@ -170,6 +176,20 @@
<dependency>
<groupId>
org.dinky
</groupId>
<artifactId>
dinky-core
</artifactId>
<exclusions>
<exclusion>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-crypto
</artifactId>
</exclusion>
<exclusion>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-http
</artifactId>
</exclusion>
<exclusion>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-json
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.dinky
</groupId>
...
...
dinky-app/dinky-app-base/src/main/java/org/dinky/app/util/FlinkAppUtil.java
View file @
f43dfff5
...
...
@@ -79,7 +79,6 @@ public class FlinkAppUtil {
public
static
void
monitorFlinkTask
(
JobClient
jobClient
,
int
taskId
)
{
boolean
isRun
=
true
;
String
jobId
=
jobClient
.
getJobID
().
toHexString
();
try
{
while
(
isRun
)
{
String
jobStatus
=
jobClient
.
getJobStatus
().
get
().
toString
();
...
...
dinky-gateway/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
View file @
f43dfff5
...
...
@@ -35,7 +35,6 @@ import org.dinky.gateway.result.SavePointResult;
import
org.dinky.gateway.result.TestResult
;
import
org.dinky.gateway.result.YarnResult
;
import
org.dinky.utils.FlinkJsonUtil
;
import
org.dinky.utils.ThreadUtil
;
import
org.apache.flink.client.deployment.ClusterRetrieveException
;
import
org.apache.flink.client.program.ClusterClient
;
...
...
@@ -340,32 +339,33 @@ public abstract class YarnGateway extends AbstractGateway {
&&
counts
--
>
0
)
{
Thread
.
sleep
(
1000
);
}
// 睡眠2秒,防止application快速识别抛出的错误
ThreadUtil
.
sleep
(
2000
);
ApplicationReport
applicationReport
=
yarnClient
.
getApplicationReport
(
clusterClient
.
getClusterId
());
if
(
applicationReport
.
getYarnApplicationState
()
!=
YarnApplicationState
.
RUNNING
)
{
String
logUrl
=
yarnClient
.
getContainers
(
applicationReport
.
getCurrentApplicationAttemptId
())
.
get
(
0
)
.
getLogUrl
();
String
log
=
ReUtil
.
getGroup1
(
HTML_TAG_REGEX
,
HttpUtil
.
get
(
logUrl
+
"/jobmanager.log?start=-10000"
));
logger
.
error
(
"\n\nHistory log url is: {}\n\n "
,
logUrl
);
throw
new
RuntimeException
(
"Yarn application state is not running, please check yarn cluster status. Log content:\n"
+
log
);
}
webUrl
=
applicationReport
.
getOriginalTrackingUrl
();
webUrl
=
clusterClient
.
getWebInterfaceURL
();
final
List
<
JobDetails
>
jobDetailsList
=
new
ArrayList
<>();
while
(
jobDetailsList
.
isEmpty
()
&&
counts
--
>
0
)
{
ApplicationReport
applicationReport
=
yarnClient
.
getApplicationReport
(
clusterClient
.
getClusterId
());
if
(
applicationReport
.
getYarnApplicationState
()
!=
YarnApplicationState
.
RUNNING
)
{
String
log
=
getYarnContainerLog
(
applicationReport
);
throw
new
RuntimeException
(
"Yarn application state is not running, please check yarn cluster status. Log content:\n"
+
log
);
}
// 睡眠1秒,防止flink因为依赖或其他问题导致任务秒挂
Thread
.
sleep
(
1000
);
String
url
=
yarnClient
.
getApplicationReport
(
clusterClient
.
getClusterId
())
.
getTrackingUrl
()
+
JobsOverviewHeaders
.
URL
.
substring
(
1
);
String
json
=
HttpUtil
.
get
(
url
);
MultipleJobsDetails
jobsDetails
=
FlinkJsonUtil
.
toBean
(
json
,
JobsOverviewHeaders
.
getInstance
());
jobDetailsList
.
addAll
(
jobsDetails
.
getJobs
());
try
{
MultipleJobsDetails
jobsDetails
=
FlinkJsonUtil
.
toBean
(
json
,
JobsOverviewHeaders
.
getInstance
());
jobDetailsList
.
addAll
(
jobsDetails
.
getJobs
());
}
catch
(
Exception
e
)
{
Thread
.
sleep
(
1000
);
String
log
=
getYarnContainerLog
(
applicationReport
);
logger
.
error
(
"Yarn application state is not running, please check yarn cluster status. Log content:\n"
+
log
);
}
if
(!
jobDetailsList
.
isEmpty
())
{
break
;
}
...
...
@@ -380,4 +380,15 @@ public abstract class YarnGateway extends AbstractGateway {
}
return
webUrl
;
}
protected
String
getYarnContainerLog
(
ApplicationReport
applicationReport
)
throws
YarnException
,
IOException
{
String
logUrl
=
yarnClient
.
getContainers
(
applicationReport
.
getCurrentApplicationAttemptId
())
.
get
(
0
)
.
getLogUrl
();
String
content
=
HttpUtil
.
get
(
logUrl
+
"/jobmanager.log?start=-10000"
);
String
log
=
ReUtil
.
getGroup1
(
HTML_TAG_REGEX
,
content
);
logger
.
info
(
"\n\nHistory log url is: {}\n\n "
,
logUrl
);
return
log
;
}
}
dinky-web/src/components/Flink/FlinkDag/index.tsx
View file @
f43dfff5
...
...
@@ -87,7 +87,7 @@ const RenderCheckpoint = (id: string, checkPoints: any) => {
label
:
y
,
children
:
(
<
Table
dataSource=
{
datum
[
y
].
data
}
dataSource=
{
datum
[
y
].
data
s
}
columns=
{
(
datum
[
y
].
headers
as
string
[]).
map
((
z
)
=>
{
return
{
title
:
z
,
...
...
pom.xml
View file @
f43dfff5
...
...
@@ -77,7 +77,7 @@
<javax.mail>
1.6.2
</javax.mail>
<jaxb.version>
2.3.0
</jaxb.version>
<jedis.version>
2.9.0
</jedis.version>
<jgit.version>
5.13.
1.20220613042
2-r
</jgit.version>
<jgit.version>
5.13.
2.20230622191
2-r
</jgit.version>
<junit5.version>
5.9.1
</junit5.version>
<knife4j.version>
4.1.0
</knife4j.version>
<kubernetes-client.version>
5.12.4
</kubernetes-client.version>
...
...
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