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
66c71944
Unverified
Commit
66c71944
authored
Apr 04, 2024
by
ZackYoung
Committed by
GitHub
Apr 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimization] [Flink Jar] Optimize flink jar task submission to support batch tasks (#3351)
Co-authored-by:
zackyoungh
<
zackyoungh@users.noreply.github.com
>
parent
58afc08b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
176 additions
and
38 deletions
+176
-38
Submitter.java
...-base/src/main/java/org/dinky/app/flinksql/Submitter.java
+27
-11
ExecuteJarOperation.java
...rc/main/java/org/dinky/trans/dml/ExecuteJarOperation.java
+10
-9
FlinkStreamEnvironmentUtil.java
...main/java/org/dinky/utils/FlinkStreamEnvironmentUtil.java
+107
-0
Explainer.java
dinky-core/src/main/java/org/dinky/explainer/Explainer.java
+4
-3
JobManager.java
dinky-core/src/main/java/org/dinky/job/JobManager.java
+23
-11
JobJarStreamGraphBuilder.java
.../java/org/dinky/job/builder/JobJarStreamGraphBuilder.java
+2
-2
JobDesc.tsx
...pages/DevOps/JobDetail/JobOverview/components/JobDesc.tsx
+3
-2
No files found.
dinky-app/dinky-app-base/src/main/java/org/dinky/app/flinksql/Submitter.java
View file @
66c71944
...
@@ -44,11 +44,14 @@ import org.dinky.trans.parse.AddFileSqlParseStrategy;
...
@@ -44,11 +44,14 @@ import org.dinky.trans.parse.AddFileSqlParseStrategy;
import
org.dinky.trans.parse.AddJarSqlParseStrategy
;
import
org.dinky.trans.parse.AddJarSqlParseStrategy
;
import
org.dinky.trans.parse.ExecuteJarParseStrategy
;
import
org.dinky.trans.parse.ExecuteJarParseStrategy
;
import
org.dinky.url.RsURLStreamHandlerFactory
;
import
org.dinky.url.RsURLStreamHandlerFactory
;
import
org.dinky.utils.FlinkStreamEnvironmentUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.dinky.utils.ZipUtils
;
import
org.dinky.utils.ZipUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.flink.api.common.Plan
;
import
org.apache.flink.api.dag.Pipeline
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.ReadableConfig
;
import
org.apache.flink.configuration.ReadableConfig
;
import
org.apache.flink.core.execution.JobClient
;
import
org.apache.flink.core.execution.JobClient
;
...
@@ -252,20 +255,33 @@ public class Submitter {
...
@@ -252,20 +255,33 @@ public class Submitter {
String
sqlStatement
=
executor
.
pretreatStatement
(
statement
);
String
sqlStatement
=
executor
.
pretreatStatement
(
statement
);
if
(
ExecuteJarParseStrategy
.
INSTANCE
.
match
(
sqlStatement
))
{
if
(
ExecuteJarParseStrategy
.
INSTANCE
.
match
(
sqlStatement
))
{
ExecuteJarOperation
executeJarOperation
=
new
ExecuteJarOperation
(
sqlStatement
);
ExecuteJarOperation
executeJarOperation
=
new
ExecuteJarOperation
(
sqlStatement
);
StreamGraph
streamGraph
=
executeJarOperation
.
getStreamGraph
(
executor
.
getCustomTableEnvironment
());
Pipeline
pipeline
=
executeJarOperation
.
getStreamGraph
(
executor
.
getCustomTableEnvironment
());
ReadableConfig
configuration
=
ReadableConfig
configuration
=
executor
.
getStreamExecutionEnvironment
().
getConfiguration
();
executor
.
getStreamExecutionEnvironment
().
getConfiguration
();
streamGraph
if
(
pipeline
instanceof
StreamGraph
)
{
.
getExecutionConfig
()
// stream job
.
configure
(
configuration
,
Thread
.
currentThread
().
getContextClassLoader
());
StreamGraph
streamGraph
=
(
StreamGraph
)
pipeline
;
streamGraph
.
getCheckpointConfig
().
configure
(
configuration
);
streamGraph
streamGraph
.
setJobName
(
executor
.
getExecutorConfig
().
getJobName
());
.
getExecutionConfig
()
String
savePointPath
=
executor
.
getExecutorConfig
().
getSavePointPath
();
.
configure
(
configuration
,
Thread
.
currentThread
().
getContextClassLoader
());
if
(
Asserts
.
isNotNullString
(
savePointPath
))
{
streamGraph
.
getCheckpointConfig
().
configure
(
configuration
);
streamGraph
.
setSavepointRestoreSettings
(
SavepointRestoreSettings
.
forPath
(
streamGraph
.
setJobName
(
executor
.
getExecutorConfig
().
getJobName
());
savePointPath
,
configuration
.
get
(
SavepointConfigOptions
.
SAVEPOINT_IGNORE_UNCLAIMED_STATE
)));
String
savePointPath
=
executor
.
getExecutorConfig
().
getSavePointPath
();
if
(
Asserts
.
isNotNullString
(
savePointPath
))
{
streamGraph
.
setSavepointRestoreSettings
(
SavepointRestoreSettings
.
forPath
(
savePointPath
,
configuration
.
get
(
SavepointConfigOptions
.
SAVEPOINT_IGNORE_UNCLAIMED_STATE
)));
}
}
else
if
(
pipeline
instanceof
Plan
)
{
// batch job
Plan
plan
=
(
Plan
)
pipeline
;
plan
.
getExecutionConfig
()
.
configure
(
configuration
,
Thread
.
currentThread
().
getContextClassLoader
());
plan
.
setJobName
(
executor
.
getExecutorConfig
().
getJobName
());
}
}
JobClient
client
=
executor
.
getStreamExecutionEnvironment
().
executeAsync
(
streamGraph
);
JobClient
client
=
FlinkStreamEnvironmentUtil
.
executeAsync
(
pipeline
,
executor
.
getStreamExecutionEnvironment
());
jobClient
=
Optional
.
of
(
client
);
jobClient
=
Optional
.
of
(
client
);
break
;
break
;
}
}
...
...
dinky-client/dinky-client-base/src/main/java/org/dinky/trans/dml/ExecuteJarOperation.java
View file @
66c71944
...
@@ -23,6 +23,7 @@ import org.dinky.executor.CustomTableEnvironment;
...
@@ -23,6 +23,7 @@ import org.dinky.executor.CustomTableEnvironment;
import
org.dinky.trans.AbstractOperation
;
import
org.dinky.trans.AbstractOperation
;
import
org.dinky.trans.ExtendOperation
;
import
org.dinky.trans.ExtendOperation
;
import
org.dinky.trans.parse.ExecuteJarParseStrategy
;
import
org.dinky.trans.parse.ExecuteJarParseStrategy
;
import
org.dinky.utils.FlinkStreamEnvironmentUtil
;
import
org.dinky.utils.URLUtils
;
import
org.dinky.utils.URLUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -32,7 +33,7 @@ import org.apache.flink.client.program.PackagedProgramUtils;
...
@@ -32,7 +33,7 @@ import org.apache.flink.client.program.PackagedProgramUtils;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.runtime.jobgraph.SavepointConfigOptions
;
import
org.apache.flink.runtime.jobgraph.SavepointConfigOptions
;
import
org.apache.flink.runtime.jobgraph.SavepointRestoreSettings
;
import
org.apache.flink.runtime.jobgraph.SavepointRestoreSettings
;
import
org.apache.flink.streaming.api.
graph.StreamGraph
;
import
org.apache.flink.streaming.api.
environment.StreamExecutionEnvironment
;
import
org.apache.flink.table.api.TableResult
;
import
org.apache.flink.table.api.TableResult
;
import
java.io.File
;
import
java.io.File
;
...
@@ -60,7 +61,8 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
...
@@ -60,7 +61,8 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
@Override
@Override
public
Optional
<?
extends
TableResult
>
execute
(
CustomTableEnvironment
tEnv
)
{
public
Optional
<?
extends
TableResult
>
execute
(
CustomTableEnvironment
tEnv
)
{
try
{
try
{
tEnv
.
getStreamExecutionEnvironment
().
execute
(
getStreamGraph
(
tEnv
));
StreamExecutionEnvironment
streamExecutionEnvironment
=
tEnv
.
getStreamExecutionEnvironment
();
FlinkStreamEnvironmentUtil
.
executeAsync
(
getStreamGraph
(
tEnv
),
streamExecutionEnvironment
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -68,16 +70,16 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
...
@@ -68,16 +70,16 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
return
Optional
.
of
(
TABLE_RESULT_OK
);
return
Optional
.
of
(
TABLE_RESULT_OK
);
}
}
public
StreamGraph
getStreamGraph
(
CustomTableEnvironment
tEnv
)
{
public
Pipeline
getStreamGraph
(
CustomTableEnvironment
tEnv
)
{
return
getStreamGraph
(
tEnv
,
Collections
.
emptyList
());
return
getStreamGraph
(
tEnv
,
Collections
.
emptyList
());
}
}
public
StreamGraph
getStreamGraph
(
CustomTableEnvironment
tEnv
,
List
<
URL
>
classpaths
)
{
public
Pipeline
getStreamGraph
(
CustomTableEnvironment
tEnv
,
List
<
URL
>
classpaths
)
{
JarSubmitParam
submitParam
=
JarSubmitParam
.
build
(
statement
);
JarSubmitParam
submitParam
=
JarSubmitParam
.
build
(
statement
);
return
getStreamGraph
(
submitParam
,
tEnv
,
classpaths
);
return
getStreamGraph
(
submitParam
,
tEnv
,
classpaths
);
}
}
public
static
StreamGraph
getStreamGraph
(
public
static
Pipeline
getStreamGraph
(
JarSubmitParam
submitParam
,
CustomTableEnvironment
tEnv
,
List
<
URL
>
classpaths
)
{
JarSubmitParam
submitParam
,
CustomTableEnvironment
tEnv
,
List
<
URL
>
classpaths
)
{
SavepointRestoreSettings
savepointRestoreSettings
=
StrUtil
.
isBlank
(
submitParam
.
getSavepointPath
())
SavepointRestoreSettings
savepointRestoreSettings
=
StrUtil
.
isBlank
(
submitParam
.
getSavepointPath
())
?
SavepointRestoreSettings
.
none
()
?
SavepointRestoreSettings
.
none
()
...
@@ -110,8 +112,7 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
...
@@ -110,8 +112,7 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
:
tEnv
.
getStreamExecutionEnvironment
().
getParallelism
();
:
tEnv
.
getStreamExecutionEnvironment
().
getParallelism
();
Pipeline
pipeline
=
PackagedProgramUtils
.
getPipelineFromProgram
(
program
,
configuration
,
parallelism
,
true
);
Pipeline
pipeline
=
PackagedProgramUtils
.
getPipelineFromProgram
(
program
,
configuration
,
parallelism
,
true
);
program
.
close
();
program
.
close
();
Assert
.
isTrue
(
pipeline
instanceof
StreamGraph
,
"can not translate"
);
return
pipeline
;
return
(
StreamGraph
)
pipeline
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -146,11 +147,11 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
...
@@ -146,11 +147,11 @@ public class ExecuteJarOperation extends AbstractOperation implements ExtendOper
return
statement
;
return
statement
;
}
}
public
StreamGraph
explain
(
CustomTableEnvironment
tEnv
)
{
public
Pipeline
explain
(
CustomTableEnvironment
tEnv
)
{
return
getStreamGraph
(
tEnv
);
return
getStreamGraph
(
tEnv
);
}
}
public
StreamGraph
explain
(
CustomTableEnvironment
tEnv
,
List
<
URL
>
classpaths
)
{
public
Pipeline
explain
(
CustomTableEnvironment
tEnv
,
List
<
URL
>
classpaths
)
{
return
getStreamGraph
(
tEnv
,
classpaths
);
return
getStreamGraph
(
tEnv
,
classpaths
);
}
}
...
...
dinky-client/dinky-client-base/src/main/java/org/dinky/utils/FlinkStreamEnvironmentUtil.java
0 → 100644
View file @
66c71944
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
utils
;
import
static
org
.
apache
.
flink
.
util
.
Preconditions
.
checkNotNull
;
import
org.apache.flink.api.common.Plan
;
import
org.apache.flink.api.dag.Pipeline
;
import
org.apache.flink.client.PlanTranslator
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.DeploymentOptions
;
import
org.apache.flink.core.execution.JobClient
;
import
org.apache.flink.core.execution.JobListener
;
import
org.apache.flink.core.execution.PipelineExecutorFactory
;
import
org.apache.flink.core.execution.PipelineExecutorServiceLoader
;
import
org.apache.flink.runtime.jobgraph.JobGraph
;
import
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
;
import
org.apache.flink.streaming.api.graph.StreamGraph
;
import
org.apache.flink.util.ExceptionUtils
;
import
org.apache.flink.util.FlinkException
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
cn.hutool.core.util.ReflectUtil
;
public
enum
FlinkStreamEnvironmentUtil
{
;
public
static
JobClient
executeAsync
(
Pipeline
pipeline
,
StreamExecutionEnvironment
env
)
throws
Exception
{
Configuration
configuration
=
new
Configuration
((
Configuration
)
env
.
getConfiguration
());
checkNotNull
(
pipeline
,
"pipeline cannot be null."
);
checkNotNull
(
configuration
.
get
(
DeploymentOptions
.
TARGET
),
"No execution.target specified in your configuration file."
);
PipelineExecutorServiceLoader
executorServiceLoader
=
(
PipelineExecutorServiceLoader
)
ReflectUtil
.
getFieldValue
(
env
,
"executorServiceLoader"
);
ClassLoader
userClassloader
=
(
ClassLoader
)
ReflectUtil
.
getFieldValue
(
env
,
"userClassloader"
);
final
PipelineExecutorFactory
executorFactory
=
executorServiceLoader
.
getExecutorFactory
(
configuration
);
checkNotNull
(
executorFactory
,
"Cannot find compatible factory for specified execution.target (=%s)"
,
configuration
.
get
(
DeploymentOptions
.
TARGET
));
CompletableFuture
<
JobClient
>
jobClientFuture
=
executorFactory
.
getExecutor
(
configuration
).
execute
(
pipeline
,
configuration
,
userClassloader
);
List
<
JobListener
>
jobListeners
=
env
.
getJobListeners
();
try
{
JobClient
jobClient
=
jobClientFuture
.
get
();
jobListeners
.
forEach
(
jobListener
->
jobListener
.
onJobSubmitted
(
jobClient
,
null
));
return
jobClient
;
}
catch
(
ExecutionException
executionException
)
{
final
Throwable
strippedException
=
ExceptionUtils
.
stripExecutionException
(
executionException
);
jobListeners
.
forEach
(
jobListener
->
jobListener
.
onJobSubmitted
(
null
,
strippedException
));
throw
new
FlinkException
(
String
.
format
(
"Failed to execute job '%s'."
,
ReflectUtil
.
invoke
(
pipeline
,
"getJobName"
)),
strippedException
);
}
}
public
static
String
getStreamingPlanAsJSON
(
Pipeline
pipeline
)
{
if
(
pipeline
instanceof
StreamGraph
)
{
return
((
StreamGraph
)
pipeline
).
getStreamingPlanAsJSON
();
}
else
if
(
pipeline
instanceof
Plan
)
{
;
PlanTranslator
planTranslator
=
new
PlanTranslator
();
return
planTranslator
.
translateToJSONExecutionPlan
(
pipeline
);
}
else
{
throw
new
IllegalArgumentException
(
"Unknown pipeline type: "
+
pipeline
);
}
}
public
static
JobGraph
getJobGraph
(
Pipeline
pipeline
,
Configuration
configuration
)
{
if
(
pipeline
instanceof
StreamGraph
)
{
return
((
StreamGraph
)
pipeline
).
getJobGraph
();
}
else
if
(
pipeline
instanceof
Plan
)
{
;
Plan
plan
=
((
Plan
)
pipeline
);
PlanTranslator
planTranslator
=
new
PlanTranslator
();
return
planTranslator
.
translateToJobGraph
(
pipeline
,
configuration
,
plan
.
getDefaultParallelism
());
}
else
{
throw
new
IllegalArgumentException
(
"Unknown pipeline type: "
+
pipeline
);
}
}
}
dinky-core/src/main/java/org/dinky/explainer/Explainer.java
View file @
66c71944
...
@@ -44,15 +44,16 @@ import org.dinky.trans.parse.AddJarSqlParseStrategy;
...
@@ -44,15 +44,16 @@ import org.dinky.trans.parse.AddJarSqlParseStrategy;
import
org.dinky.trans.parse.ExecuteJarParseStrategy
;
import
org.dinky.trans.parse.ExecuteJarParseStrategy
;
import
org.dinky.trans.parse.SetSqlParseStrategy
;
import
org.dinky.trans.parse.SetSqlParseStrategy
;
import
org.dinky.utils.DinkyClassLoaderUtil
;
import
org.dinky.utils.DinkyClassLoaderUtil
;
import
org.dinky.utils.FlinkStreamEnvironmentUtil
;
import
org.dinky.utils.IpUtil
;
import
org.dinky.utils.IpUtil
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.dinky.utils.URLUtils
;
import
org.dinky.utils.URLUtils
;
import
org.apache.flink.api.dag.Pipeline
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.core.fs.FileSystem
;
import
org.apache.flink.core.fs.FileSystem
;
import
org.apache.flink.runtime.rest.messages.JobPlanInfo
;
import
org.apache.flink.runtime.rest.messages.JobPlanInfo
;
import
org.apache.flink.streaming.api.graph.StreamGraph
;
import
java.net.URL
;
import
java.net.URL
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -312,9 +313,9 @@ public class Explainer {
...
@@ -312,9 +313,9 @@ public class Explainer {
}
else
if
(
ExecuteJarParseStrategy
.
INSTANCE
.
match
(
item
.
getValue
()))
{
}
else
if
(
ExecuteJarParseStrategy
.
INSTANCE
.
match
(
item
.
getValue
()))
{
List
<
URL
>
allFileByAdd
=
jobManager
.
getAllFileSet
();
List
<
URL
>
allFileByAdd
=
jobManager
.
getAllFileSet
();
StreamGraph
streamGraph
=
new
ExecuteJarOperation
(
item
.
getValue
())
Pipeline
pipeline
=
new
ExecuteJarOperation
(
item
.
getValue
())
.
explain
(
executor
.
getCustomTableEnvironment
(),
allFileByAdd
);
.
explain
(
executor
.
getCustomTableEnvironment
(),
allFileByAdd
);
sqlExplainResult
.
setExplain
(
streamGraph
.
getStreamingPlanAsJSON
(
));
sqlExplainResult
.
setExplain
(
FlinkStreamEnvironmentUtil
.
getStreamingPlanAsJSON
(
pipeline
));
}
else
{
}
else
{
executor
.
executeSql
(
item
.
getValue
());
executor
.
executeSql
(
item
.
getValue
());
}
}
...
...
dinky-core/src/main/java/org/dinky/job/JobManager.java
View file @
66c71944
...
@@ -61,11 +61,14 @@ import org.dinky.trans.Operations;
...
@@ -61,11 +61,14 @@ import org.dinky.trans.Operations;
import
org.dinky.trans.parse.AddFileSqlParseStrategy
;
import
org.dinky.trans.parse.AddFileSqlParseStrategy
;
import
org.dinky.trans.parse.AddJarSqlParseStrategy
;
import
org.dinky.trans.parse.AddJarSqlParseStrategy
;
import
org.dinky.utils.DinkyClassLoaderUtil
;
import
org.dinky.utils.DinkyClassLoaderUtil
;
import
org.dinky.utils.FlinkStreamEnvironmentUtil
;
import
org.dinky.utils.JsonUtils
;
import
org.dinky.utils.JsonUtils
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.dinky.utils.URLUtils
;
import
org.dinky.utils.URLUtils
;
import
org.apache.flink.api.common.Plan
;
import
org.apache.flink.api.dag.Pipeline
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.flink.configuration.DeploymentOptions
;
import
org.apache.flink.configuration.DeploymentOptions
;
...
@@ -246,9 +249,10 @@ public class JobManager {
...
@@ -246,9 +249,10 @@ public class JobManager {
}
}
public
ObjectNode
getJarStreamGraphJson
(
String
statement
)
{
public
ObjectNode
getJarStreamGraphJson
(
String
statement
)
{
StreamGraph
streamGraph
=
Pipeline
pipeline
=
JobJarStreamGraphBuilder
.
build
(
this
).
getJarStreamGraph
(
statement
,
getDinkyClassLoader
());
JobJarStreamGraphBuilder
.
build
(
this
).
getJarStreamGraph
(
statement
,
getDinkyClassLoader
());
Configuration
configuration
=
Configuration
.
fromMap
(
getExecutorConfig
().
getConfig
());
return
JsonUtils
.
parseObject
(
JsonPlanGenerator
.
generatePlan
(
streamGraph
.
getJobGraph
()));
JobGraph
jobGraph
=
FlinkStreamEnvironmentUtil
.
getJobGraph
(
pipeline
,
configuration
);
return
JsonUtils
.
parseObject
(
JsonPlanGenerator
.
generatePlan
(
jobGraph
));
}
}
@ProcessStep
(
type
=
ProcessStepType
.
SUBMIT_EXECUTE
)
@ProcessStep
(
type
=
ProcessStepType
.
SUBMIT_EXECUTE
)
...
@@ -260,17 +264,21 @@ public class JobManager {
...
@@ -260,17 +264,21 @@ public class JobManager {
job
=
Job
.
build
(
runMode
,
config
,
executorConfig
,
executor
,
statement
,
useGateway
);
job
=
Job
.
build
(
runMode
,
config
,
executorConfig
,
executor
,
statement
,
useGateway
);
ready
();
ready
();
JobJarStreamGraphBuilder
jobJarStreamGraphBuilder
=
JobJarStreamGraphBuilder
.
build
(
this
);
JobJarStreamGraphBuilder
jobJarStreamGraphBuilder
=
JobJarStreamGraphBuilder
.
build
(
this
);
StreamGraph
streamGraph
=
jobJarStreamGraphBuilder
.
getJarStreamGraph
(
statement
,
getDinkyClassLoader
());
Pipeline
pipeline
=
jobJarStreamGraphBuilder
.
getJarStreamGraph
(
statement
,
getDinkyClassLoader
());
Configuration
configuration
=
Configuration
configuration
=
executor
.
getCustomTableEnvironment
().
getConfig
().
getConfiguration
();
executor
.
getCustomTableEnvironment
().
getConfig
().
getConfiguration
();
if
(
Asserts
.
isNotNullString
(
config
.
getSavePointPath
()))
{
if
(
pipeline
instanceof
StreamGraph
)
{
streamGraph
.
setSavepointRestoreSettings
(
SavepointRestoreSettings
.
forPath
(
if
(
Asserts
.
isNotNullString
(
config
.
getSavePointPath
()))
{
config
.
getSavePointPath
(),
((
StreamGraph
)
pipeline
)
configuration
.
get
(
SavepointConfigOptions
.
SAVEPOINT_IGNORE_UNCLAIMED_STATE
)));
.
setSavepointRestoreSettings
(
SavepointRestoreSettings
.
forPath
(
config
.
getSavePointPath
(),
configuration
.
get
(
SavepointConfigOptions
.
SAVEPOINT_IGNORE_UNCLAIMED_STATE
)));
}
}
}
try
{
try
{
if
(!
useGateway
)
{
if
(!
useGateway
)
{
JobClient
jobClient
=
executor
.
getStreamExecutionEnvironment
().
executeAsync
(
streamGraph
);
JobClient
jobClient
=
FlinkStreamEnvironmentUtil
.
executeAsync
(
pipeline
,
executor
.
getStreamExecutionEnvironment
());
if
(
Asserts
.
isNotNull
(
jobClient
))
{
if
(
Asserts
.
isNotNull
(
jobClient
))
{
job
.
setJobId
(
jobClient
.
getJobID
().
toHexString
());
job
.
setJobId
(
jobClient
.
getJobID
().
toHexString
());
job
.
setJids
(
new
ArrayList
<
String
>()
{
job
.
setJids
(
new
ArrayList
<
String
>()
{
...
@@ -292,8 +300,12 @@ public class JobManager {
...
@@ -292,8 +300,12 @@ public class JobManager {
config
.
getGatewayConfig
().
setSql
(
statement
);
config
.
getGatewayConfig
().
setSql
(
statement
);
gatewayResult
=
Gateway
.
build
(
config
.
getGatewayConfig
()).
submitJar
(
getUdfPathContextHolder
());
gatewayResult
=
Gateway
.
build
(
config
.
getGatewayConfig
()).
submitJar
(
getUdfPathContextHolder
());
}
else
{
}
else
{
streamGraph
.
setJobName
(
config
.
getJobName
());
if
(
pipeline
instanceof
StreamGraph
)
{
JobGraph
jobGraph
=
streamGraph
.
getJobGraph
();
((
StreamGraph
)
pipeline
).
setJobName
(
config
.
getJobName
());
}
else
if
(
pipeline
instanceof
Plan
)
{
((
Plan
)
pipeline
).
setJobName
(
config
.
getJobName
());
}
JobGraph
jobGraph
=
FlinkStreamEnvironmentUtil
.
getJobGraph
(
pipeline
,
configuration
);
GatewayConfig
gatewayConfig
=
config
.
getGatewayConfig
();
GatewayConfig
gatewayConfig
=
config
.
getGatewayConfig
();
List
<
String
>
uriList
=
jobJarStreamGraphBuilder
.
getUris
(
statement
);
List
<
String
>
uriList
=
jobJarStreamGraphBuilder
.
getUris
(
statement
);
String
[]
jarPaths
=
uriList
.
stream
()
String
[]
jarPaths
=
uriList
.
stream
()
...
...
dinky-core/src/main/java/org/dinky/job/builder/JobJarStreamGraphBuilder.java
View file @
66c71944
...
@@ -34,7 +34,7 @@ import org.dinky.trans.parse.SetSqlParseStrategy;
...
@@ -34,7 +34,7 @@ import org.dinky.trans.parse.SetSqlParseStrategy;
import
org.dinky.utils.DinkyClassLoaderUtil
;
import
org.dinky.utils.DinkyClassLoaderUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.dinky.utils.SqlUtil
;
import
org.apache.flink.
streaming.api.graph.StreamGraph
;
import
org.apache.flink.
api.dag.Pipeline
;
import
java.io.File
;
import
java.io.File
;
import
java.net.URL
;
import
java.net.URL
;
...
@@ -60,7 +60,7 @@ public class JobJarStreamGraphBuilder extends JobBuilder {
...
@@ -60,7 +60,7 @@ public class JobJarStreamGraphBuilder extends JobBuilder {
@Override
@Override
public
void
run
()
throws
Exception
{}
public
void
run
()
throws
Exception
{}
public
StreamGraph
getJarStreamGraph
(
String
statement
,
DinkyClassLoader
dinkyClassLoader
)
{
public
Pipeline
getJarStreamGraph
(
String
statement
,
DinkyClassLoader
dinkyClassLoader
)
{
DinkyClassLoaderUtil
.
initClassLoader
(
config
,
dinkyClassLoader
);
DinkyClassLoaderUtil
.
initClassLoader
(
config
,
dinkyClassLoader
);
String
[]
statements
=
SqlUtil
.
getStatements
(
statement
);
String
[]
statements
=
SqlUtil
.
getStatements
(
statement
);
ExecuteJarOperation
executeJarOperation
=
null
;
ExecuteJarOperation
executeJarOperation
=
null
;
...
...
dinky-web/src/pages/DevOps/JobDetail/JobOverview/components/JobDesc.tsx
View file @
66c71944
...
@@ -88,7 +88,8 @@ const JobDesc = (props: JobProps) => {
...
@@ -88,7 +88,8 @@ const JobDesc = (props: JobProps) => {
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.RestartStrategy'
)
}
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.RestartStrategy'
)
}
>
<
Tag
color=
'blue'
title=
{
'Restart Strategy'
}
>
<
Tag
color=
'blue'
title=
{
'Restart Strategy'
}
>
{
jobDetail
?.
jobDataDto
?.
config
[
'execution-config'
][
'restart-strategy'
]
}
{
jobDetail
?.
jobDataDto
?.
config
?.
executionConfig
?.[
'restart-strategy'
]
??
jobDetail
?.
jobDataDto
?.
config
?.[
'execution-config'
]?.[
'restart-strategy'
]
}
</
Tag
>
</
Tag
>
</
Descriptions
.
Item
>
</
Descriptions
.
Item
>
...
@@ -119,7 +120,7 @@ const JobDesc = (props: JobProps) => {
...
@@ -119,7 +120,7 @@ const JobDesc = (props: JobProps) => {
</
Descriptions
.
Item
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.JobParallelism'
)
}
>
<
Descriptions
.
Item
label=
{
l
(
'devops.jobinfo.config.JobParallelism'
)
}
>
{
jobDetail
?.
jobDataDto
?.
config
[
'execution-config'
][
'job-parallelism'
]
}
{
jobDetail
?.
jobDataDto
?.
config
?.[
'execution-config'
]?.
jobParallelism
}
</
Descriptions
.
Item
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
l
(
'global.table.useTime'
)
}
>
<
Descriptions
.
Item
label=
{
l
(
'global.table.useTime'
)
}
>
...
...
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