Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
9a201acb
Commit
9a201acb
authored
Feb 11, 2022
by
godkaikai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error完整打印
parent
d0406156
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
36 deletions
+64
-36
LogUtil.java
dlink-common/src/main/java/com/dlink/utils/LogUtil.java
+41
-0
JobManager.java
dlink-core/src/main/java/com/dlink/job/JobManager.java
+7
-18
KubernetesApplicationGateway.java
...link/gateway/kubernetes/KubernetesApplicationGateway.java
+2
-3
KubernetesGateway.java
.../java/com/dlink/gateway/kubernetes/KubernetesGateway.java
+3
-6
YarnApplicationGateway.java
...n/java/com/dlink/gateway/yarn/YarnApplicationGateway.java
+2
-3
YarnGateway.java
...way/src/main/java/com/dlink/gateway/yarn/YarnGateway.java
+7
-3
YarnPerJobGateway.java
...c/main/java/com/dlink/gateway/yarn/YarnPerJobGateway.java
+2
-3
No files found.
dlink-common/src/main/java/com/dlink/utils/LogUtil.java
0 → 100644
View file @
9a201acb
package
com
.
dlink
.
utils
;
import
com.sun.org.slf4j.internal.Logger
;
import
com.sun.org.slf4j.internal.LoggerFactory
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.time.LocalDateTime
;
/**
* LogUtil
*
* @author wenmo
* @since 2022/2/11 15:46
**/
public
class
LogUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LogUtil
.
class
);
public
static
String
getError
(
Exception
e
){
// e.printStackTrace();
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
e
.
printStackTrace
(
pw
);
String
error
=
sw
.
toString
();
logger
.
error
(
sw
.
toString
());
return
error
;
}
public
static
String
getError
(
String
msg
,
Exception
e
){
// e.printStackTrace();
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
e
.
printStackTrace
(
pw
);
LocalDateTime
now
=
LocalDateTime
.
now
();
String
error
=
now
.
toString
()
+
": "
+
msg
+
" \nError message:\n "
+
sw
.
toString
();
logger
.
error
(
error
);
return
error
;
}
}
dlink-core/src/main/java/com/dlink/job/JobManager.java
View file @
9a201acb
...
@@ -27,6 +27,7 @@ import com.dlink.session.SessionConfig;
...
@@ -27,6 +27,7 @@ import com.dlink.session.SessionConfig;
import
com.dlink.session.SessionInfo
;
import
com.dlink.session.SessionInfo
;
import
com.dlink.session.SessionPool
;
import
com.dlink.session.SessionPool
;
import
com.dlink.trans.Operations
;
import
com.dlink.trans.Operations
;
import
com.dlink.utils.LogUtil
;
import
com.dlink.utils.SqlUtil
;
import
com.dlink.utils.SqlUtil
;
import
com.dlink.utils.UDFUtil
;
import
com.dlink.utils.UDFUtil
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
...
@@ -44,6 +45,8 @@ import org.apache.flink.yarn.configuration.YarnConfigOptions;
...
@@ -44,6 +45,8 @@ import org.apache.flink.yarn.configuration.YarnConfigOptions;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -366,16 +369,9 @@ public class JobManager {
...
@@ -366,16 +369,9 @@ public class JobManager {
job
.
setStatus
(
Job
.
JobStatus
.
SUCCESS
);
job
.
setStatus
(
Job
.
JobStatus
.
SUCCESS
);
success
();
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
String
error
=
LogUtil
.
getError
(
"Exception in executing FlinkSQL:\n"
+
currentSql
,
e
);
StackTraceElement
[]
trace
=
e
.
getStackTrace
();
job
.
setEndTime
(
LocalDateTime
.
now
());
StringBuffer
resMsg
=
new
StringBuffer
(
""
);
for
(
StackTraceElement
s
:
trace
)
{
resMsg
.
append
(
" \n "
+
s
+
" "
);
}
LocalDateTime
now
=
LocalDateTime
.
now
();
job
.
setEndTime
(
now
);
job
.
setStatus
(
Job
.
JobStatus
.
FAILED
);
job
.
setStatus
(
Job
.
JobStatus
.
FAILED
);
String
error
=
now
.
toString
()
+
":"
+
"Exception in executing FlinkSQL:\n"
+
currentSql
+
" \nError message: "
+
e
.
getMessage
()
+
" \n >>> PrintStackTrace <<<"
+
resMsg
.
toString
();
job
.
setError
(
error
);
job
.
setError
(
error
);
failed
();
failed
();
close
();
close
();
...
@@ -490,16 +486,9 @@ public class JobManager {
...
@@ -490,16 +486,9 @@ public class JobManager {
job
.
setStatus
(
Job
.
JobStatus
.
SUCCESS
);
job
.
setStatus
(
Job
.
JobStatus
.
SUCCESS
);
success
();
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
String
error
=
LogUtil
.
getError
(
"Exception in executing Jar:\n"
+
config
.
getGatewayConfig
().
getAppConfig
().
getUserJarPath
(),
e
);
StackTraceElement
[]
trace
=
e
.
getStackTrace
();
job
.
setEndTime
(
LocalDateTime
.
now
());
StringBuffer
resMsg
=
new
StringBuffer
(
""
);
for
(
StackTraceElement
s
:
trace
)
{
resMsg
.
append
(
" \n "
+
s
+
" "
);
}
LocalDateTime
now
=
LocalDateTime
.
now
();
job
.
setEndTime
(
now
);
job
.
setStatus
(
Job
.
JobStatus
.
FAILED
);
job
.
setStatus
(
Job
.
JobStatus
.
FAILED
);
String
error
=
now
.
toString
()
+
":"
+
"Exception in executing Jar:\n"
+
config
.
getGatewayConfig
().
getAppConfig
().
getUserJarPath
()
+
" \nError message: "
+
e
.
getMessage
()
+
" \n >>> PrintStackTrace <<<"
+
resMsg
.
toString
();
job
.
setError
(
error
);
job
.
setError
(
error
);
failed
();
failed
();
close
();
close
();
...
...
dlink-gateway/src/main/java/com/dlink/gateway/kubernetes/KubernetesApplicationGateway.java
View file @
9a201acb
...
@@ -6,6 +6,7 @@ import com.dlink.gateway.config.AppConfig;
...
@@ -6,6 +6,7 @@ import com.dlink.gateway.config.AppConfig;
import
com.dlink.gateway.exception.GatewayException
;
import
com.dlink.gateway.exception.GatewayException
;
import
com.dlink.gateway.result.GatewayResult
;
import
com.dlink.gateway.result.GatewayResult
;
import
com.dlink.gateway.result.KubernetesResult
;
import
com.dlink.gateway.result.KubernetesResult
;
import
com.dlink.utils.LogUtil
;
import
org.apache.flink.client.deployment.ClusterSpecification
;
import
org.apache.flink.client.deployment.ClusterSpecification
;
import
org.apache.flink.client.deployment.application.ApplicationConfiguration
;
import
org.apache.flink.client.deployment.application.ApplicationConfiguration
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.client.program.ClusterClient
;
...
@@ -52,9 +53,7 @@ public class KubernetesApplicationGateway extends KubernetesGateway {
...
@@ -52,9 +53,7 @@ public class KubernetesApplicationGateway extends KubernetesGateway {
result
.
setWebURL
(
clusterClient
.
getWebInterfaceURL
());
result
.
setWebURL
(
clusterClient
.
getWebInterfaceURL
());
result
.
success
();
result
.
success
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
result
.
fail
(
LogUtil
.
getError
(
e
));
logger
.
error
(
"任务提交时发生异常"
,
e
);
result
.
fail
(
e
.
getMessage
());
}
finally
{
}
finally
{
kubernetesClusterDescriptor
.
close
();
kubernetesClusterDescriptor
.
close
();
}
}
...
...
dlink-gateway/src/main/java/com/dlink/gateway/kubernetes/KubernetesGateway.java
View file @
9a201acb
...
@@ -8,6 +8,7 @@ import com.dlink.gateway.exception.GatewayException;
...
@@ -8,6 +8,7 @@ import com.dlink.gateway.exception.GatewayException;
import
com.dlink.gateway.model.JobInfo
;
import
com.dlink.gateway.model.JobInfo
;
import
com.dlink.gateway.result.SavePointResult
;
import
com.dlink.gateway.result.SavePointResult
;
import
com.dlink.gateway.result.TestResult
;
import
com.dlink.gateway.result.TestResult
;
import
com.dlink.utils.LogUtil
;
import
org.apache.flink.api.common.JobID
;
import
org.apache.flink.api.common.JobID
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
...
@@ -102,9 +103,7 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -102,9 +103,7 @@ public abstract class KubernetesGateway extends AbstractGateway {
runSavePointJob
(
jobInfos
,
clusterClient
,
savePoint
);
runSavePointJob
(
jobInfos
,
clusterClient
,
savePoint
);
result
.
setJobInfos
(
jobInfos
);
result
.
setJobInfos
(
jobInfos
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
result
.
fail
(
LogUtil
.
getError
(
e
));
logger
.
error
(
e
.
getMessage
());
result
.
fail
(
e
.
getMessage
());
}
}
return
null
;
return
null
;
}
}
...
@@ -139,9 +138,7 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -139,9 +138,7 @@ public abstract class KubernetesGateway extends AbstractGateway {
runSavePointJob
(
jobInfos
,
clusterClient
,
savePoint
);
runSavePointJob
(
jobInfos
,
clusterClient
,
savePoint
);
result
.
setJobInfos
(
jobInfos
);
result
.
setJobInfos
(
jobInfos
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
result
.
fail
(
LogUtil
.
getError
(
e
));
logger
.
error
(
e
.
getMessage
());
result
.
fail
(
e
.
getMessage
());
}
}
return
result
;
return
result
;
}
}
...
...
dlink-gateway/src/main/java/com/dlink/gateway/yarn/YarnApplicationGateway.java
View file @
9a201acb
...
@@ -7,6 +7,7 @@ import com.dlink.gateway.config.GatewayConfig;
...
@@ -7,6 +7,7 @@ import com.dlink.gateway.config.GatewayConfig;
import
com.dlink.gateway.exception.GatewayException
;
import
com.dlink.gateway.exception.GatewayException
;
import
com.dlink.gateway.result.GatewayResult
;
import
com.dlink.gateway.result.GatewayResult
;
import
com.dlink.gateway.result.YarnResult
;
import
com.dlink.gateway.result.YarnResult
;
import
com.dlink.utils.LogUtil
;
import
org.apache.flink.client.deployment.ClusterSpecification
;
import
org.apache.flink.client.deployment.ClusterSpecification
;
import
org.apache.flink.client.deployment.application.ApplicationConfiguration
;
import
org.apache.flink.client.deployment.application.ApplicationConfiguration
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.client.program.ClusterClient
;
...
@@ -66,9 +67,7 @@ public class YarnApplicationGateway extends YarnGateway {
...
@@ -66,9 +67,7 @@ public class YarnApplicationGateway extends YarnGateway {
result
.
setWebURL
(
clusterClient
.
getWebInterfaceURL
());
result
.
setWebURL
(
clusterClient
.
getWebInterfaceURL
());
result
.
success
();
result
.
success
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
result
.
fail
(
LogUtil
.
getError
(
e
));
logger
.
error
(
"任务提交时发生异常"
,
e
);
result
.
fail
(
e
.
getMessage
());
}
finally
{
}
finally
{
yarnClusterDescriptor
.
close
();
yarnClusterDescriptor
.
close
();
}
}
...
...
dlink-gateway/src/main/java/com/dlink/gateway/yarn/YarnGateway.java
View file @
9a201acb
...
@@ -8,6 +8,7 @@ import com.dlink.gateway.exception.GatewayException;
...
@@ -8,6 +8,7 @@ import com.dlink.gateway.exception.GatewayException;
import
com.dlink.gateway.model.JobInfo
;
import
com.dlink.gateway.model.JobInfo
;
import
com.dlink.gateway.result.SavePointResult
;
import
com.dlink.gateway.result.SavePointResult
;
import
com.dlink.gateway.result.TestResult
;
import
com.dlink.gateway.result.TestResult
;
import
com.dlink.utils.LogUtil
;
import
org.apache.flink.api.common.JobID
;
import
org.apache.flink.api.common.JobID
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.configuration.DeploymentOptions
;
import
org.apache.flink.configuration.DeploymentOptions
;
...
@@ -29,6 +30,8 @@ import org.apache.hadoop.yarn.api.records.ApplicationId;
...
@@ -29,6 +30,8 @@ import org.apache.hadoop.yarn.api.records.ApplicationId;
import
org.apache.hadoop.yarn.client.api.YarnClient
;
import
org.apache.hadoop.yarn.client.api.YarnClient
;
import
org.apache.hadoop.yarn.conf.YarnConfiguration
;
import
org.apache.hadoop.yarn.conf.YarnConfiguration
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.net.URI
;
import
java.net.URI
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
...
@@ -141,6 +144,9 @@ public abstract class YarnGateway extends AbstractGateway {
...
@@ -141,6 +144,9 @@ public abstract class YarnGateway extends AbstractGateway {
result
.
setJobInfos
(
jobInfos
);
result
.
setJobInfos
(
jobInfos
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
e
.
printStackTrace
(
pw
);
logger
.
error
(
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
());
result
.
fail
(
e
.
getMessage
());
result
.
fail
(
e
.
getMessage
());
}
}
...
@@ -184,9 +190,7 @@ public abstract class YarnGateway extends AbstractGateway {
...
@@ -184,9 +190,7 @@ public abstract class YarnGateway extends AbstractGateway {
runSavePointJob
(
jobInfos
,
clusterClient
,
savePoint
);
runSavePointJob
(
jobInfos
,
clusterClient
,
savePoint
);
result
.
setJobInfos
(
jobInfos
);
result
.
setJobInfos
(
jobInfos
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
result
.
fail
(
LogUtil
.
getError
(
e
));
logger
.
error
(
e
.
getMessage
());
result
.
fail
(
e
.
getMessage
());
}
}
return
result
;
return
result
;
}
}
...
...
dlink-gateway/src/main/java/com/dlink/gateway/yarn/YarnPerJobGateway.java
View file @
9a201acb
...
@@ -6,6 +6,7 @@ import com.dlink.gateway.GatewayType;
...
@@ -6,6 +6,7 @@ import com.dlink.gateway.GatewayType;
import
com.dlink.gateway.exception.GatewayException
;
import
com.dlink.gateway.exception.GatewayException
;
import
com.dlink.gateway.result.GatewayResult
;
import
com.dlink.gateway.result.GatewayResult
;
import
com.dlink.gateway.result.YarnResult
;
import
com.dlink.gateway.result.YarnResult
;
import
com.dlink.utils.LogUtil
;
import
org.apache.flink.client.deployment.ClusterSpecification
;
import
org.apache.flink.client.deployment.ClusterSpecification
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.client.program.ClusterClientProvider
;
import
org.apache.flink.client.program.ClusterClientProvider
;
...
@@ -51,9 +52,7 @@ public class YarnPerJobGateway extends YarnGateway {
...
@@ -51,9 +52,7 @@ public class YarnPerJobGateway extends YarnGateway {
result
.
setWebURL
(
clusterClient
.
getWebInterfaceURL
());
result
.
setWebURL
(
clusterClient
.
getWebInterfaceURL
());
result
.
success
();
result
.
success
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
result
.
fail
(
LogUtil
.
getError
(
e
));
logger
.
error
(
"任务提交时发生异常"
,
e
);
result
.
fail
(
e
.
getMessage
());
}
finally
{
}
finally
{
yarnClusterDescriptor
.
close
();
yarnClusterDescriptor
.
close
();
}
}
...
...
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